Skip to content

Commit

Permalink
[XB1] Fix skipped OnDecoderDrained task. (#1765)
Browse files Browse the repository at this point in the history
b/284359403

(cherry picked from commit 8eea4c9)
  • Loading branch information
victorpasoshnikov authored and anonymous1-me committed Nov 6, 2023
1 parent 6586e24 commit d485982
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions starboard/xb1/shared/gpu_base_video_decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -593,17 +593,13 @@ 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(
std::bind(&GpuVideoDecoderBase::OnDecoderDrained, this));
return;
}

SB_DCHECK(written_inputs_.empty());
if (decoder_behavior_.load() == kEndingStream) {
decoder_status_cb_(kBufferFull, VideoFrame::CreateEOSFrame());
}
Expand Down Expand Up @@ -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();
}
}

Expand Down
2 changes: 1 addition & 1 deletion starboard/xb1/shared/gpu_base_video_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class GpuVideoDecoderBase

Mutex frame_buffers_mutex_;
ConditionVariable frame_buffers_condition_;
// static std::vector<scoped_refptr<GpuFrameBuffer>> s_frame_buffers_;

private:
class GPUDecodeTargetPrivate;

Expand Down

0 comments on commit d485982

Please sign in to comment.