OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
179 auto it = std::unique(payload_types.begin(), payload_types.end()); | 179 auto it = std::unique(payload_types.begin(), payload_types.end()); |
180 return it == payload_types.end(); | 180 return it == payload_types.end(); |
181 } | 181 } |
182 | 182 |
183 // Return true if codec.params[feature] == "1", false otherwise. | 183 // Return true if codec.params[feature] == "1", false otherwise. |
184 bool IsCodecFeatureEnabled(const AudioCodec& codec, const char* feature) { | 184 bool IsCodecFeatureEnabled(const AudioCodec& codec, const char* feature) { |
185 int value; | 185 int value; |
186 return codec.GetParam(feature, &value) && value == 1; | 186 return codec.GetParam(feature, &value) && value == 1; |
187 } | 187 } |
188 | 188 |
189 rtc::Optional<std::string> GetAudioNetworkAdaptorConfig( | |
190 const AudioOptions& options) { | |
191 if (options.audio_network_adaptor && *options.audio_network_adaptor && | |
192 options.audio_network_adaptor_config) { | |
193 // Turn on audio network adaptor only when |options_.audio_network_adaptor| | |
194 // equals true and |options_.audio_network_adaptor_config| has a value. | |
195 return options.audio_network_adaptor_config; | |
196 } | |
197 return rtc::Optional<std::string>(); | |
198 } | |
199 | |
200 // Returns integer parameter params[feature] if it is defined. Returns | |
201 // |default_value| otherwise. | |
202 int GetCodecFeatureInt(const AudioCodec& codec, | |
203 const char* feature, | |
204 int default_value) { | |
205 int value = 0; | |
206 if (codec.GetParam(feature, &value)) { | |
207 return value; | |
208 } | |
209 return default_value; | |
210 } | |
211 | |
189 // Use params[kCodecParamMaxAverageBitrate] if it is defined, use codec.bitrate | 212 // Use params[kCodecParamMaxAverageBitrate] if it is defined, use codec.bitrate |
190 // otherwise. If the value (either from params or codec.bitrate) <=0, use the | 213 // otherwise. If the value (either from params or codec.bitrate) <=0, use the |
191 // default configuration. If the value is beyond feasible bit rate of Opus, | 214 // default configuration. If the value is beyond feasible bit rate of Opus, |
192 // clamp it. Returns the Opus bit rate for operation. | 215 // clamp it. Returns the Opus bit rate for operation. |
193 int GetOpusBitrate(const AudioCodec& codec, int max_playback_rate) { | 216 int GetOpusBitrate(const AudioCodec& codec, int max_playback_rate) { |
194 int bitrate = 0; | 217 int bitrate = 0; |
195 bool use_param = true; | 218 bool use_param = true; |
196 if (!codec.GetParam(kCodecParamMaxAverageBitrate, &bitrate)) { | 219 if (!codec.GetParam(kCodecParamMaxAverageBitrate, &bitrate)) { |
197 bitrate = codec.bitrate; | 220 bitrate = codec.bitrate; |
198 use_param = false; | 221 use_param = false; |
(...skipping 15 matching lines...) Expand all Loading... | |
214 std::string rate_source = | 237 std::string rate_source = |
215 use_param ? "Codec parameter \"maxaveragebitrate\"" : | 238 use_param ? "Codec parameter \"maxaveragebitrate\"" : |
216 "Supplied Opus bitrate"; | 239 "Supplied Opus bitrate"; |
217 LOG(LS_WARNING) << rate_source | 240 LOG(LS_WARNING) << rate_source |
218 << " is invalid and is replaced by: " | 241 << " is invalid and is replaced by: " |
219 << bitrate; | 242 << bitrate; |
220 } | 243 } |
221 return bitrate; | 244 return bitrate; |
222 } | 245 } |
223 | 246 |
224 // Returns kOpusDefaultPlaybackRate if params[kCodecParamMaxPlaybackRate] is not | 247 void GetOpusConfig(const AudioCodec& codec, |
225 // defined. Returns the value of params[kCodecParamMaxPlaybackRate] otherwise. | 248 webrtc::CodecInst* voe_codec, |
226 int GetOpusMaxPlaybackRate(const AudioCodec& codec) { | 249 bool* enable_codec_fec, |
227 int value; | 250 int* max_playback_rate, |
228 if (codec.GetParam(kCodecParamMaxPlaybackRate, &value)) { | 251 bool* enable_codec_dtx, |
229 return value; | 252 int* min_ptime_ms, |
230 } | 253 int* max_ptime_ms) { |
231 return kOpusDefaultMaxPlaybackRate; | |
232 } | |
233 | |
234 void GetOpusConfig(const AudioCodec& codec, webrtc::CodecInst* voe_codec, | |
235 bool* enable_codec_fec, int* max_playback_rate, | |
236 bool* enable_codec_dtx) { | |
237 *enable_codec_fec = IsCodecFeatureEnabled(codec, kCodecParamUseInbandFec); | 254 *enable_codec_fec = IsCodecFeatureEnabled(codec, kCodecParamUseInbandFec); |
238 *enable_codec_dtx = IsCodecFeatureEnabled(codec, kCodecParamUseDtx); | 255 *enable_codec_dtx = IsCodecFeatureEnabled(codec, kCodecParamUseDtx); |
239 *max_playback_rate = GetOpusMaxPlaybackRate(codec); | 256 *max_playback_rate = GetCodecFeatureInt(codec, kCodecParamMaxPlaybackRate, |
257 kOpusDefaultMaxPlaybackRate); | |
258 *max_ptime_ms = | |
259 GetCodecFeatureInt(codec, kCodecParamMaxPTime, kOpusDefaultMaxPTime); | |
260 *min_ptime_ms = | |
261 GetCodecFeatureInt(codec, kCodecParamMinPTime, kOpusDefaultMinPTime); | |
262 if (*max_ptime_ms < *min_ptime_ms) { | |
263 // If min ptime or max ptime defined by codec parameter is wrong, we use | |
264 // the default values. | |
the sun
2016/10/28 20:33:08
What if they are too small/too large? Is that hand
minyue-webrtc
2016/10/28 21:05:45
actually, this protect is not 100% strong. We also
| |
265 *max_ptime_ms = kOpusDefaultMaxPTime; | |
266 *min_ptime_ms = kOpusDefaultMinPTime; | |
267 } | |
240 | 268 |
241 // If OPUS, change what we send according to the "stereo" codec | 269 // If OPUS, change what we send according to the "stereo" codec |
242 // parameter, and not the "channels" parameter. We set | 270 // parameter, and not the "channels" parameter. We set |
243 // voe_codec.channels to 2 if "stereo=1" and 1 otherwise. If | 271 // voe_codec.channels to 2 if "stereo=1" and 1 otherwise. If |
244 // the bitrate is not specified, i.e. is <= zero, we set it to the | 272 // the bitrate is not specified, i.e. is <= zero, we set it to the |
245 // appropriate default value for mono or stereo Opus. | 273 // appropriate default value for mono or stereo Opus. |
246 | |
247 voe_codec->channels = IsCodecFeatureEnabled(codec, kCodecParamStereo) ? 2 : 1; | 274 voe_codec->channels = IsCodecFeatureEnabled(codec, kCodecParamStereo) ? 2 : 1; |
248 voe_codec->rate = GetOpusBitrate(codec, *max_playback_rate); | 275 voe_codec->rate = GetOpusBitrate(codec, *max_playback_rate); |
249 } | 276 } |
250 | 277 |
251 webrtc::AudioState::Config MakeAudioStateConfig(VoEWrapper* voe_wrapper) { | 278 webrtc::AudioState::Config MakeAudioStateConfig(VoEWrapper* voe_wrapper) { |
252 webrtc::AudioState::Config config; | 279 webrtc::AudioState::Config config; |
253 config.voice_engine = voe_wrapper->engine(); | 280 config.voice_engine = voe_wrapper->engine(); |
254 return config; | 281 return config; |
255 } | 282 } |
256 | 283 |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
890 LOG_RTCERR1(SetRecordingSampleRate, *options.recording_sample_rate); | 917 LOG_RTCERR1(SetRecordingSampleRate, *options.recording_sample_rate); |
891 } | 918 } |
892 } | 919 } |
893 | 920 |
894 if (options.playout_sample_rate) { | 921 if (options.playout_sample_rate) { |
895 LOG(LS_INFO) << "Playout sample rate is " << *options.playout_sample_rate; | 922 LOG(LS_INFO) << "Playout sample rate is " << *options.playout_sample_rate; |
896 if (adm()->SetPlayoutSampleRate(*options.playout_sample_rate)) { | 923 if (adm()->SetPlayoutSampleRate(*options.playout_sample_rate)) { |
897 LOG_RTCERR1(SetPlayoutSampleRate, *options.playout_sample_rate); | 924 LOG_RTCERR1(SetPlayoutSampleRate, *options.playout_sample_rate); |
898 } | 925 } |
899 } | 926 } |
900 | |
901 return true; | 927 return true; |
902 } | 928 } |
903 | 929 |
904 void WebRtcVoiceEngine::SetDefaultDevices() { | 930 void WebRtcVoiceEngine::SetDefaultDevices() { |
905 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 931 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
906 #if !defined(WEBRTC_IOS) | 932 #if !defined(WEBRTC_IOS) |
907 int in_id = kDefaultAudioDeviceId; | 933 int in_id = kDefaultAudioDeviceId; |
908 int out_id = kDefaultAudioDeviceId; | 934 int out_id = kDefaultAudioDeviceId; |
909 LOG(LS_INFO) << "Setting microphone to (id=" << in_id | 935 LOG(LS_INFO) << "Setting microphone to (id=" << in_id |
910 << ") and speaker to (id=" << out_id << ")"; | 936 << ") and speaker to (id=" << out_id << ")"; |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1144 : public AudioSource::Sink { | 1170 : public AudioSource::Sink { |
1145 public: | 1171 public: |
1146 WebRtcAudioSendStream( | 1172 WebRtcAudioSendStream( |
1147 int ch, | 1173 int ch, |
1148 webrtc::AudioTransport* voe_audio_transport, | 1174 webrtc::AudioTransport* voe_audio_transport, |
1149 uint32_t ssrc, | 1175 uint32_t ssrc, |
1150 const std::string& c_name, | 1176 const std::string& c_name, |
1151 const webrtc::AudioSendStream::Config::SendCodecSpec& send_codec_spec, | 1177 const webrtc::AudioSendStream::Config::SendCodecSpec& send_codec_spec, |
1152 const std::vector<webrtc::RtpExtension>& extensions, | 1178 const std::vector<webrtc::RtpExtension>& extensions, |
1153 int max_send_bitrate_bps, | 1179 int max_send_bitrate_bps, |
1180 const rtc::Optional<std::string>& audio_network_adaptor_config, | |
1154 webrtc::Call* call, | 1181 webrtc::Call* call, |
1155 webrtc::Transport* send_transport) | 1182 webrtc::Transport* send_transport) |
1156 : voe_audio_transport_(voe_audio_transport), | 1183 : voe_audio_transport_(voe_audio_transport), |
1157 call_(call), | 1184 call_(call), |
1158 config_(send_transport), | 1185 config_(send_transport), |
1159 max_send_bitrate_bps_(max_send_bitrate_bps), | 1186 max_send_bitrate_bps_(max_send_bitrate_bps), |
1160 rtp_parameters_(CreateRtpParametersWithOneEncoding()) { | 1187 rtp_parameters_(CreateRtpParametersWithOneEncoding()) { |
1161 RTC_DCHECK_GE(ch, 0); | 1188 RTC_DCHECK_GE(ch, 0); |
1162 // TODO(solenberg): Once we're not using FakeWebRtcVoiceEngine anymore: | 1189 // TODO(solenberg): Once we're not using FakeWebRtcVoiceEngine anymore: |
1163 // RTC_DCHECK(voe_audio_transport); | 1190 // RTC_DCHECK(voe_audio_transport); |
1164 RTC_DCHECK(call); | 1191 RTC_DCHECK(call); |
1165 config_.rtp.ssrc = ssrc; | 1192 config_.rtp.ssrc = ssrc; |
1166 config_.rtp.c_name = c_name; | 1193 config_.rtp.c_name = c_name; |
1167 config_.voe_channel_id = ch; | 1194 config_.voe_channel_id = ch; |
1168 config_.rtp.extensions = extensions; | 1195 config_.rtp.extensions = extensions; |
1196 config_.audio_network_adaptor_config = audio_network_adaptor_config; | |
1169 RecreateAudioSendStream(send_codec_spec); | 1197 RecreateAudioSendStream(send_codec_spec); |
1170 } | 1198 } |
1171 | 1199 |
1172 ~WebRtcAudioSendStream() override { | 1200 ~WebRtcAudioSendStream() override { |
1173 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1201 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
1174 ClearSource(); | 1202 ClearSource(); |
1175 call_->DestroyAudioSendStream(stream_); | 1203 call_->DestroyAudioSendStream(stream_); |
1176 } | 1204 } |
1177 | 1205 |
1178 void RecreateAudioSendStream( | 1206 void RecreateAudioSendStream( |
1179 const webrtc::AudioSendStream::Config::SendCodecSpec& send_codec_spec) { | 1207 const webrtc::AudioSendStream::Config::SendCodecSpec& send_codec_spec) { |
1180 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1208 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
1181 send_codec_spec_ = send_codec_spec; | 1209 send_codec_spec_ = send_codec_spec; |
1182 config_.rtp.nack.rtp_history_ms = | 1210 config_.rtp.nack.rtp_history_ms = |
1183 send_codec_spec_.nack_enabled ? kNackRtpHistoryMs : 0; | 1211 send_codec_spec_.nack_enabled ? kNackRtpHistoryMs : 0; |
1184 config_.send_codec_spec = send_codec_spec_; | 1212 config_.send_codec_spec = send_codec_spec_; |
1185 | |
1186 auto send_rate = ComputeSendBitrate( | 1213 auto send_rate = ComputeSendBitrate( |
1187 max_send_bitrate_bps_, rtp_parameters_.encodings[0].max_bitrate_bps, | 1214 max_send_bitrate_bps_, rtp_parameters_.encodings[0].max_bitrate_bps, |
1188 send_codec_spec.codec_inst); | 1215 send_codec_spec.codec_inst); |
1189 if (send_rate) { | 1216 if (send_rate) { |
1190 // Apply a send rate that abides by |max_send_bitrate_bps_| and | 1217 // Apply a send rate that abides by |max_send_bitrate_bps_| and |
1191 // |rtp_parameters_| when possible. Otherwise use the codec rate. | 1218 // |rtp_parameters_| when possible. Otherwise use the codec rate. |
1192 config_.send_codec_spec.codec_inst.rate = *send_rate; | 1219 config_.send_codec_spec.codec_inst.rate = *send_rate; |
1193 } | 1220 } |
1194 RecreateAudioSendStream(); | 1221 RecreateAudioSendStream(); |
1195 } | 1222 } |
1196 | 1223 |
1197 void RecreateAudioSendStream( | 1224 void RecreateAudioSendStream( |
1198 const std::vector<webrtc::RtpExtension>& extensions) { | 1225 const std::vector<webrtc::RtpExtension>& extensions) { |
1199 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1226 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
1200 config_.rtp.extensions = extensions; | 1227 config_.rtp.extensions = extensions; |
1201 RecreateAudioSendStream(); | 1228 RecreateAudioSendStream(); |
1202 } | 1229 } |
1203 | 1230 |
1231 void RecreateAudioSendStream( | |
1232 const rtc::Optional<std::string>& audio_network_adaptor_config) { | |
1233 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | |
1234 if (config_.audio_network_adaptor_config == audio_network_adaptor_config) { | |
1235 return; | |
1236 } | |
1237 config_.audio_network_adaptor_config = audio_network_adaptor_config; | |
1238 RecreateAudioSendStream(); | |
1239 } | |
1240 | |
1204 bool SetMaxSendBitrate(int bps) { | 1241 bool SetMaxSendBitrate(int bps) { |
1205 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1242 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
1206 auto send_rate = | 1243 auto send_rate = |
1207 ComputeSendBitrate(bps, rtp_parameters_.encodings[0].max_bitrate_bps, | 1244 ComputeSendBitrate(bps, rtp_parameters_.encodings[0].max_bitrate_bps, |
1208 send_codec_spec_.codec_inst); | 1245 send_codec_spec_.codec_inst); |
1209 if (!send_rate) { | 1246 if (!send_rate) { |
1210 return false; | 1247 return false; |
1211 } | 1248 } |
1212 | 1249 |
1213 max_send_bitrate_bps_ = bps; | 1250 max_send_bitrate_bps_ = bps; |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1715 | 1752 |
1716 // We retain all of the existing options, and apply the given ones | 1753 // We retain all of the existing options, and apply the given ones |
1717 // on top. This means there is no way to "clear" options such that | 1754 // on top. This means there is no way to "clear" options such that |
1718 // they go back to the engine default. | 1755 // they go back to the engine default. |
1719 options_.SetAll(options); | 1756 options_.SetAll(options); |
1720 if (!engine()->ApplyOptions(options_)) { | 1757 if (!engine()->ApplyOptions(options_)) { |
1721 LOG(LS_WARNING) << | 1758 LOG(LS_WARNING) << |
1722 "Failed to apply engine options during channel SetOptions."; | 1759 "Failed to apply engine options during channel SetOptions."; |
1723 return false; | 1760 return false; |
1724 } | 1761 } |
1762 | |
1763 rtc::Optional<std::string> audio_network_adatptor_config = | |
1764 GetAudioNetworkAdaptorConfig(options_); | |
1765 for (auto& it : send_streams_) { | |
1766 it.second->RecreateAudioSendStream(audio_network_adatptor_config); | |
1767 } | |
1768 | |
1725 LOG(LS_INFO) << "Set voice channel options. Current options: " | 1769 LOG(LS_INFO) << "Set voice channel options. Current options: " |
1726 << options_.ToString(); | 1770 << options_.ToString(); |
1727 return true; | 1771 return true; |
1728 } | 1772 } |
1729 | 1773 |
1730 bool WebRtcVoiceMediaChannel::SetRecvCodecs( | 1774 bool WebRtcVoiceMediaChannel::SetRecvCodecs( |
1731 const std::vector<AudioCodec>& codecs) { | 1775 const std::vector<AudioCodec>& codecs) { |
1732 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1776 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
1733 | 1777 |
1734 // Set the payload types to be used for incoming media. | 1778 // Set the payload types to be used for incoming media. |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1828 | 1872 |
1829 send_codec_spec.transport_cc_enabled = HasTransportCc(*codec); | 1873 send_codec_spec.transport_cc_enabled = HasTransportCc(*codec); |
1830 send_codec_spec.nack_enabled = HasNack(*codec); | 1874 send_codec_spec.nack_enabled = HasNack(*codec); |
1831 | 1875 |
1832 // For Opus as the send codec, we are to determine inband FEC, maximum | 1876 // For Opus as the send codec, we are to determine inband FEC, maximum |
1833 // playback rate, and opus internal dtx. | 1877 // playback rate, and opus internal dtx. |
1834 if (IsCodec(*codec, kOpusCodecName)) { | 1878 if (IsCodec(*codec, kOpusCodecName)) { |
1835 GetOpusConfig(*codec, &send_codec_spec.codec_inst, | 1879 GetOpusConfig(*codec, &send_codec_spec.codec_inst, |
1836 &send_codec_spec.enable_codec_fec, | 1880 &send_codec_spec.enable_codec_fec, |
1837 &send_codec_spec.opus_max_playback_rate, | 1881 &send_codec_spec.opus_max_playback_rate, |
1838 &send_codec_spec.enable_opus_dtx); | 1882 &send_codec_spec.enable_opus_dtx, |
1883 &send_codec_spec.min_ptime_ms, | |
1884 &send_codec_spec.max_ptime_ms); | |
1839 } | 1885 } |
1840 | 1886 |
1841 // Set packet size if the AudioCodec param kCodecParamPTime is set. | 1887 // Set packet size if the AudioCodec param kCodecParamPTime is set. |
1842 int ptime_ms = 0; | 1888 int ptime_ms = 0; |
1843 if (codec->GetParam(kCodecParamPTime, &ptime_ms)) { | 1889 if (codec->GetParam(kCodecParamPTime, &ptime_ms)) { |
1844 if (!WebRtcVoiceCodecs::SetPTimeAsPacketSize( | 1890 if (!WebRtcVoiceCodecs::SetPTimeAsPacketSize( |
1845 &send_codec_spec.codec_inst, ptime_ms)) { | 1891 &send_codec_spec.codec_inst, ptime_ms)) { |
1846 LOG(LS_WARNING) << "Failed to set packet size for codec " | 1892 LOG(LS_WARNING) << "Failed to set packet size for codec " |
1847 << send_codec_spec.codec_inst.plname; | 1893 << send_codec_spec.codec_inst.plname; |
1848 return false; | 1894 return false; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2004 int channel = CreateVoEChannel(); | 2050 int channel = CreateVoEChannel(); |
2005 if (channel == -1) { | 2051 if (channel == -1) { |
2006 return false; | 2052 return false; |
2007 } | 2053 } |
2008 | 2054 |
2009 // Save the channel to send_streams_, so that RemoveSendStream() can still | 2055 // Save the channel to send_streams_, so that RemoveSendStream() can still |
2010 // delete the channel in case failure happens below. | 2056 // delete the channel in case failure happens below. |
2011 webrtc::AudioTransport* audio_transport = | 2057 webrtc::AudioTransport* audio_transport = |
2012 engine()->voe()->base()->audio_transport(); | 2058 engine()->voe()->base()->audio_transport(); |
2013 | 2059 |
2060 rtc::Optional<std::string> audio_network_adaptor_config = | |
2061 GetAudioNetworkAdaptorConfig(options_); | |
2014 WebRtcAudioSendStream* stream = new WebRtcAudioSendStream( | 2062 WebRtcAudioSendStream* stream = new WebRtcAudioSendStream( |
2015 channel, audio_transport, ssrc, sp.cname, send_codec_spec_, | 2063 channel, audio_transport, ssrc, sp.cname, send_codec_spec_, |
2016 send_rtp_extensions_, max_send_bitrate_bps_, call_, this); | 2064 send_rtp_extensions_, max_send_bitrate_bps_, audio_network_adaptor_config, |
2065 call_, this); | |
2017 send_streams_.insert(std::make_pair(ssrc, stream)); | 2066 send_streams_.insert(std::make_pair(ssrc, stream)); |
2018 | 2067 |
2019 // At this point the stream's local SSRC has been updated. If it is the first | 2068 // At this point the stream's local SSRC has been updated. If it is the first |
2020 // send stream, make sure that all the receive streams are updated with the | 2069 // send stream, make sure that all the receive streams are updated with the |
2021 // same SSRC in order to send receiver reports. | 2070 // same SSRC in order to send receiver reports. |
2022 if (send_streams_.size() == 1) { | 2071 if (send_streams_.size() == 1) { |
2023 receiver_reports_ssrc_ = ssrc; | 2072 receiver_reports_ssrc_ = ssrc; |
2024 for (const auto& kv : recv_streams_) { | 2073 for (const auto& kv : recv_streams_) { |
2025 // TODO(solenberg): Allow applications to set the RTCP SSRC of receive | 2074 // TODO(solenberg): Allow applications to set the RTCP SSRC of receive |
2026 // streams instead, so we can avoid recreating the streams here. | 2075 // streams instead, so we can avoid recreating the streams here. |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2512 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 2561 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
2513 const auto it = send_streams_.find(ssrc); | 2562 const auto it = send_streams_.find(ssrc); |
2514 if (it != send_streams_.end()) { | 2563 if (it != send_streams_.end()) { |
2515 return it->second->channel(); | 2564 return it->second->channel(); |
2516 } | 2565 } |
2517 return -1; | 2566 return -1; |
2518 } | 2567 } |
2519 } // namespace cricket | 2568 } // namespace cricket |
2520 | 2569 |
2521 #endif // HAVE_WEBRTC_VOICE | 2570 #endif // HAVE_WEBRTC_VOICE |
OLD | NEW |