| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 track_->RemoveSink(sink_adapter_.get()); | 115 track_->RemoveSink(sink_adapter_.get()); |
| 116 track_->UnregisterObserver(this); | 116 track_->UnregisterObserver(this); |
| 117 } | 117 } |
| 118 | 118 |
| 119 if (can_send_track() && stats_) { | 119 if (can_send_track() && stats_) { |
| 120 stats_->RemoveLocalAudioTrack(track_.get(), ssrc_); | 120 stats_->RemoveLocalAudioTrack(track_.get(), ssrc_); |
| 121 } | 121 } |
| 122 | 122 |
| 123 // Attach to new track. | 123 // Attach to new track. |
| 124 bool prev_can_send_track = can_send_track(); | 124 bool prev_can_send_track = can_send_track(); |
| 125 // Keep a reference to the old track to keep it alive until we call |
| 126 // SetAudioSend. |
| 127 rtc::scoped_refptr<AudioTrackInterface> old_track = track_; |
| 125 track_ = audio_track; | 128 track_ = audio_track; |
| 126 if (track_) { | 129 if (track_) { |
| 127 cached_track_enabled_ = track_->enabled(); | 130 cached_track_enabled_ = track_->enabled(); |
| 128 track_->RegisterObserver(this); | 131 track_->RegisterObserver(this); |
| 129 track_->AddSink(sink_adapter_.get()); | 132 track_->AddSink(sink_adapter_.get()); |
| 130 } | 133 } |
| 131 | 134 |
| 132 // Update audio provider. | 135 // Update audio provider. |
| 133 if (can_send_track()) { | 136 if (can_send_track()) { |
| 134 SetAudioSend(); | 137 SetAudioSend(); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 } | 272 } |
| 270 VideoTrackInterface* video_track = static_cast<VideoTrackInterface*>(track); | 273 VideoTrackInterface* video_track = static_cast<VideoTrackInterface*>(track); |
| 271 | 274 |
| 272 // Detach from old track. | 275 // Detach from old track. |
| 273 if (track_) { | 276 if (track_) { |
| 274 track_->UnregisterObserver(this); | 277 track_->UnregisterObserver(this); |
| 275 } | 278 } |
| 276 | 279 |
| 277 // Attach to new track. | 280 // Attach to new track. |
| 278 bool prev_can_send_track = can_send_track(); | 281 bool prev_can_send_track = can_send_track(); |
| 282 // Keep a reference to the old track to keep it alive until we call |
| 283 // SetSource. |
| 284 rtc::scoped_refptr<VideoTrackInterface> old_track = track_; |
| 279 track_ = video_track; | 285 track_ = video_track; |
| 280 if (track_) { | 286 if (track_) { |
| 281 cached_track_enabled_ = track_->enabled(); | 287 cached_track_enabled_ = track_->enabled(); |
| 282 track_->RegisterObserver(this); | 288 track_->RegisterObserver(this); |
| 283 } | 289 } |
| 284 | 290 |
| 285 // Update video provider. | 291 // Update video provider. |
| 286 if (can_send_track()) { | 292 if (can_send_track()) { |
| 287 // TODO(deadbeef): If SetTrack is called with a disabled track, and the | 293 // TODO(deadbeef): If SetTrack is called with a disabled track, and the |
| 288 // previous track was enabled, this could cause a frame from the new track | 294 // previous track was enabled, this could cause a frame from the new track |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 RtpParameters VideoRtpSender::GetParameters() const { | 352 RtpParameters VideoRtpSender::GetParameters() const { |
| 347 return provider_->GetVideoRtpParameters(ssrc_); | 353 return provider_->GetVideoRtpParameters(ssrc_); |
| 348 } | 354 } |
| 349 | 355 |
| 350 bool VideoRtpSender::SetParameters(const RtpParameters& parameters) { | 356 bool VideoRtpSender::SetParameters(const RtpParameters& parameters) { |
| 351 TRACE_EVENT0("webrtc", "VideoRtpSender::SetParameters"); | 357 TRACE_EVENT0("webrtc", "VideoRtpSender::SetParameters"); |
| 352 return provider_->SetVideoRtpParameters(ssrc_, parameters); | 358 return provider_->SetVideoRtpParameters(ssrc_, parameters); |
| 353 } | 359 } |
| 354 | 360 |
| 355 } // namespace webrtc | 361 } // namespace webrtc |
| OLD | NEW |