diff --git a/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.cc b/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.cc index 50d48c832121ba..4e83f33ba69a0e 100644 --- a/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.cc +++ b/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.cc @@ -426,12 +426,16 @@ bool V4L2StatelessVideoDecoderBackend::PumpDecodeTask() { profile_ = decoder_->GetProfile(); } - if (pic_size_ == decoder_->GetPicSize()) { + if (pic_size_ == decoder_->GetPicSize() && + bit_depth_ == decoder_->GetBitDepth() && + chroma_sampling_ == decoder_->GetChromaSampling()) { // There is no need to do anything in V4L2 API when only a profile is // changed. DVLOGF(3) << "Only profile is changed. No need to do anything."; continue; } + bit_depth_ = decoder_->GetBitDepth(); + chroma_sampling_ = decoder_->GetChromaSampling(); DVLOGF(3) << "Need to change resolution. Pause decoding."; client_->InitiateFlush(); diff --git a/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h b/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h index 2932bdccc9bf53..327b97bbcd495f 100644 --- a/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h +++ b/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h @@ -17,6 +17,7 @@ #include "media/base/cdm_context.h" #include "media/base/decoder_status.h" #include "media/base/video_decoder.h" +#include "media/base/video_types.h" #include "media/gpu/chromeos/dmabuf_video_frame_pool.h" #include "media/gpu/v4l2/v4l2_decode_surface_handler.h" #include "media/gpu/v4l2/v4l2_video_decoder_backend.h" @@ -150,6 +151,14 @@ class V4L2StatelessVideoDecoderBackend : public V4L2VideoDecoderBackend, // Video coded size we are decoding. gfx::Size pic_size_; + // Bit depth and chroma sampling currently negotiated with the V4L2 CAPTURE + // queue. Tracked so that a mid-stream bit-depth-only change (e.g. AV1 Main + // 8-bit -> 10-bit at constant resolution) re-runs SetupOutputFormat() and + // re-allocates the DMA-BUF pool, rather than queueing a 10-bit per-request + // control against an NV12-sized CAPTURE buffer. + uint8_t bit_depth_ = 0; + VideoChromaSampling chroma_sampling_ = VideoChromaSampling::kUnknown; + // Video decoder used to parse stream headers by software. std::unique_ptr decoder_;