Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry pick PR #1765: [XB1] Fix skipped OnDecoderDrained task. #1912

Merged
merged 1 commit into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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