Skip to content

Commit

Permalink
Transport.cpp: enable tccClient on the first video Consumer:
Browse files Browse the repository at this point in the history
- no need for it to be simulcast or SVC.
  • Loading branch information
ibc committed Mar 12, 2020
1 parent 1888e89 commit 22f0961
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions worker/src/RTC/Transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -817,16 +817,13 @@ namespace RTC
RTC::BweType bweType;

// Use transport-cc if:
// - it's a simulcast or SVC Consumer, and
// - it's a video Consumer, and
// - there is transport-wide-cc-01 RTP header extension, and
// - there is "transport-cc" in codecs RTCP feedback.
//
// clang-format off
if (
(
consumer->GetType() == RTC::RtpParameters::Type::SIMULCAST ||
consumer->GetType() == RTC::RtpParameters::Type::SVC
) &&
consumer->GetKind() == RTC::Media::Kind::VIDEO &&
rtpHeaderExtensionIds.transportWideCc01 != 0u &&
std::any_of(
codecs.begin(), codecs.end(), [](const RTC::RtpCodecParameters& codec)
Expand All @@ -846,16 +843,13 @@ namespace RTC
bweType = RTC::BweType::TRANSPORT_CC;
}
// Use REMB if:
// - it's a simulcast or SVC Consumer, and
// - it's a video Consumer, and
// - there is abs-send-time RTP header extension, and
// - there is "remb" in codecs RTCP feedback.
//
// clang-format off
else if (
(
consumer->GetType() == RTC::RtpParameters::Type::SIMULCAST ||
consumer->GetType() == RTC::RtpParameters::Type::SVC
) &&
consumer->GetKind() == RTC::Media::Kind::VIDEO &&
rtpHeaderExtensionIds.absSendTime != 0u &&
std::any_of(
codecs.begin(), codecs.end(), [](const RTC::RtpCodecParameters& codec)
Expand Down Expand Up @@ -901,17 +895,14 @@ namespace RTC
#ifdef ENABLE_RTC_SENDER_BANDWIDTH_ESTIMATOR
// Create SenderBandwidthEstimator if:
// - not already created,
// - it's a simulcast or SVC Consumer, and
// - it's a video Consumer, and
// - there is transport-wide-cc-01 RTP header extension, and
// - there is "transport-cc" in codecs RTCP feedback.
//
// clang-format off
if (
!this->senderBwe &&
(
consumer->GetType() == RTC::RtpParameters::Type::SIMULCAST ||
consumer->GetType() == RTC::RtpParameters::Type::SVC
) &&
consumer->GetKind() == RTC::Media::Kind::VIDEO &&
rtpHeaderExtensionIds.transportWideCc01 != 0u &&
std::any_of(
codecs.begin(), codecs.end(), [](const RTC::RtpCodecParameters& codec)
Expand Down

5 comments on commit 22f0961

@stidio
Copy link

@stidio stidio commented on 22f0961 Apr 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under Windows 10 / VS2017 this commit will cause a crash

@stidio
Copy link

@stidio stidio commented on 22f0961 Apr 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

video codec is h264

@ibc
Copy link
Member Author

@ibc ibc commented on 22f0961 Apr 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is a crash just report it:

And also take into account that there is an ongoing crash/bug still to be fixed:

BTW you say "Under Windows 10" just because that's what you use, right?

@stidio
Copy link

@stidio stidio commented on 22f0961 Apr 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, it's my mistake, i test compile option /std:c++17 for mediasoup,and forget to add it for libwebrtc; then a lot of Run-Time check failure and heap corruption are detected.
Another is yes, win10 is only my development environment;
However, there are two compilation errors in v3.5.8 under windows:

  1. [DepLibUV.hpp] compile error: C2397 https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2397
  2. [PortManager.cpp] windows don't support RECVMSG,and init_udp_init_ex always return error
    this is a patch:

diff --git a/worker/include/DepLibUV.hpp b/worker/include/DepLibUV.hpp
--- a/worker/include/DepLibUV.hpp
+++ b/worker/include/DepLibUV.hpp
@@ -32,7 +32,7 @@ public:
// time representation.
static int64_t GetTimeMsInt64()
{
- static constexpr uint64_t MaxInt64{ std::numeric_limits<int64_t>::max() };
+ static constexpr uint64_t MaxInt64{ std::numeric_limits<uint64_t>::max() / 2 };

	uint64_t time = DepLibUV::GetTimeMs();

@@ -47,7 +47,7 @@ public:
// time representation.
static int64_t GetTimeUsInt64()
{
- static constexpr uint64_t MaxInt64{ std::numeric_limits<int64_t>::max() };
+ static constexpr uint64_t MaxInt64{ std::numeric_limits<uint64_t>::max() / 2 };

	uint64_t time = DepLibUV::GetTimeUs();

diff --git a/worker/src/RTC/PortManager.cpp b/worker/src/RTC/PortManager.cpp
--- a/worker/src/RTC/PortManager.cpp
+++ b/worker/src/RTC/PortManager.cpp
@@ -163,7 +163,11 @@ namespace RTC
case Transport::UDP:
uvHandle = reinterpret_cast<uv_handle_t*>(new uv_udp_t());
err = uv_udp_init_ex(
- DepLibUV::GetLoop(), reinterpret_cast<uv_udp_t*>(uvHandle), UV_UDP_RECVMMSG);
+ DepLibUV::GetLoop(), reinterpret_cast<uv_udp_t*>(uvHandle), AF_UNSPEC
+#ifndef _WIN32
+ | UV_UDP_RECVMMSG
+#endif
+ );
break;

			case Transport::TCP:

@ibc
Copy link
Member Author

@ibc ibc commented on 22f0961 Apr 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, don't report issues in commits. Use GitHub issues if they are really an issue or the mediasoup forum. I will answer here but please do not keep commenting after me. If you still consider there is a bug, open an issue.

However, there are two compilation errors in v3.5.8 under windows:

  1. [DepLibUV.hpp] compile error: C2397 https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2397

I don't know which error you mean. That link shows nothing relevant.

  1. [PortManager.cpp] windows don't support RECVMSG,and init_udp_init_ex always return error

this is a bug in libuv: libuv/libuv#2806

diff --git a/worker/include/DepLibUV.hpp b/worker/include/DepLibUV.hpp
--- a/worker/include/DepLibUV.hpp
+++ b/worker/include/DepLibUV.hpp
@@ -32,7 +32,7 @@ public:
// time representation.
static int64_t GetTimeMsInt64()
{

  • static constexpr uint64_t MaxInt64{ std::numeric_limits<int64_t>::max() };
  • static constexpr uint64_t MaxInt64{ std::numeric_limits<uint64_t>::max() / 2 };

Why? why this? this is not what we want.

Please sign in to comment.