Commit 30b5fca7 authored by Chih-Yu Huang's avatar Chih-Yu Huang Committed by Commit Bot

media/gpu/v4l2SVD: stop decoding after any error occurs.

Originally V4L2SVD tried to decode new buffers after any error occurs,
i.e. at |kError| state. In this CL, we only handle the decoder request
at |kDecode| state.

BUG=b:140842667
TEST=run video_decode_accelerator_tests on Kevin

Change-Id: Ib785b5d1e51a1489ce1340b03e2b10c2d1b45a7f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1818011Reviewed-by: default avatarHirokazu Honda <hiroh@chromium.org>
Commit-Queue: Chih-Yu Huang <akahuang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699263}
parent 6661a69a
......@@ -227,14 +227,11 @@ void V4L2SliceVideoDecoder::DestroyTask() {
DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
DVLOGF(2);
if (avd_) {
avd_->Reset();
avd_ = nullptr;
}
// Call all pending decode callback.
ClearPendingRequests(DecodeStatus::ABORTED);
avd_ = nullptr;
// Stop and Destroy device.
StopStreamV4L2Queue();
if (input_queue_) {
......@@ -543,9 +540,6 @@ void V4L2SliceVideoDecoder::ResetTask(base::OnceClosure closure) {
DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
DVLOGF(3);
if (avd_)
avd_->Reset();
// Call all pending decode callback.
ClearPendingRequests(DecodeStatus::ABORTED);
......@@ -568,6 +562,9 @@ void V4L2SliceVideoDecoder::ClearPendingRequests(DecodeStatus status) {
DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
DVLOGF(3);
if (avd_)
avd_->Reset();
// Clear output_request_queue_.
while (!output_request_queue_.empty())
output_request_queue_.pop();
......@@ -601,7 +598,12 @@ void V4L2SliceVideoDecoder::Decode(scoped_refptr<DecoderBuffer> buffer,
void V4L2SliceVideoDecoder::EnqueueDecodeTask(DecodeRequest request) {
DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
DCHECK(state_ == State::kDecoding || state_ == State::kFlushing);
DCHECK_NE(state_, State::kUninitialized);
if (state_ == State::kError) {
std::move(request.decode_cb).Run(DecodeStatus::DECODE_ERROR);
return;
}
if (!request.buffer->end_of_stream()) {
bitstream_id_to_timestamp_.Put(request.bitstream_id,
......@@ -615,11 +617,10 @@ void V4L2SliceVideoDecoder::EnqueueDecodeTask(DecodeRequest request) {
void V4L2SliceVideoDecoder::PumpDecodeTask() {
DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
DCHECK(state_ == State::kDecoding || state_ == State::kFlushing);
DVLOGF(3) << "state_:" << static_cast<int>(state_)
<< " Number of Decode requests: " << decode_request_queue_.size();
if (state_ == State::kFlushing)
if (state_ != State::kDecoding)
return;
pause_reason_ = PauseReason::kNone;
......
......@@ -173,8 +173,8 @@ class MEDIA_GPU_EXPORT V4L2SliceVideoDecoder : public VideoDecoder,
void DestroyTask();
// Reset on decoder thread.
void ResetTask(base::OnceClosure closure);
// Clear all pending requests, and call all pending decode callback with
// |status| argument.
// Reset |avd_|, clear all pending requests, and call all pending decode
// callback with |status| argument.
void ClearPendingRequests(DecodeStatus status);
// Enqueue |request| to the pending decode request queue, and try to decode
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment