| Index: webrtc/api/rtpsender.cc
 | 
| diff --git a/webrtc/api/rtpsender.cc b/webrtc/api/rtpsender.cc
 | 
| index a7537867e26f2bb4104e64f4350d52eb7b6bca3f..4705bc03f0bec352a1ae7d01ca1747b064405c8c 100644
 | 
| --- a/webrtc/api/rtpsender.cc
 | 
| +++ b/webrtc/api/rtpsender.cc
 | 
| @@ -276,18 +276,17 @@ bool VideoRtpSender::SetTrack(MediaStreamTrackInterface* track) {
 | 
|  
 | 
|    // Update video provider.
 | 
|    if (can_send_track()) {
 | 
| -    VideoTrackSourceInterface* source = track_->GetSource();
 | 
|      // TODO(deadbeef): If SetTrack is called with a disabled track, and the
 | 
|      // previous track was enabled, this could cause a frame from the new track
 | 
| -    // to slip out. Really, what we need is for SetCaptureDevice and
 | 
| +    // to slip out. Really, what we need is for SetSource and
 | 
|      // SetVideoSend
 | 
|      // to be combined into one atomic operation, all the way down to
 | 
|      // WebRtcVideoSendStream.
 | 
| -    provider_->SetCaptureDevice(ssrc_,
 | 
| -                                source ? source->GetVideoCapturer() : nullptr);
 | 
| +
 | 
| +    provider_->SetSource(ssrc_, track_);
 | 
|      SetVideoSend();
 | 
|    } else if (prev_can_send_track) {
 | 
| -    provider_->SetCaptureDevice(ssrc_, nullptr);
 | 
| +    provider_->SetSource(ssrc_, nullptr);
 | 
|      provider_->SetVideoSend(ssrc_, false, nullptr);
 | 
|    }
 | 
|    return true;
 | 
| @@ -299,14 +298,12 @@ void VideoRtpSender::SetSsrc(uint32_t ssrc) {
 | 
|    }
 | 
|    // If we are already sending with a particular SSRC, stop sending.
 | 
|    if (can_send_track()) {
 | 
| -    provider_->SetCaptureDevice(ssrc_, nullptr);
 | 
| +    provider_->SetSource(ssrc_, nullptr);
 | 
|      provider_->SetVideoSend(ssrc_, false, nullptr);
 | 
|    }
 | 
|    ssrc_ = ssrc;
 | 
|    if (can_send_track()) {
 | 
| -    VideoTrackSourceInterface* source = track_->GetSource();
 | 
| -    provider_->SetCaptureDevice(ssrc_,
 | 
| -                                source ? source->GetVideoCapturer() : nullptr);
 | 
| +    provider_->SetSource(ssrc_, track_);
 | 
|      SetVideoSend();
 | 
|    }
 | 
|  }
 | 
| @@ -320,7 +317,7 @@ void VideoRtpSender::Stop() {
 | 
|      track_->UnregisterObserver(this);
 | 
|    }
 | 
|    if (can_send_track()) {
 | 
| -    provider_->SetCaptureDevice(ssrc_, nullptr);
 | 
| +    provider_->SetSource(ssrc_, nullptr);
 | 
|      provider_->SetVideoSend(ssrc_, false, nullptr);
 | 
|    }
 | 
|    stopped_ = true;
 | 
| 
 |