| 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 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 rtp_params.codecs.push_back(codec.ToCodecParameters()); |
| 896 } |
| 897 return rtp_params; |
| 891 } | 898 } |
| 892 | 899 |
| 893 bool WebRtcVideoChannel2::SetRtpParameters( | 900 bool WebRtcVideoChannel2::SetRtpParameters( |
| 894 uint32_t ssrc, | 901 uint32_t ssrc, |
| 895 const webrtc::RtpParameters& parameters) { | 902 const webrtc::RtpParameters& parameters) { |
| 896 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetRtpParameters"); | 903 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetRtpParameters"); |
| 897 rtc::CritScope stream_lock(&stream_crit_); | 904 rtc::CritScope stream_lock(&stream_crit_); |
| 898 auto it = send_streams_.find(ssrc); | 905 auto it = send_streams_.find(ssrc); |
| 899 if (it == send_streams_.end()) { | 906 if (it == send_streams_.end()) { |
| 900 LOG(LS_ERROR) << "Attempting to set RTP parameters for stream with ssrc " | 907 LOG(LS_ERROR) << "Attempting to set RTP parameters for stream with ssrc " |
| 901 << ssrc << " which doesn't exist."; | 908 << ssrc << " which doesn't exist."; |
| 902 return false; | 909 return false; |
| 903 } | 910 } |
| 904 | 911 |
| 912 // TODO(deadbeef): Handle setting parameters with a list of codecs in a |
| 913 // different order (which should change the send codec). |
| 905 return it->second->SetRtpParameters(parameters); | 914 return it->second->SetRtpParameters(parameters); |
| 906 } | 915 } |
| 907 | 916 |
| 908 bool WebRtcVideoChannel2::GetChangedRecvParameters( | 917 bool WebRtcVideoChannel2::GetChangedRecvParameters( |
| 909 const VideoRecvParameters& params, | 918 const VideoRecvParameters& params, |
| 910 ChangedRecvParameters* changed_params) const { | 919 ChangedRecvParameters* changed_params) const { |
| 911 if (!ValidateCodecFormats(params.codecs) || | 920 if (!ValidateCodecFormats(params.codecs) || |
| 912 !ValidateRtpExtensions(params.extensions)) { | 921 !ValidateRtpExtensions(params.extensions)) { |
| 913 return false; | 922 return false; |
| 914 } | 923 } |
| (...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1833 if (!ValidateRtpParameters(new_parameters)) { | 1842 if (!ValidateRtpParameters(new_parameters)) { |
| 1834 return false; | 1843 return false; |
| 1835 } | 1844 } |
| 1836 | 1845 |
| 1837 rtc::CritScope cs(&lock_); | 1846 rtc::CritScope cs(&lock_); |
| 1838 if (new_parameters.encodings[0].max_bitrate_bps != | 1847 if (new_parameters.encodings[0].max_bitrate_bps != |
| 1839 rtp_parameters_.encodings[0].max_bitrate_bps) { | 1848 rtp_parameters_.encodings[0].max_bitrate_bps) { |
| 1840 pending_encoder_reconfiguration_ = true; | 1849 pending_encoder_reconfiguration_ = true; |
| 1841 } | 1850 } |
| 1842 rtp_parameters_ = new_parameters; | 1851 rtp_parameters_ = new_parameters; |
| 1852 // Codecs are currently handled at the WebRtcVideoChannel2 level. |
| 1853 rtp_parameters_.codecs.clear(); |
| 1843 // Encoding may have been activated/deactivated. | 1854 // Encoding may have been activated/deactivated. |
| 1844 UpdateSendState(); | 1855 UpdateSendState(); |
| 1845 return true; | 1856 return true; |
| 1846 } | 1857 } |
| 1847 | 1858 |
| 1848 webrtc::RtpParameters | 1859 webrtc::RtpParameters |
| 1849 WebRtcVideoChannel2::WebRtcVideoSendStream::GetRtpParameters() const { | 1860 WebRtcVideoChannel2::WebRtcVideoSendStream::GetRtpParameters() const { |
| 1850 rtc::CritScope cs(&lock_); | 1861 rtc::CritScope cs(&lock_); |
| 1851 return rtp_parameters_; | 1862 return rtp_parameters_; |
| 1852 } | 1863 } |
| (...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2577 rtx_mapping[video_codecs[i].codec.id] != | 2588 rtx_mapping[video_codecs[i].codec.id] != |
| 2578 fec_settings.red_payload_type) { | 2589 fec_settings.red_payload_type) { |
| 2579 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2590 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
| 2580 } | 2591 } |
| 2581 } | 2592 } |
| 2582 | 2593 |
| 2583 return video_codecs; | 2594 return video_codecs; |
| 2584 } | 2595 } |
| 2585 | 2596 |
| 2586 } // namespace cricket | 2597 } // namespace cricket |
| OLD | NEW |