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

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

Issue 1885473004: Adding codecs to the RtpParameters returned by an RtpSender. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Updating build files. Created 4 years, 8 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) 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 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 HasNack(send_codec_->codec), HasRemb(send_codec_->codec), 870 HasNack(send_codec_->codec), HasRemb(send_codec_->codec),
871 HasTransportCc(send_codec_->codec), 871 HasTransportCc(send_codec_->codec),
872 params.rtcp.reduced_size ? webrtc::RtcpMode::kReducedSize 872 params.rtcp.reduced_size ? webrtc::RtcpMode::kReducedSize
873 : webrtc::RtcpMode::kCompound); 873 : webrtc::RtcpMode::kCompound);
874 } 874 }
875 } 875 }
876 } 876 }
877 send_params_ = params; 877 send_params_ = params;
878 return true; 878 return true;
879 } 879 }
880
880 webrtc::RtpParameters WebRtcVideoChannel2::GetRtpParameters( 881 webrtc::RtpParameters WebRtcVideoChannel2::GetRtpParameters(
881 uint32_t ssrc) const { 882 uint32_t ssrc) const {
882 rtc::CritScope stream_lock(&stream_crit_); 883 rtc::CritScope stream_lock(&stream_crit_);
883 auto it = send_streams_.find(ssrc); 884 auto it = send_streams_.find(ssrc);
884 if (it == send_streams_.end()) { 885 if (it == send_streams_.end()) {
885 LOG(LS_WARNING) << "Attempting to get RTP parameters for stream with ssrc " 886 LOG(LS_WARNING) << "Attempting to get RTP parameters for stream with ssrc "
886 << ssrc << " which doesn't exist."; 887 << ssrc << " which doesn't exist.";
887 return webrtc::RtpParameters(); 888 return webrtc::RtpParameters();
888 } 889 }
889 890
890 return it->second->GetRtpParameters(); 891 webrtc::RtpParameters rtp_params = it->second->GetRtpParameters();
892 // Need to add the common list of codecs to the send stream-specific
893 // RTP parameters.
894 for (const VideoCodec& codec : send_params_.codecs) {
895 webrtc::RtpCodecParameters codec_params;
896 codec_params.payload_type = codec.id;
897 codec_params.mime_type = codec.name;
898 codec_params.clock_rate = codec.clockrate;
899 rtp_params.codecs.push_back(codec_params);
skvlad 2016/04/14 01:03:56 Could this be moved into a function common for bot
Taylor Brandstetter 2016/04/14 01:43:45 Yeah, I can move this to codec.h/codec.cc.
900 }
901 return rtp_params;
891 } 902 }
892 903
893 bool WebRtcVideoChannel2::SetRtpParameters( 904 bool WebRtcVideoChannel2::SetRtpParameters(
894 uint32_t ssrc, 905 uint32_t ssrc,
895 const webrtc::RtpParameters& parameters) { 906 const webrtc::RtpParameters& parameters) {
896 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetRtpParameters"); 907 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetRtpParameters");
897 rtc::CritScope stream_lock(&stream_crit_); 908 rtc::CritScope stream_lock(&stream_crit_);
898 auto it = send_streams_.find(ssrc); 909 auto it = send_streams_.find(ssrc);
899 if (it == send_streams_.end()) { 910 if (it == send_streams_.end()) {
900 LOG(LS_ERROR) << "Attempting to set RTP parameters for stream with ssrc " 911 LOG(LS_ERROR) << "Attempting to set RTP parameters for stream with ssrc "
901 << ssrc << " which doesn't exist."; 912 << ssrc << " which doesn't exist.";
902 return false; 913 return false;
903 } 914 }
904 915
916 // TODO(deadbeef): Handle setting parameters with a list of codecs in a
917 // different order (which should change the send codec).
905 return it->second->SetRtpParameters(parameters); 918 return it->second->SetRtpParameters(parameters);
906 } 919 }
907 920
908 bool WebRtcVideoChannel2::GetChangedRecvParameters( 921 bool WebRtcVideoChannel2::GetChangedRecvParameters(
909 const VideoRecvParameters& params, 922 const VideoRecvParameters& params,
910 ChangedRecvParameters* changed_params) const { 923 ChangedRecvParameters* changed_params) const {
911 if (!ValidateCodecFormats(params.codecs) || 924 if (!ValidateCodecFormats(params.codecs) ||
912 !ValidateRtpExtensions(params.extensions)) { 925 !ValidateRtpExtensions(params.extensions)) {
913 return false; 926 return false;
914 } 927 }
(...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after
2577 rtx_mapping[video_codecs[i].codec.id] != 2590 rtx_mapping[video_codecs[i].codec.id] !=
2578 fec_settings.red_payload_type) { 2591 fec_settings.red_payload_type) {
2579 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2592 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2580 } 2593 }
2581 } 2594 }
2582 2595
2583 return video_codecs; 2596 return video_codecs;
2584 } 2597 }
2585 2598
2586 } // namespace cricket 2599 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698