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