Revert "Enabling Simulcast use via AddTransceiver."
This reverts commit ce470aab518f067a67aa03aaab1fc61a45afa0ec.
Failing below Layout test.
https://cs.chromium.org/chromium/src/third_party/blink/web_tests/external/wpt/webrtc/RTCRtpReceiver-getParameters-expected.txt?type=cs&sq=package:chromium&g=0
Original change's description:
> Enabling Simulcast use via AddTransceiver.
>
> This change removes the restriction on multiple send encodings when
> calling AddTransceiver. If RIDs are not provided in the
> simulcast scenario, they are auto-generated by the platform.
>
> This effectively enables the use of spec-compliant simulcast.
> Tests are also added to verify simulcast functionality.
>
> Bug: webrtc:10075
> Change-Id: I088feba70a26e85abcc7bfbe3ea1fe5103cd47d2
> Reviewed-on: https://webrtc-review.googlesource.com/c/121389
> Reviewed-by: Florent Castelli <orphis@webrtc.org>
> Reviewed-by: Steve Anton <steveanton@webrtc.org>
> Commit-Queue: Amit Hilbuch <amithi@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#26590}
TBR=steveanton@webrtc.org,orphis@webrtc.org,amithi@webrtc.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: webrtc:10075
Change-Id: Idef5ca735eaef190f83eec8630cd54e23737d813
Reviewed-on: https://webrtc-review.googlesource.com/c/122040
Reviewed-by: Emircan Uysaler <emircan@webrtc.org>
Commit-Queue: Emircan Uysaler <emircan@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26618}
diff --git a/pc/peer_connection.cc b/pc/peer_connection.cc
index f28e7c0..759bf47 100644
--- a/pc/peer_connection.cc
+++ b/pc/peer_connection.cc
@@ -1461,50 +1461,23 @@
: cricket::MEDIA_TYPE_VIDEO));
}
- size_t num_rids = absl::c_count_if(init.send_encodings,
- [](const RtpEncodingParameters& encoding) {
- return !encoding.rid.empty();
- });
- if (num_rids > 0 && num_rids != init.send_encodings.size()) {
- LOG_AND_RETURN_ERROR(
- RTCErrorType::INVALID_PARAMETER,
- "RIDs must be provided for either all or none of the send encodings.");
- }
-
- if (absl::c_any_of(init.send_encodings,
- [](const RtpEncodingParameters& encoding) {
- return encoding.ssrc.has_value();
- })) {
+ // TODO(bugs.webrtc.org/7600): Verify init.
+ if (init.send_encodings.size() > 1) {
LOG_AND_RETURN_ERROR(
RTCErrorType::UNSUPPORTED_PARAMETER,
- "Attempted to set an unimplemented parameter of RtpParameters.");
+ "Attempted to create an encoder with more than 1 encoding parameter.");
+ }
+
+ for (const auto& encoding : init.send_encodings) {
+ if (encoding.ssrc.has_value()) {
+ LOG_AND_RETURN_ERROR(
+ RTCErrorType::UNSUPPORTED_PARAMETER,
+ "Attempted to set an unimplemented parameter of RtpParameters.");
+ }
}
RtpParameters parameters;
parameters.encodings = init.send_encodings;
-
- // Encodings are dropped from the tail if too many are provided.
- if (parameters.encodings.size() > kMaxSimulcastStreams) {
- parameters.encodings.erase(
- parameters.encodings.begin() + kMaxSimulcastStreams,
- parameters.encodings.end());
- }
-
- // Single RID should be removed.
- if (parameters.encodings.size() == 1 &&
- !parameters.encodings[0].rid.empty()) {
- RTC_LOG(LS_INFO) << "Removing RID: " << parameters.encodings[0].rid << ".";
- parameters.encodings[0].rid.clear();
- }
-
- // If RIDs were not provided, they are generated for simulcast scenario.
- if (parameters.encodings.size() > 1 && num_rids == 0) {
- rtc::UniqueStringGenerator rid_generator;
- for (RtpEncodingParameters& encoding : parameters.encodings) {
- encoding.rid = rid_generator();
- }
- }
-
if (UnimplementedRtpParameterHasValue(parameters)) {
LOG_AND_RETURN_ERROR(
RTCErrorType::UNSUPPORTED_PARAMETER,
@@ -1524,7 +1497,7 @@
(track && !FindSenderById(track->id()) ? track->id()
: rtc::CreateRandomUuid());
auto sender = CreateSender(media_type, sender_id, track, init.stream_ids,
- parameters.encodings);
+ init.send_encodings);
auto receiver = CreateReceiver(media_type, rtc::CreateRandomUuid());
auto transceiver = CreateAndAddTransceiver(sender, receiver);
transceiver->internal()->set_direction(init.direction);
@@ -3067,11 +3040,8 @@
RTC_DCHECK_EQ(source, cricket::CS_REMOTE);
// If the m= section is sendrecv or recvonly, and there are RtpTransceivers
// of the same type...
- // When simulcast is requested, a transceiver cannot be associated because
- // AddTrack cannot be called to initialize it.
if (!transceiver &&
- RtpTransceiverDirectionHasRecv(media_desc->direction()) &&
- !media_desc->HasSimulcast()) {
+ RtpTransceiverDirectionHasRecv(media_desc->direction())) {
transceiver = FindAvailableTransceiverToReceive(media_desc->type());
}
// If no RtpTransceiver was found in the previous step, create one with a