Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_payload_registry.cc

Issue 1964473002: Potential fix for rtx/red issue where red is removed only from the remote description. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 payload_name, payload_name_length, frequency, channels, rate); 100 payload_name, payload_name_length, frequency, channels, rate);
101 } 101 }
102 102
103 RtpUtility::Payload* payload = rtp_payload_strategy_->CreatePayloadType( 103 RtpUtility::Payload* payload = rtp_payload_strategy_->CreatePayloadType(
104 payload_name, payload_type, frequency, channels, rate); 104 payload_name, payload_type, frequency, channels, rate);
105 105
106 payload_type_map_[payload_type] = payload; 106 payload_type_map_[payload_type] = payload;
107 *created_new_payload = true; 107 *created_new_payload = true;
108 108
109 if (RtpUtility::StringCompare(payload_name, "red", 3)) { 109 if (RtpUtility::StringCompare(payload_name, "red", 3)) {
110 LOG(LS_ERROR) << "Red enabled: " << static_cast<int>(payload_type);
110 red_payload_type_ = payload_type; 111 red_payload_type_ = payload_type;
111 } else if (RtpUtility::StringCompare(payload_name, "ulpfec", 6)) { 112 } else if (RtpUtility::StringCompare(payload_name, "ulpfec", 6)) {
112 ulpfec_payload_type_ = payload_type; 113 ulpfec_payload_type_ = payload_type;
113 } 114 }
114 115
115 // Successful set of payload type, clear the value of last received payload 116 // Successful set of payload type, clear the value of last received payload
116 // type since it might mean something else. 117 // type since it might mean something else.
117 last_received_payload_type_ = -1; 118 last_received_payload_type_ = -1;
118 last_received_media_payload_type_ = -1; 119 last_received_media_payload_type_ = -1;
119 return 0; 120 return 0;
120 } 121 }
121 122
122 int32_t RTPPayloadRegistry::DeRegisterReceivePayload( 123 int32_t RTPPayloadRegistry::DeRegisterReceivePayload(
123 const int8_t payload_type) { 124 const int8_t payload_type) {
124 rtc::CritScope cs(&crit_sect_); 125 rtc::CritScope cs(&crit_sect_);
125 RtpUtility::PayloadTypeMap::iterator it = 126 RtpUtility::PayloadTypeMap::iterator it =
126 payload_type_map_.find(payload_type); 127 payload_type_map_.find(payload_type);
128 if (red_payload_type_ == payload_type) {
129 LOG(LS_ERROR) << "Red disabled";
130 red_payload_type_ = -1;
131 }
127 assert(it != payload_type_map_.end()); 132 assert(it != payload_type_map_.end());
128 delete it->second; 133 delete it->second;
129 payload_type_map_.erase(it); 134 payload_type_map_.erase(it);
130 return 0; 135 return 0;
131 } 136 }
132 137
133 // There can't be several codecs with the same rate, frequency and channels 138 // There can't be several codecs with the same rate, frequency and channels
134 // for audio codecs, but there can for video. 139 // for audio codecs, but there can for video.
135 // Always called from within a critical section. 140 // Always called from within a critical section.
136 void RTPPayloadRegistry::DeregisterAudioCodecOrRedTypeRegardlessOfPayloadType( 141 void RTPPayloadRegistry::DeregisterAudioCodecOrRedTypeRegardlessOfPayloadType(
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 if (apt_mapping == rtx_payload_type_map_.end()) 268 if (apt_mapping == rtx_payload_type_map_.end())
264 return false; 269 return false;
265 associated_payload_type = apt_mapping->second; 270 associated_payload_type = apt_mapping->second;
266 if (red_payload_type_ != -1) { 271 if (red_payload_type_ != -1) {
267 // Assume red will be used if it's configured. 272 // Assume red will be used if it's configured.
268 // This is a workaround for a Chrome sdp bug where rtx is associated 273 // This is a workaround for a Chrome sdp bug where rtx is associated
269 // with the media codec even though media is sent over red. 274 // with the media codec even though media is sent over red.
270 // TODO(holmer): Remove once the Chrome versions exposing this bug are 275 // TODO(holmer): Remove once the Chrome versions exposing this bug are
271 // old enough, which should be once Chrome Stable reaches M53 as this 276 // old enough, which should be once Chrome Stable reaches M53 as this
272 // work-around went into M50. 277 // work-around went into M50.
278 LOG(LS_ERROR) << "Assuming red payload: "
279 << static_cast<int>(red_payload_type_);
273 associated_payload_type = red_payload_type_; 280 associated_payload_type = red_payload_type_;
274 } 281 }
275 restored_packet[1] = static_cast<uint8_t>(associated_payload_type); 282 restored_packet[1] = static_cast<uint8_t>(associated_payload_type);
276 if (header.markerBit) { 283 if (header.markerBit) {
277 restored_packet[1] |= kRtpMarkerBitMask; // Marker bit is set. 284 restored_packet[1] |= kRtpMarkerBitMask; // Marker bit is set.
278 } 285 }
279 return true; 286 return true;
280 } 287 }
281 288
282 void RTPPayloadRegistry::SetRtxSsrc(uint32_t ssrc) { 289 void RTPPayloadRegistry::SetRtxSsrc(uint32_t ssrc) {
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 RTPPayloadStrategy* RTPPayloadStrategy::CreateStrategy( 473 RTPPayloadStrategy* RTPPayloadStrategy::CreateStrategy(
467 const bool handling_audio) { 474 const bool handling_audio) {
468 if (handling_audio) { 475 if (handling_audio) {
469 return new RTPPayloadAudioStrategy(); 476 return new RTPPayloadAudioStrategy();
470 } else { 477 } else {
471 return new RTPPayloadVideoStrategy(); 478 return new RTPPayloadVideoStrategy();
472 } 479 }
473 } 480 }
474 481
475 } // namespace webrtc 482 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698