Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions srtcore/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,14 @@ struct EventVariant
// Note: UNDEFINED and ARRAY don't have assignment operator.
// For ARRAY you'll use 'set' function. For UNDEFINED there's nothing.

// For events that pass no argument (e.g. TEV_SYNC).
EventVariant()
{
type = UNDEFINED;
u.array.ptr = NULL;
u.array.len = 0;
}

explicit EventVariant(const srt::CPacket* arg)
{
type = PACKET;
Expand Down
2 changes: 1 addition & 1 deletion srtcore/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ class CUDT
return;

m_pSndBuffer->setRateEstimator(rate);
updateCC(TEV_SYNC, EventVariant(0));
updateCC(TEV_SYNC, EventVariant());
}


Expand Down
4 changes: 2 additions & 2 deletions srtcore/socketconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ struct CSrtConfigSetter<SRTO_UDP_SNDBUF>
{
static void set(CSrtConfig& co, const void* optval, int optlen)
{
co.iUDPSndBufSize = std::max(co.iMSS, cast_optval<int>(optval, optlen));
co.iUDPSndBufSize = std::max(co.iMSS, cast_optval<int32_t>(optval, optlen));
}
};

Expand All @@ -170,7 +170,7 @@ struct CSrtConfigSetter<SRTO_UDP_RCVBUF>
{
static void set(CSrtConfig& co, const void* optval, int optlen)
{
co.iUDPRcvBufSize = std::max(co.iMSS, cast_optval<int>(optval, optlen));
co.iUDPRcvBufSize = std::max(co.iMSS, cast_optval<int32_t>(optval, optlen));
}
};
template<>
Expand Down
2 changes: 1 addition & 1 deletion srtcore/socketconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ struct CSrtConfig: CSrtMuxerConfig
static const size_t MAX_PFILTER_LENGTH = 64;
static const size_t MAX_CONG_LENGTH = 16;

int iMSS; // Maximum Segment Size, in bytes
int32_t iMSS; // Maximum Segment Size, in bytes (int32_t: matches CHandShake::m_iMSS)
size_t zExpPayloadSize; // Expected average payload size (user option)

// Options
Expand Down
20 changes: 5 additions & 15 deletions srtcore/sync_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
#include "platform_sys.h"

#include <exception>
#include <iomanip>
#include <math.h>
#include <stdexcept>
Expand Down Expand Up @@ -394,22 +395,11 @@ srt::sync::CThread& srt::sync::CThread::operator=(CThread& other)
{
if (joinable())
{
// If the thread has already terminated, then
// pthread_join() returns immediately.
// But we have to check it has terminated before replacing it.
// Match std::thread semantics: assigning to a joinable thread
// terminates the program ([thread.thread.assign]). This error should
// not normally happen; the log line makes the abort diagnosable.
LOGC(inlog.Error, log << "IPE: Assigning to a thread that is not terminated!");

#ifndef DEBUG
#if !defined(__ANDROID__) && !defined(__OHOS__)
// In case of production build the hanging thread should be terminated
// to avoid hang ups and align with C++11 implementation.
// There is no pthread_cancel on Android. See #1476. This error should not normally
// happen, but if it happen, then detaching the thread.
pthread_cancel(m_thread);
#endif // __ANDROID__ __OHOS__
#else
join();
#endif
std::terminate();
}
// Move thread handler from other
m_thread = other.m_thread;
Expand Down
Loading