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

Side by Side Diff: webrtc/media/engine/webrtcvideoengine2.cc

Issue 2589833002: Clean up storage of FlexFEC payload type in webrtc::VideoCodecSettings. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after
1409 1409
1410 // See if this payload_type is registered as one that usually gets its own 1410 // See if this payload_type is registered as one that usually gets its own
1411 // SSRC (RTX) or at least is safe to drop either way (FEC). If it is, and 1411 // SSRC (RTX) or at least is safe to drop either way (FEC). If it is, and
1412 // it wasn't handled above by DeliverPacket, that means we don't know what 1412 // it wasn't handled above by DeliverPacket, that means we don't know what
1413 // stream it associates with, and we shouldn't ever create an implicit channel 1413 // stream it associates with, and we shouldn't ever create an implicit channel
1414 // for these. 1414 // for these.
1415 for (auto& codec : recv_codecs_) { 1415 for (auto& codec : recv_codecs_) {
1416 if (payload_type == codec.rtx_payload_type || 1416 if (payload_type == codec.rtx_payload_type ||
1417 payload_type == codec.ulpfec.red_rtx_payload_type || 1417 payload_type == codec.ulpfec.red_rtx_payload_type ||
1418 payload_type == codec.ulpfec.ulpfec_payload_type || 1418 payload_type == codec.ulpfec.ulpfec_payload_type ||
1419 payload_type == codec.flexfec.flexfec_payload_type) { 1419 payload_type == codec.flexfec_payload_type) {
1420 return; 1420 return;
1421 } 1421 }
1422 } 1422 }
1423 1423
1424 switch (unsignalled_ssrc_handler_->OnUnsignalledSsrc(this, ssrc)) { 1424 switch (unsignalled_ssrc_handler_->OnUnsignalledSsrc(this, ssrc)) {
1425 case UnsignalledSsrcHandler::kDropPacket: 1425 case UnsignalledSsrcHandler::kDropPacket:
1426 return; 1426 return;
1427 case UnsignalledSsrcHandler::kDeliverPacket: 1427 case UnsignalledSsrcHandler::kDeliverPacket:
1428 break; 1428 break;
1429 } 1429 }
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
1764 parameters_.config.encoder_settings.payload_type = codec_settings.codec.id; 1764 parameters_.config.encoder_settings.payload_type = codec_settings.codec.id;
1765 if (new_encoder.external) { 1765 if (new_encoder.external) {
1766 webrtc::VideoCodecType type = 1766 webrtc::VideoCodecType type =
1767 webrtc::PayloadNameToCodecType(codec_settings.codec.name) 1767 webrtc::PayloadNameToCodecType(codec_settings.codec.name)
1768 .value_or(webrtc::kVideoCodecUnknown); 1768 .value_or(webrtc::kVideoCodecUnknown);
1769 parameters_.config.encoder_settings.internal_source = 1769 parameters_.config.encoder_settings.internal_source =
1770 external_encoder_factory_->EncoderTypeHasInternalSource(type); 1770 external_encoder_factory_->EncoderTypeHasInternalSource(type);
1771 } 1771 }
1772 parameters_.config.rtp.ulpfec = codec_settings.ulpfec; 1772 parameters_.config.rtp.ulpfec = codec_settings.ulpfec;
1773 parameters_.config.rtp.flexfec.flexfec_payload_type = 1773 parameters_.config.rtp.flexfec.flexfec_payload_type =
1774 codec_settings.flexfec.flexfec_payload_type; 1774 codec_settings.flexfec_payload_type;
1775 1775
1776 // Set RTX payload type if RTX is enabled. 1776 // Set RTX payload type if RTX is enabled.
1777 if (!parameters_.config.rtp.rtx.ssrcs.empty()) { 1777 if (!parameters_.config.rtp.rtx.ssrcs.empty()) {
1778 if (codec_settings.rtx_payload_type == -1) { 1778 if (codec_settings.rtx_payload_type == -1) {
1779 LOG(LS_WARNING) << "RTX SSRCs configured but there's no configured RTX " 1779 LOG(LS_WARNING) << "RTX SSRCs configured but there's no configured RTX "
1780 "payload type. Ignoring."; 1780 "payload type. Ignoring.";
1781 parameters_.config.rtp.rtx.ssrcs.clear(); 1781 parameters_.config.rtp.rtx.ssrcs.clear();
1782 } else { 1782 } else {
1783 parameters_.config.rtp.rtx.payload_type = codec_settings.rtx_payload_type; 1783 parameters_.config.rtp.rtx.payload_type = codec_settings.rtx_payload_type;
1784 } 1784 }
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
2251 decoder.decoder = allocated_decoder.decoder; 2251 decoder.decoder = allocated_decoder.decoder;
2252 decoder.payload_type = recv_codecs[i].codec.id; 2252 decoder.payload_type = recv_codecs[i].codec.id;
2253 decoder.payload_name = recv_codecs[i].codec.name; 2253 decoder.payload_name = recv_codecs[i].codec.name;
2254 decoder.codec_params = recv_codecs[i].codec.params; 2254 decoder.codec_params = recv_codecs[i].codec.params;
2255 config_.decoders.push_back(decoder); 2255 config_.decoders.push_back(decoder);
2256 } 2256 }
2257 2257
2258 // TODO(pbos): Reconfigure RTX based on incoming recv_codecs. 2258 // TODO(pbos): Reconfigure RTX based on incoming recv_codecs.
2259 config_.rtp.ulpfec = recv_codecs.front().ulpfec; 2259 config_.rtp.ulpfec = recv_codecs.front().ulpfec;
2260 flexfec_config_.flexfec_payload_type = 2260 flexfec_config_.flexfec_payload_type =
2261 recv_codecs.front().flexfec.flexfec_payload_type; 2261 recv_codecs.front().flexfec_payload_type;
2262
2262 config_.rtp.nack.rtp_history_ms = 2263 config_.rtp.nack.rtp_history_ms =
2263 HasNack(recv_codecs.begin()->codec) ? kNackHistoryMs : 0; 2264 HasNack(recv_codecs.begin()->codec) ? kNackHistoryMs : 0;
2264 } 2265 }
2265 2266
2266 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetLocalSsrc( 2267 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetLocalSsrc(
2267 uint32_t local_ssrc) { 2268 uint32_t local_ssrc) {
2268 // TODO(pbos): Consider turning this sanity check into a RTC_DCHECK. You 2269 // TODO(pbos): Consider turning this sanity check into a RTC_DCHECK. You
2269 // should not be able to create a sender with the same SSRC as a receiver, but 2270 // should not be able to create a sender with the same SSRC as a receiver, but
2270 // right now this can't be done due to unittests depending on receiving what 2271 // right now this can't be done due to unittests depending on receiving what
2271 // they are sending from the same MediaChannel. 2272 // they are sending from the same MediaChannel.
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
2455 info.plis_sent = stats.rtcp_packet_type_counts.pli_packets; 2456 info.plis_sent = stats.rtcp_packet_type_counts.pli_packets;
2456 info.nacks_sent = stats.rtcp_packet_type_counts.nack_packets; 2457 info.nacks_sent = stats.rtcp_packet_type_counts.nack_packets;
2457 2458
2458 if (log_stats) 2459 if (log_stats)
2459 LOG(LS_INFO) << stats.ToString(rtc::TimeMillis()); 2460 LOG(LS_INFO) << stats.ToString(rtc::TimeMillis());
2460 2461
2461 return info; 2462 return info;
2462 } 2463 }
2463 2464
2464 WebRtcVideoChannel2::VideoCodecSettings::VideoCodecSettings() 2465 WebRtcVideoChannel2::VideoCodecSettings::VideoCodecSettings()
2465 : rtx_payload_type(-1) {} 2466 : flexfec_payload_type(-1), rtx_payload_type(-1) {}
2466 2467
2467 bool WebRtcVideoChannel2::VideoCodecSettings::operator==( 2468 bool WebRtcVideoChannel2::VideoCodecSettings::operator==(
2468 const WebRtcVideoChannel2::VideoCodecSettings& other) const { 2469 const WebRtcVideoChannel2::VideoCodecSettings& other) const {
2469 return codec == other.codec && ulpfec == other.ulpfec && 2470 return codec == other.codec && ulpfec == other.ulpfec &&
2470 flexfec == other.flexfec && rtx_payload_type == other.rtx_payload_type; 2471 flexfec_payload_type == other.flexfec_payload_type &&
2472 rtx_payload_type == other.rtx_payload_type;
2471 } 2473 }
2472 2474
2473 bool WebRtcVideoChannel2::VideoCodecSettings::operator!=( 2475 bool WebRtcVideoChannel2::VideoCodecSettings::operator!=(
2474 const WebRtcVideoChannel2::VideoCodecSettings& other) const { 2476 const WebRtcVideoChannel2::VideoCodecSettings& other) const {
2475 return !(*this == other); 2477 return !(*this == other);
2476 } 2478 }
2477 2479
2478 std::vector<WebRtcVideoChannel2::VideoCodecSettings> 2480 std::vector<WebRtcVideoChannel2::VideoCodecSettings>
2479 WebRtcVideoChannel2::MapCodecs(const std::vector<VideoCodec>& codecs) { 2481 WebRtcVideoChannel2::MapCodecs(const std::vector<VideoCodec>& codecs) {
2480 RTC_DCHECK(!codecs.empty()); 2482 RTC_DCHECK(!codecs.empty());
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
2561 return std::vector<VideoCodecSettings>(); 2563 return std::vector<VideoCodecSettings>();
2562 } 2564 }
2563 2565
2564 if (it->first == ulpfec_config.red_payload_type) { 2566 if (it->first == ulpfec_config.red_payload_type) {
2565 ulpfec_config.red_rtx_payload_type = it->second; 2567 ulpfec_config.red_rtx_payload_type = it->second;
2566 } 2568 }
2567 } 2569 }
2568 2570
2569 for (size_t i = 0; i < video_codecs.size(); ++i) { 2571 for (size_t i = 0; i < video_codecs.size(); ++i) {
2570 video_codecs[i].ulpfec = ulpfec_config; 2572 video_codecs[i].ulpfec = ulpfec_config;
2571 video_codecs[i].flexfec.flexfec_payload_type = flexfec_payload_type; 2573 video_codecs[i].flexfec_payload_type = flexfec_payload_type;
2572 if (rtx_mapping[video_codecs[i].codec.id] != 0 && 2574 if (rtx_mapping[video_codecs[i].codec.id] != 0 &&
2573 rtx_mapping[video_codecs[i].codec.id] != 2575 rtx_mapping[video_codecs[i].codec.id] !=
2574 ulpfec_config.red_payload_type) { 2576 ulpfec_config.red_payload_type) {
2575 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2577 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2576 } 2578 }
2577 } 2579 }
2578 2580
2579 return video_codecs; 2581 return video_codecs;
2580 } 2582 }
2581 2583
2582 } // namespace cricket 2584 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698