| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 if (stats_) { | 138 if (stats_) { |
| 139 stats_->AddLocalAudioTrack(track_.get(), ssrc_); | 139 stats_->AddLocalAudioTrack(track_.get(), ssrc_); |
| 140 } | 140 } |
| 141 } else if (prev_can_send_track) { | 141 } else if (prev_can_send_track) { |
| 142 cricket::AudioOptions options; | 142 cricket::AudioOptions options; |
| 143 provider_->SetAudioSend(ssrc_, false, options, nullptr); | 143 provider_->SetAudioSend(ssrc_, false, options, nullptr); |
| 144 } | 144 } |
| 145 return true; | 145 return true; |
| 146 } | 146 } |
| 147 | 147 |
| 148 RtpParameters AudioRtpSender::GetParameters() const { |
| 149 return provider_->GetAudioRtpSendParameters(ssrc_); |
| 150 } |
| 151 |
| 152 bool AudioRtpSender::SetParameters(const RtpParameters& parameters) { |
| 153 TRACE_EVENT0("webrtc", "AudioRtpSender::SetParameters"); |
| 154 return provider_->SetAudioRtpSendParameters(ssrc_, parameters); |
| 155 } |
| 156 |
| 148 void AudioRtpSender::SetSsrc(uint32_t ssrc) { | 157 void AudioRtpSender::SetSsrc(uint32_t ssrc) { |
| 149 TRACE_EVENT0("webrtc", "AudioRtpSender::SetSsrc"); | 158 TRACE_EVENT0("webrtc", "AudioRtpSender::SetSsrc"); |
| 150 if (stopped_ || ssrc == ssrc_) { | 159 if (stopped_ || ssrc == ssrc_) { |
| 151 return; | 160 return; |
| 152 } | 161 } |
| 153 // If we are already sending with a particular SSRC, stop sending. | 162 // If we are already sending with a particular SSRC, stop sending. |
| 154 if (can_send_track()) { | 163 if (can_send_track()) { |
| 155 cricket::AudioOptions options; | 164 cricket::AudioOptions options; |
| 156 provider_->SetAudioSend(ssrc_, false, options, nullptr); | 165 provider_->SetAudioSend(ssrc_, false, options, nullptr); |
| 157 if (stats_) { | 166 if (stats_) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 // a remote audio track to a peer connection. | 209 // a remote audio track to a peer connection. |
| 201 options = static_cast<LocalAudioSource*>(track_->GetSource())->options(); | 210 options = static_cast<LocalAudioSource*>(track_->GetSource())->options(); |
| 202 } | 211 } |
| 203 #endif | 212 #endif |
| 204 | 213 |
| 205 cricket::AudioSource* source = sink_adapter_.get(); | 214 cricket::AudioSource* source = sink_adapter_.get(); |
| 206 ASSERT(source != nullptr); | 215 ASSERT(source != nullptr); |
| 207 provider_->SetAudioSend(ssrc_, track_->enabled(), options, source); | 216 provider_->SetAudioSend(ssrc_, track_->enabled(), options, source); |
| 208 } | 217 } |
| 209 | 218 |
| 210 RtpParameters AudioRtpSender::GetParameters() const { | |
| 211 return provider_->GetAudioRtpSendParameters(ssrc_); | |
| 212 } | |
| 213 | |
| 214 bool AudioRtpSender::SetParameters(const RtpParameters& parameters) { | |
| 215 TRACE_EVENT0("webrtc", "AudioRtpSender::SetParameters"); | |
| 216 return provider_->SetAudioRtpSendParameters(ssrc_, parameters); | |
| 217 } | |
| 218 | |
| 219 VideoRtpSender::VideoRtpSender(VideoTrackInterface* track, | 219 VideoRtpSender::VideoRtpSender(VideoTrackInterface* track, |
| 220 const std::string& stream_id, | 220 const std::string& stream_id, |
| 221 VideoProviderInterface* provider) | 221 VideoProviderInterface* provider) |
| 222 : id_(track->id()), | 222 : id_(track->id()), |
| 223 stream_id_(stream_id), | 223 stream_id_(stream_id), |
| 224 provider_(provider), | 224 provider_(provider), |
| 225 track_(track), | 225 track_(track), |
| 226 cached_track_enabled_(track->enabled()) { | 226 cached_track_enabled_(track->enabled()) { |
| 227 RTC_DCHECK(provider != nullptr); | 227 RTC_DCHECK(provider != nullptr); |
| 228 track_->RegisterObserver(this); | 228 track_->RegisterObserver(this); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 | 290 |
| 291 // Update video provider. | 291 // Update video provider. |
| 292 if (can_send_track()) { | 292 if (can_send_track()) { |
| 293 SetVideoSend(); | 293 SetVideoSend(); |
| 294 } else if (prev_can_send_track) { | 294 } else if (prev_can_send_track) { |
| 295 ClearVideoSend(); | 295 ClearVideoSend(); |
| 296 } | 296 } |
| 297 return true; | 297 return true; |
| 298 } | 298 } |
| 299 | 299 |
| 300 RtpParameters VideoRtpSender::GetParameters() const { |
| 301 return provider_->GetVideoRtpSendParameters(ssrc_); |
| 302 } |
| 303 |
| 304 bool VideoRtpSender::SetParameters(const RtpParameters& parameters) { |
| 305 TRACE_EVENT0("webrtc", "VideoRtpSender::SetParameters"); |
| 306 return provider_->SetVideoRtpSendParameters(ssrc_, parameters); |
| 307 } |
| 308 |
| 300 void VideoRtpSender::SetSsrc(uint32_t ssrc) { | 309 void VideoRtpSender::SetSsrc(uint32_t ssrc) { |
| 301 TRACE_EVENT0("webrtc", "VideoRtpSender::SetSsrc"); | 310 TRACE_EVENT0("webrtc", "VideoRtpSender::SetSsrc"); |
| 302 if (stopped_ || ssrc == ssrc_) { | 311 if (stopped_ || ssrc == ssrc_) { |
| 303 return; | 312 return; |
| 304 } | 313 } |
| 305 // If we are already sending with a particular SSRC, stop sending. | 314 // If we are already sending with a particular SSRC, stop sending. |
| 306 if (can_send_track()) { | 315 if (can_send_track()) { |
| 307 ClearVideoSend(); | 316 ClearVideoSend(); |
| 308 } | 317 } |
| 309 ssrc_ = ssrc; | 318 ssrc_ = ssrc; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 337 } | 346 } |
| 338 provider_->SetVideoSend(ssrc_, track_->enabled(), &options, track_); | 347 provider_->SetVideoSend(ssrc_, track_->enabled(), &options, track_); |
| 339 } | 348 } |
| 340 | 349 |
| 341 void VideoRtpSender::ClearVideoSend() { | 350 void VideoRtpSender::ClearVideoSend() { |
| 342 RTC_DCHECK(ssrc_ != 0); | 351 RTC_DCHECK(ssrc_ != 0); |
| 343 RTC_DCHECK(provider_ != nullptr); | 352 RTC_DCHECK(provider_ != nullptr); |
| 344 provider_->SetVideoSend(ssrc_, false, nullptr, nullptr); | 353 provider_->SetVideoSend(ssrc_, false, nullptr, nullptr); |
| 345 } | 354 } |
| 346 | 355 |
| 347 RtpParameters VideoRtpSender::GetParameters() const { | |
| 348 return provider_->GetVideoRtpSendParameters(ssrc_); | |
| 349 } | |
| 350 | |
| 351 bool VideoRtpSender::SetParameters(const RtpParameters& parameters) { | |
| 352 TRACE_EVENT0("webrtc", "VideoRtpSender::SetParameters"); | |
| 353 return provider_->SetVideoRtpSendParameters(ssrc_, parameters); | |
| 354 } | |
| 355 | |
| 356 } // namespace webrtc | 356 } // namespace webrtc |
| OLD | NEW |