Delete video source proxying in WebRtcVideoSendStream

Bug: webrtc:10147
Change-Id: Ib9f399e79d99f7d8db53fa38ef4b92986913ac26
Reviewed-on: https://webrtc-review.googlesource.com/c/121569
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26633}
This commit is contained in:
Niels Möller
2019-02-05 22:41:20 +01:00
committed by Commit Bot
parent 6df89cc13c
commit b66003ca79
2 changed files with 5 additions and 49 deletions

View File

@ -1567,7 +1567,6 @@ WebRtcVideoChannel::WebRtcVideoSendStream::WebRtcVideoSendStream(
enable_cpu_overuse_detection_(enable_cpu_overuse_detection),
source_(nullptr),
stream_(nullptr),
encoder_sink_(nullptr),
parameters_(std::move(config), options, max_bitrate_bps, codec_settings),
rtp_parameters_(CreateRtpParametersWithEncodings(sp)),
sending_(false) {
@ -1663,7 +1662,7 @@ bool WebRtcVideoChannel::WebRtcVideoSendStream::SetVideoSend(
// Switch to the new source.
source_ = source;
if (source && stream_) {
stream_->SetSource(this, GetDegradationPreference());
stream_->SetSource(source_, GetDegradationPreference());
}
return true;
}
@ -1843,7 +1842,7 @@ webrtc::RTCError WebRtcVideoChannel::WebRtcVideoSendStream::SetRtpParameters(
UpdateSendState();
}
if (new_degradation_preference) {
stream_->SetSource(this, GetDegradationPreference());
stream_->SetSource(source_, GetDegradationPreference());
}
return webrtc::RTCError::OK();
}
@ -2024,39 +2023,6 @@ void WebRtcVideoChannel::WebRtcVideoSendStream::SetSend(bool send) {
UpdateSendState();
}
void WebRtcVideoChannel::WebRtcVideoSendStream::RemoveSink(
rtc::VideoSinkInterface<webrtc::VideoFrame>* sink) {
RTC_DCHECK_RUN_ON(&thread_checker_);
RTC_DCHECK(encoder_sink_ == sink);
encoder_sink_ = nullptr;
source_->RemoveSink(sink);
}
void WebRtcVideoChannel::WebRtcVideoSendStream::AddOrUpdateSink(
rtc::VideoSinkInterface<webrtc::VideoFrame>* sink,
const rtc::VideoSinkWants& wants) {
if (worker_thread_ == rtc::Thread::Current()) {
// AddOrUpdateSink is called on |worker_thread_| if this is the first
// registration of |sink|.
RTC_DCHECK_RUN_ON(&thread_checker_);
encoder_sink_ = sink;
source_->AddOrUpdateSink(encoder_sink_, wants);
} else {
// Subsequent calls to AddOrUpdateSink will happen on the encoder task
// queue.
invoker_.AsyncInvoke<void>(
RTC_FROM_HERE, worker_thread_, [this, sink, wants] {
RTC_DCHECK_RUN_ON(&thread_checker_);
// |sink| may be invalidated after this task was posted since
// RemoveSink is called on the worker thread.
bool encoder_sink_valid = (sink == encoder_sink_);
if (source_ && encoder_sink_valid) {
source_->AddOrUpdateSink(encoder_sink_, wants);
}
});
}
}
VideoSenderInfo WebRtcVideoChannel::WebRtcVideoSendStream::GetVideoSenderInfo(
bool log_stats) {
VideoSenderInfo info;
@ -2179,7 +2145,7 @@ void WebRtcVideoChannel::WebRtcVideoSendStream::RecreateWebRtcStream() {
parameters_.encoder_config.encoder_specific_settings = NULL;
if (source_) {
stream_->SetSource(this, GetDegradationPreference());
stream_->SetSource(source_, GetDegradationPreference());
}
// Call stream_->Start() if necessary conditions are met.

View File

@ -254,8 +254,7 @@ class WebRtcVideoChannel : public VideoMediaChannel, public webrtc::Transport {
const std::vector<VideoCodecSettings>& codecs);
// Wrapper for the sender part.
class WebRtcVideoSendStream
: public rtc::VideoSourceInterface<webrtc::VideoFrame> {
class WebRtcVideoSendStream {
public:
WebRtcVideoSendStream(
webrtc::Call* call,
@ -276,14 +275,6 @@ class WebRtcVideoChannel : public VideoMediaChannel, public webrtc::Transport {
void SetFrameEncryptor(
rtc::scoped_refptr<webrtc::FrameEncryptorInterface> frame_encryptor);
// Implements rtc::VideoSourceInterface<webrtc::VideoFrame>.
// WebRtcVideoSendStream acts as a source to the webrtc::VideoSendStream
// in |stream_|. This is done to proxy VideoSinkWants from the encoder to
// the worker thread.
void AddOrUpdateSink(rtc::VideoSinkInterface<webrtc::VideoFrame>* sink,
const rtc::VideoSinkWants& wants) override;
void RemoveSink(rtc::VideoSinkInterface<webrtc::VideoFrame>* sink) override;
bool SetVideoSend(const VideoOptions* options,
rtc::VideoSourceInterface<webrtc::VideoFrame>* source);
@ -341,8 +332,7 @@ class WebRtcVideoChannel : public VideoMediaChannel, public webrtc::Transport {
RTC_GUARDED_BY(&thread_checker_);
webrtc::VideoSendStream* stream_ RTC_GUARDED_BY(&thread_checker_);
rtc::VideoSinkInterface<webrtc::VideoFrame>* encoder_sink_
RTC_GUARDED_BY(&thread_checker_);
// Contains settings that are the same for all streams in the MediaChannel,
// such as codecs, header extensions, and the global bitrate limit for the
// entire channel.