Removes decoder thread fallback from VideoReceiveStream.
The task queue variant has been the default without issues for a few
months.
Bug: webrtc:10365
Change-Id: I1e1707a80788243eba1b439c8db4f8f6162774ed
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/152283
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29138}
diff --git a/video/video_receive_stream.cc b/video/video_receive_stream.cc
index a52dac8..29cfbbd 100644
--- a/video/video_receive_stream.cc
+++ b/video/video_receive_stream.cc
@@ -184,12 +184,6 @@
num_cpu_cores_(num_cpu_cores),
process_thread_(process_thread),
clock_(clock),
- use_task_queue_(
- !field_trial::IsDisabled("WebRTC-Video-DecodeOnTaskQueue")),
- decode_thread_(&DecodeThreadFunction,
- this,
- "DecodingThread",
- rtc::kHighestPriority),
call_stats_(call_stats),
source_tracker_(clock_),
stats_proxy_(&config_, clock_),
@@ -392,18 +386,14 @@
// method does nothing that is useful for us, since we no longer use the old
// jitter buffer.
- // Start the decode thread
+ // Start decoding on task queue.
video_receiver_.DecoderThreadStarting();
stats_proxy_.DecoderThreadStarting();
- if (!use_task_queue_) {
- decode_thread_.Start();
- } else {
- decode_queue_.PostTask([this] {
- RTC_DCHECK_RUN_ON(&decode_queue_);
- decoder_stopped_ = false;
- StartNextDecode();
- });
- }
+ decode_queue_.PostTask([this] {
+ RTC_DCHECK_RUN_ON(&decode_queue_);
+ decoder_stopped_ = false;
+ StartNextDecode();
+ });
decoder_running_ = true;
rtp_video_stream_receiver_.StartReceive();
}
@@ -415,11 +405,8 @@
stats_proxy_.OnUniqueFramesCounted(
rtp_video_stream_receiver_.GetUniqueFramesSeen());
- if (!use_task_queue_) {
- frame_buffer_->Stop();
- } else {
- decode_queue_.PostTask([this] { frame_buffer_->Stop(); });
- }
+ decode_queue_.PostTask([this] { frame_buffer_->Stop(); });
+
call_stats_->DeregisterStatsObserver(this);
if (decoder_running_) {
@@ -428,17 +415,14 @@
// before joining the decoder thread.
video_receiver_.TriggerDecoderShutdown();
- if (!use_task_queue_) {
- decode_thread_.Stop();
- } else {
- rtc::Event done;
- decode_queue_.PostTask([this, &done] {
- RTC_DCHECK_RUN_ON(&decode_queue_);
- decoder_stopped_ = true;
- done.Set();
- });
- done.Wait(rtc::Event::kForever);
- }
+ rtc::Event done;
+ decode_queue_.PostTask([this, &done] {
+ RTC_DCHECK_RUN_ON(&decode_queue_);
+ decoder_stopped_ = true;
+ done.Set();
+ });
+ done.Wait(rtc::Event::kForever);
+
decoder_running_ = false;
video_receiver_.DecoderThreadStopped();
stats_proxy_.DecoderThreadStopped();
@@ -646,7 +630,6 @@
}
void VideoReceiveStream::StartNextDecode() {
- RTC_DCHECK(use_task_queue_);
TRACE_EVENT0("webrtc", "VideoReceiveStream::StartNextDecode");
struct DecodeTask {
@@ -674,34 +657,6 @@
});
}
-void VideoReceiveStream::DecodeThreadFunction(void* ptr) {
- ScopedRegisterThreadForDebugging thread_dbg(RTC_FROM_HERE);
- while (static_cast<VideoReceiveStream*>(ptr)->Decode()) {
- }
-}
-
-bool VideoReceiveStream::Decode() {
- RTC_DCHECK(!use_task_queue_);
- TRACE_EVENT0("webrtc", "VideoReceiveStream::Decode");
-
- std::unique_ptr<video_coding::EncodedFrame> frame;
- video_coding::FrameBuffer::ReturnReason res =
- frame_buffer_->NextFrame(GetWaitMs(), &frame, keyframe_required_);
-
- if (res == ReturnReason::kStopped) {
- return false;
- }
-
- if (frame) {
- RTC_DCHECK_EQ(res, ReturnReason::kFrameFound);
- HandleEncodedFrame(std::move(frame));
- } else {
- RTC_DCHECK_EQ(res, ReturnReason::kTimeout);
- HandleFrameBufferTimeout();
- }
- return true;
-}
-
void VideoReceiveStream::HandleEncodedFrame(
std::unique_ptr<EncodedFrame> frame) {
int64_t now_ms = clock_->TimeInMilliseconds();
diff --git a/video/video_receive_stream.h b/video/video_receive_stream.h
index 65c9601..87a40e9 100644
--- a/video/video_receive_stream.h
+++ b/video/video_receive_stream.h
@@ -134,8 +134,6 @@
private:
int64_t GetWaitMs() const;
void StartNextDecode() RTC_RUN_ON(decode_queue_);
- static void DecodeThreadFunction(void* ptr);
- bool Decode();
void HandleEncodedFrame(std::unique_ptr<video_coding::EncodedFrame> frame);
void HandleFrameBufferTimeout();
@@ -157,10 +155,6 @@
ProcessThread* const process_thread_;
Clock* const clock_;
- const bool use_task_queue_;
-
- rtc::PlatformThread decode_thread_;
-
CallStats* const call_stats_;
bool decoder_running_ RTC_GUARDED_BY(worker_sequence_checker_) = false;