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

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

Issue 1917193008: Adding getParameters/setParameters APIs to RtpReceiver. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: objc compile errors 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) 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 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 HasTransportCc(send_codec_->codec), 868 HasTransportCc(send_codec_->codec),
869 params.rtcp.reduced_size ? webrtc::RtcpMode::kReducedSize 869 params.rtcp.reduced_size ? webrtc::RtcpMode::kReducedSize
870 : webrtc::RtcpMode::kCompound); 870 : webrtc::RtcpMode::kCompound);
871 } 871 }
872 } 872 }
873 } 873 }
874 send_params_ = params; 874 send_params_ = params;
875 return true; 875 return true;
876 } 876 }
877 877
878 webrtc::RtpParameters WebRtcVideoChannel2::GetRtpParameters( 878 webrtc::RtpParameters WebRtcVideoChannel2::GetRtpSendParameters(
879 uint32_t ssrc) const { 879 uint32_t ssrc) const {
880 rtc::CritScope stream_lock(&stream_crit_); 880 rtc::CritScope stream_lock(&stream_crit_);
881 auto it = send_streams_.find(ssrc); 881 auto it = send_streams_.find(ssrc);
882 if (it == send_streams_.end()) { 882 if (it == send_streams_.end()) {
883 LOG(LS_WARNING) << "Attempting to get RTP parameters for stream with ssrc " 883 LOG(LS_WARNING) << "Attempting to get RTP send parameters for stream "
884 << ssrc << " which doesn't exist."; 884 << "with ssrc " << ssrc << " which doesn't exist.";
885 return webrtc::RtpParameters(); 885 return webrtc::RtpParameters();
886 } 886 }
887 887
888 webrtc::RtpParameters rtp_params = it->second->GetRtpParameters(); 888 webrtc::RtpParameters rtp_params = it->second->GetRtpParameters();
889 // Need to add the common list of codecs to the send stream-specific 889 // Need to add the common list of codecs to the send stream-specific
890 // RTP parameters. 890 // RTP parameters.
891 for (const VideoCodec& codec : send_params_.codecs) { 891 for (const VideoCodec& codec : send_params_.codecs) {
892 rtp_params.codecs.push_back(codec.ToCodecParameters()); 892 rtp_params.codecs.push_back(codec.ToCodecParameters());
893 } 893 }
894 return rtp_params; 894 return rtp_params;
895 } 895 }
896 896
897 bool WebRtcVideoChannel2::SetRtpParameters( 897 bool WebRtcVideoChannel2::SetRtpSendParameters(
898 uint32_t ssrc, 898 uint32_t ssrc,
899 const webrtc::RtpParameters& parameters) { 899 const webrtc::RtpParameters& parameters) {
900 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetRtpParameters"); 900 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetRtpSendParameters");
901 rtc::CritScope stream_lock(&stream_crit_); 901 rtc::CritScope stream_lock(&stream_crit_);
902 auto it = send_streams_.find(ssrc); 902 auto it = send_streams_.find(ssrc);
903 if (it == send_streams_.end()) { 903 if (it == send_streams_.end()) {
904 LOG(LS_ERROR) << "Attempting to set RTP parameters for stream with ssrc " 904 LOG(LS_ERROR) << "Attempting to set RTP send parameters for stream "
905 << ssrc << " which doesn't exist."; 905 << "with ssrc " << ssrc << " which doesn't exist.";
906 return false; 906 return false;
907 } 907 }
908 908
909 // TODO(deadbeef): Handle setting parameters with a list of codecs in a 909 // TODO(deadbeef): Handle setting parameters with a list of codecs in a
910 // different order (which should change the send codec). 910 // different order (which should change the send codec).
911 webrtc::RtpParameters current_parameters = GetRtpSendParameters(ssrc);
912 if (current_parameters.codecs != parameters.codecs) {
913 LOG(LS_ERROR) << "Using SetParameters to change the set of codecs "
914 << "is not currently supported.";
915 return false;
916 }
917
911 return it->second->SetRtpParameters(parameters); 918 return it->second->SetRtpParameters(parameters);
912 } 919 }
913 920
921 webrtc::RtpParameters WebRtcVideoChannel2::GetRtpReceiveParameters(
922 uint32_t ssrc) const {
923 rtc::CritScope stream_lock(&stream_crit_);
924 auto it = receive_streams_.find(ssrc);
925 if (it == receive_streams_.end()) {
926 LOG(LS_WARNING) << "Attempting to get RTP receive parameters for stream "
927 << "with ssrc " << ssrc << " which doesn't exist.";
928 return webrtc::RtpParameters();
929 }
930
931 // TODO(deadbeef): Return stream-specific parameters.
932 webrtc::RtpParameters rtp_params = CreateRtpParametersWithOneEncoding();
933 for (const VideoCodec& codec : recv_params_.codecs) {
934 rtp_params.codecs.push_back(codec.ToCodecParameters());
935 }
936 return rtp_params;
937 }
938
939 bool WebRtcVideoChannel2::SetRtpReceiveParameters(
940 uint32_t ssrc,
941 const webrtc::RtpParameters& parameters) {
942 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetRtpReceiveParameters");
943 rtc::CritScope stream_lock(&stream_crit_);
944 auto it = receive_streams_.find(ssrc);
945 if (it == receive_streams_.end()) {
946 LOG(LS_ERROR) << "Attempting to set RTP receive parameters for stream "
947 << "with ssrc " << ssrc << " which doesn't exist.";
948 return false;
949 }
950
951 webrtc::RtpParameters current_parameters = GetRtpReceiveParameters(ssrc);
952 if (current_parameters != parameters) {
953 LOG(LS_ERROR) << "Changing the RTP receive parameters is currently "
954 << "unsupported.";
955 return false;
956 }
957 return true;
958 }
959
914 bool WebRtcVideoChannel2::GetChangedRecvParameters( 960 bool WebRtcVideoChannel2::GetChangedRecvParameters(
915 const VideoRecvParameters& params, 961 const VideoRecvParameters& params,
916 ChangedRecvParameters* changed_params) const { 962 ChangedRecvParameters* changed_params) const {
917 if (!ValidateCodecFormats(params.codecs) || 963 if (!ValidateCodecFormats(params.codecs) ||
918 !ValidateRtpExtensions(params.extensions)) { 964 !ValidateRtpExtensions(params.extensions)) {
919 return false; 965 return false;
920 } 966 }
921 967
922 // Handle receive codecs. 968 // Handle receive codecs.
923 const std::vector<VideoCodecSettings> mapped_codecs = 969 const std::vector<VideoCodecSettings> mapped_codecs =
(...skipping 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after
2587 rtx_mapping[video_codecs[i].codec.id] != 2633 rtx_mapping[video_codecs[i].codec.id] !=
2588 fec_settings.red_payload_type) { 2634 fec_settings.red_payload_type) {
2589 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2635 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2590 } 2636 }
2591 } 2637 }
2592 2638
2593 return video_codecs; 2639 return video_codecs;
2594 } 2640 }
2595 2641
2596 } // namespace cricket 2642 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.h ('k') | webrtc/media/engine/webrtcvideoengine2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698