| Index: webrtc/api/rtpsender.cc
|
| diff --git a/webrtc/api/rtpsender.cc b/webrtc/api/rtpsender.cc
|
| index 5577b9c7500457714491f75950bafad839751354..33d7ee37a9f3c92ad4e3e1c6af55583603e10762 100644
|
| --- a/webrtc/api/rtpsender.cc
|
| +++ b/webrtc/api/rtpsender.cc
|
| @@ -280,7 +280,7 @@ bool VideoRtpSender::SetTrack(MediaStreamTrackInterface* track) {
|
| // Attach to new track.
|
| bool prev_can_send_track = can_send_track();
|
| // Keep a reference to the old track to keep it alive until we call
|
| - // SetSource.
|
| + // SetVideoSend.
|
| rtc::scoped_refptr<VideoTrackInterface> old_track = track_;
|
| track_ = video_track;
|
| if (track_) {
|
| @@ -290,17 +290,9 @@ bool VideoRtpSender::SetTrack(MediaStreamTrackInterface* track) {
|
|
|
| // Update video provider.
|
| if (can_send_track()) {
|
| - // 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 SetSource and SetVideoSend
|
| - // to be combined into one atomic operation, all the way down to
|
| - // WebRtcVideoSendStream.
|
| -
|
| - provider_->SetSource(ssrc_, track_);
|
| SetVideoSend();
|
| } else if (prev_can_send_track) {
|
| - provider_->SetSource(ssrc_, nullptr);
|
| - provider_->SetVideoSend(ssrc_, false, nullptr);
|
| + ClearVideoSend();
|
| }
|
| return true;
|
| }
|
| @@ -312,12 +304,10 @@ void VideoRtpSender::SetSsrc(uint32_t ssrc) {
|
| }
|
| // If we are already sending with a particular SSRC, stop sending.
|
| if (can_send_track()) {
|
| - provider_->SetSource(ssrc_, nullptr);
|
| - provider_->SetVideoSend(ssrc_, false, nullptr);
|
| + ClearVideoSend();
|
| }
|
| ssrc_ = ssrc;
|
| if (can_send_track()) {
|
| - provider_->SetSource(ssrc_, track_);
|
| SetVideoSend();
|
| }
|
| }
|
| @@ -332,8 +322,7 @@ void VideoRtpSender::Stop() {
|
| track_->UnregisterObserver(this);
|
| }
|
| if (can_send_track()) {
|
| - provider_->SetSource(ssrc_, nullptr);
|
| - provider_->SetVideoSend(ssrc_, false, nullptr);
|
| + ClearVideoSend();
|
| }
|
| stopped_ = true;
|
| }
|
| @@ -346,7 +335,13 @@ void VideoRtpSender::SetVideoSend() {
|
| options.is_screencast = rtc::Optional<bool>(source->is_screencast());
|
| options.video_noise_reduction = source->needs_denoising();
|
| }
|
| - provider_->SetVideoSend(ssrc_, track_->enabled(), &options);
|
| + provider_->SetVideoSend(ssrc_, track_->enabled(), &options, track_);
|
| +}
|
| +
|
| +void VideoRtpSender::ClearVideoSend() {
|
| + RTC_DCHECK(ssrc_ != 0);
|
| + RTC_DCHECK(provider_ != nullptr);
|
| + provider_->SetVideoSend(ssrc_, false, nullptr, nullptr);
|
| }
|
|
|
| RtpParameters VideoRtpSender::GetParameters() const {
|
|
|