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;