OLD | NEW |
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 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 LOG(LS_ERROR) << "Using SetParameters to change the set of codecs " | 858 LOG(LS_ERROR) << "Using SetParameters to change the set of codecs " |
859 << "is not currently supported."; | 859 << "is not currently supported."; |
860 return false; | 860 return false; |
861 } | 861 } |
862 | 862 |
863 return it->second->SetRtpParameters(parameters); | 863 return it->second->SetRtpParameters(parameters); |
864 } | 864 } |
865 | 865 |
866 webrtc::RtpParameters WebRtcVideoChannel2::GetRtpReceiveParameters( | 866 webrtc::RtpParameters WebRtcVideoChannel2::GetRtpReceiveParameters( |
867 uint32_t ssrc) const { | 867 uint32_t ssrc) const { |
| 868 webrtc::RtpParameters rtp_params; |
868 rtc::CritScope stream_lock(&stream_crit_); | 869 rtc::CritScope stream_lock(&stream_crit_); |
869 auto it = receive_streams_.find(ssrc); | 870 // SSRC of 0 represents an unsignaled receive stream. |
870 if (it == receive_streams_.end()) { | 871 if (ssrc == 0) { |
871 LOG(LS_WARNING) << "Attempting to get RTP receive parameters for stream " | 872 if (!default_unsignalled_ssrc_handler_.GetDefaultSink()) { |
872 << "with ssrc " << ssrc << " which doesn't exist."; | 873 LOG(LS_WARNING) << "Attempting to get RTP parameters for the default, " |
873 return webrtc::RtpParameters(); | 874 "unsignaled video receive stream, but not yet " |
| 875 "configured to receive such a stream."; |
| 876 return rtp_params; |
| 877 } |
| 878 rtp_params.encodings.emplace_back(); |
| 879 } else { |
| 880 auto it = receive_streams_.find(ssrc); |
| 881 if (it == receive_streams_.end()) { |
| 882 LOG(LS_WARNING) << "Attempting to get RTP receive parameters for stream " |
| 883 << "with SSRC " << ssrc << " which doesn't exist."; |
| 884 return webrtc::RtpParameters(); |
| 885 } |
| 886 // TODO(deadbeef): Return stream-specific parameters, beyond just SSRC. |
| 887 rtp_params.encodings.emplace_back(); |
| 888 rtp_params.encodings[0].ssrc = it->second->GetFirstPrimarySsrc(); |
874 } | 889 } |
875 | 890 |
876 // TODO(deadbeef): Return stream-specific parameters. | 891 // Add codecs, which any stream is prepared to receive. |
877 webrtc::RtpParameters rtp_params = CreateRtpParametersWithOneEncoding(); | |
878 for (const VideoCodec& codec : recv_params_.codecs) { | 892 for (const VideoCodec& codec : recv_params_.codecs) { |
879 rtp_params.codecs.push_back(codec.ToCodecParameters()); | 893 rtp_params.codecs.push_back(codec.ToCodecParameters()); |
880 } | 894 } |
881 rtp_params.encodings[0].ssrc = it->second->GetFirstPrimarySsrc(); | |
882 return rtp_params; | 895 return rtp_params; |
883 } | 896 } |
884 | 897 |
885 bool WebRtcVideoChannel2::SetRtpReceiveParameters( | 898 bool WebRtcVideoChannel2::SetRtpReceiveParameters( |
886 uint32_t ssrc, | 899 uint32_t ssrc, |
887 const webrtc::RtpParameters& parameters) { | 900 const webrtc::RtpParameters& parameters) { |
888 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetRtpReceiveParameters"); | 901 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetRtpReceiveParameters"); |
889 rtc::CritScope stream_lock(&stream_crit_); | 902 rtc::CritScope stream_lock(&stream_crit_); |
890 auto it = receive_streams_.find(ssrc); | 903 |
891 if (it == receive_streams_.end()) { | 904 // SSRC of 0 represents an unsignaled receive stream. |
892 LOG(LS_ERROR) << "Attempting to set RTP receive parameters for stream " | 905 if (ssrc == 0) { |
893 << "with ssrc " << ssrc << " which doesn't exist."; | 906 if (!default_unsignalled_ssrc_handler_.GetDefaultSink()) { |
894 return false; | 907 LOG(LS_WARNING) << "Attempting to set RTP parameters for the default, " |
| 908 "unsignaled video receive stream, but not yet " |
| 909 "configured to receive such a stream."; |
| 910 return false; |
| 911 } |
| 912 } else { |
| 913 auto it = receive_streams_.find(ssrc); |
| 914 if (it == receive_streams_.end()) { |
| 915 LOG(LS_WARNING) << "Attempting to set RTP receive parameters for stream " |
| 916 << "with SSRC " << ssrc << " which doesn't exist."; |
| 917 return false; |
| 918 } |
895 } | 919 } |
896 | 920 |
897 webrtc::RtpParameters current_parameters = GetRtpReceiveParameters(ssrc); | 921 webrtc::RtpParameters current_parameters = GetRtpReceiveParameters(ssrc); |
898 if (current_parameters != parameters) { | 922 if (current_parameters != parameters) { |
899 LOG(LS_ERROR) << "Changing the RTP receive parameters is currently " | 923 LOG(LS_ERROR) << "Changing the RTP receive parameters is currently " |
900 << "unsupported."; | 924 << "unsupported."; |
901 return false; | 925 return false; |
902 } | 926 } |
903 return true; | 927 return true; |
904 } | 928 } |
(...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2561 rtx_mapping[video_codecs[i].codec.id] != | 2585 rtx_mapping[video_codecs[i].codec.id] != |
2562 ulpfec_config.red_payload_type) { | 2586 ulpfec_config.red_payload_type) { |
2563 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2587 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
2564 } | 2588 } |
2565 } | 2589 } |
2566 | 2590 |
2567 return video_codecs; | 2591 return video_codecs; |
2568 } | 2592 } |
2569 | 2593 |
2570 } // namespace cricket | 2594 } // namespace cricket |
OLD | NEW |