mirror of
https://github.com/mii443/libdatachannel.git
synced 2025-08-22 23:25:33 +00:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
38db6d7365 | |||
781d864b9f | |||
8cbcb35bf4 | |||
b63ec9cead | |||
aa6f87f467 | |||
eec7a761e8 |
@ -1,6 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
project(libdatachannel
|
||||
VERSION 0.11.8
|
||||
VERSION 0.11.10
|
||||
LANGUAGES CXX)
|
||||
set(PROJECT_DESCRIPTION "WebRTC Data Channels Library")
|
||||
|
||||
|
@ -37,17 +37,6 @@
|
||||
#include <set>
|
||||
#include <thread>
|
||||
|
||||
#if __clang__ && defined(__APPLE__)
|
||||
namespace {
|
||||
template <typename To, typename From>
|
||||
inline std::shared_ptr<To> reinterpret_pointer_cast(std::shared_ptr<From> const &ptr) noexcept {
|
||||
return std::shared_ptr<To>(ptr, reinterpret_cast<To *>(ptr.get()));
|
||||
}
|
||||
} // namespace
|
||||
#else
|
||||
using std::reinterpret_pointer_cast;
|
||||
#endif
|
||||
|
||||
static rtc::LogCounter COUNTER_MEDIA_TRUNCATED(plog::warning,
|
||||
"Number of RTP packets truncated over past second");
|
||||
static rtc::LogCounter
|
||||
@ -701,7 +690,7 @@ void PeerConnection::forwardMedia(message_ptr message) {
|
||||
std::set<uint32_t> ssrcs;
|
||||
size_t offset = 0;
|
||||
while ((sizeof(rtc::RTCP_HEADER) + offset) <= message->size()) {
|
||||
auto header = reinterpret_cast<rtc::RTCP_HEADER *>(message->data() + offset);
|
||||
auto header = reinterpret_cast<RTCP_HEADER *>(message->data() + offset);
|
||||
if (header->lengthInBytes() > message->size() - offset) {
|
||||
COUNTER_MEDIA_TRUNCATED++;
|
||||
break;
|
||||
@ -923,12 +912,13 @@ void PeerConnection::incomingTrack(Description::Media description) {
|
||||
void PeerConnection::openTracks() {
|
||||
#if RTC_ENABLE_MEDIA
|
||||
if (auto transport = std::atomic_load(&mDtlsTransport)) {
|
||||
auto srtpTransport = reinterpret_pointer_cast<DtlsSrtpTransport>(transport);
|
||||
std::shared_lock lock(mTracksMutex); // read-only
|
||||
for (auto it = mTracks.begin(); it != mTracks.end(); ++it)
|
||||
if (auto track = it->second.lock())
|
||||
if (!track->isOpen())
|
||||
track->open(srtpTransport);
|
||||
if (auto srtpTransport = std::dynamic_pointer_cast<DtlsSrtpTransport>(transport)) {
|
||||
std::shared_lock lock(mTracksMutex); // read-only
|
||||
for (auto it = mTracks.begin(); it != mTracks.end(); ++it)
|
||||
if (auto track = it->second.lock())
|
||||
if (!track->isOpen())
|
||||
track->open(srtpTransport);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ void ThreadPool::join() {
|
||||
|
||||
void ThreadPool::run() {
|
||||
++mBusyWorkers;
|
||||
scope_guard([&]() { --mBusyWorkers; });
|
||||
scope_guard guard([&]() { --mBusyWorkers; });
|
||||
while (runOne()) {
|
||||
}
|
||||
}
|
||||
@ -94,7 +94,7 @@ std::function<void()> ThreadPool::dequeue() {
|
||||
}
|
||||
|
||||
--mBusyWorkers;
|
||||
scope_guard([&]() { ++mBusyWorkers; });
|
||||
scope_guard guard([&]() { ++mBusyWorkers; });
|
||||
mWaitingCondition.notify_all();
|
||||
if(time)
|
||||
mTasksCondition.wait_until(lock, *time);
|
||||
|
@ -72,7 +72,7 @@ protected:
|
||||
std::function<void()> dequeue(); // returns null function if joining
|
||||
|
||||
std::vector<std::thread> mWorkers;
|
||||
int mBusyWorkers = 0;
|
||||
std::atomic<int> mBusyWorkers = 0;
|
||||
std::atomic<bool> mJoining = false;
|
||||
|
||||
struct Task {
|
||||
|
@ -326,10 +326,6 @@ int test_capi_connectivity_main() {
|
||||
deletePeer(peer2);
|
||||
sleep(1);
|
||||
|
||||
// You may call rtcCleanup() when finished to free static resources
|
||||
rtcCleanup();
|
||||
sleep(1);
|
||||
|
||||
printf("Success\n");
|
||||
return 0;
|
||||
|
||||
|
@ -177,10 +177,6 @@ int test_capi_track_main() {
|
||||
deletePeer(peer2);
|
||||
sleep(1);
|
||||
|
||||
// You may call rtcCleanup() when finished to free static resources
|
||||
rtcCleanup();
|
||||
sleep(1);
|
||||
|
||||
printf("Success\n");
|
||||
return 0;
|
||||
|
||||
|
@ -251,9 +251,5 @@ void test_connectivity() {
|
||||
pc2->close();
|
||||
this_thread::sleep_for(1s);
|
||||
|
||||
// You may call rtc::Cleanup() when finished to free static resources
|
||||
rtc::Cleanup();
|
||||
this_thread::sleep_for(1s);
|
||||
|
||||
cout << "Success" << endl;
|
||||
}
|
||||
|
@ -143,9 +143,5 @@ void test_track() {
|
||||
pc2->close();
|
||||
this_thread::sleep_for(1s);
|
||||
|
||||
// You may call rtc::Cleanup() when finished to free static resources
|
||||
rtc::Cleanup();
|
||||
this_thread::sleep_for(1s);
|
||||
|
||||
cout << "Success" << endl;
|
||||
}
|
||||
|
@ -258,9 +258,5 @@ void test_turn_connectivity() {
|
||||
pc2->close();
|
||||
this_thread::sleep_for(1s);
|
||||
|
||||
// You may call rtc::Cleanup() when finished to free static resources
|
||||
rtc::Cleanup();
|
||||
this_thread::sleep_for(1s);
|
||||
|
||||
cout << "Success" << endl;
|
||||
}
|
||||
|
@ -78,10 +78,6 @@ void test_websocket() {
|
||||
ws->close();
|
||||
this_thread::sleep_for(1s);
|
||||
|
||||
// You may call rtc::Cleanup() when finished to free static resources
|
||||
rtc::Cleanup();
|
||||
this_thread::sleep_for(1s);
|
||||
|
||||
cout << "Success" << endl;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user