From d48598207dbac27f04900c444f9cf85c5cf29942 Mon Sep 17 00:00:00 2001 From: victorpasoshnikov Date: Mon, 6 Nov 2023 05:45:10 +0300 Subject: [PATCH] [XB1] Fix skipped OnDecoderDrained task. (#1765) b/284359403 (cherry picked from commit 8eea4c9e42bfd510b653866a4739392b2435d09c) --- starboard/xb1/shared/gpu_base_video_decoder.cc | 7 +++---- starboard/xb1/shared/gpu_base_video_decoder.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/starboard/xb1/shared/gpu_base_video_decoder.cc b/starboard/xb1/shared/gpu_base_video_decoder.cc index a37dc716f459..155fef26eca3 100644 --- a/starboard/xb1/shared/gpu_base_video_decoder.cc +++ b/starboard/xb1/shared/gpu_base_video_decoder.cc @@ -593,9 +593,6 @@ void GpuVideoDecoderBase::OnDecoderDrained() { decoder_behavior_.load() == kResettingDecoder); is_waiting_frame_after_drain_ = true; - if (decoder_behavior_.load() == kResettingDecoder || error_occured_) { - return; - } if (!BelongsToDecoderThread()) { decoder_thread_->job_queue()->Schedule( @@ -603,7 +600,6 @@ void GpuVideoDecoderBase::OnDecoderDrained() { return; } - SB_DCHECK(written_inputs_.empty()); if (decoder_behavior_.load() == kEndingStream) { decoder_status_cb_(kBufferFull, VideoFrame::CreateEOSFrame()); } @@ -688,6 +684,9 @@ void GpuVideoDecoderBase::DrainDecoder() { if (!is_drain_decoder_called_) { is_drain_decoder_called_ = true; DrainDecoderInternal(); + // DrainDecoderInternal is sync command, after it finished, we can be sure + // that drain really completed. + OnDecoderDrained(); } } diff --git a/starboard/xb1/shared/gpu_base_video_decoder.h b/starboard/xb1/shared/gpu_base_video_decoder.h index 1853a640fc1d..34d45338813d 100644 --- a/starboard/xb1/shared/gpu_base_video_decoder.h +++ b/starboard/xb1/shared/gpu_base_video_decoder.h @@ -218,7 +218,7 @@ class GpuVideoDecoderBase Mutex frame_buffers_mutex_; ConditionVariable frame_buffers_condition_; - // static std::vector> s_frame_buffers_; + private: class GPUDecodeTargetPrivate;