Commit 54dca90f authored by Alexandre Courbot's avatar Alexandre Courbot Committed by Commit Bot

media/gpu/chromeos: rename OnPipelineFlushed() to ApplyResolutionChange()

OnPipelineFlushed() implied that this method would be called for all
pipeline flushed, while it is actually called only during resolution
changes, to apply the new resolution. Use a less confusing name.

BUG=978737
TEST=VDAtest --use_vd passes on Kukui.

Change-Id: I6bf93fd67bdb1316993a6df1d64284b527ba1be4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2143423
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: default avatarChih-Yu Huang <akahuang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758882}
parent 73240199
...@@ -319,7 +319,7 @@ void VideoDecoderPipeline::ResetTask(base::OnceClosure closure) { ...@@ -319,7 +319,7 @@ void VideoDecoderPipeline::ResetTask(base::OnceClosure closure) {
DCHECK(!client_reset_cb_); DCHECK(!client_reset_cb_);
DVLOGF(3); DVLOGF(3);
need_notify_decoder_flushed_ = false; need_apply_new_resolution = false;
client_reset_cb_ = std::move(closure); client_reset_cb_ = std::move(closure);
decoder_->Reset( decoder_->Reset(
base::BindOnce(&VideoDecoderPipeline::OnResetDone, decoder_weak_this_)); base::BindOnce(&VideoDecoderPipeline::OnResetDone, decoder_weak_this_));
...@@ -431,7 +431,7 @@ void VideoDecoderPipeline::OnFrameConverted(scoped_refptr<VideoFrame> frame) { ...@@ -431,7 +431,7 @@ void VideoDecoderPipeline::OnFrameConverted(scoped_refptr<VideoFrame> frame) {
// After outputting a frame, flush might be completed. // After outputting a frame, flush might be completed.
CallFlushCbIfNeeded(DecodeStatus::OK); CallFlushCbIfNeeded(DecodeStatus::OK);
CallOnPipelineFlushedIfNeeded(); CallApplyResolutionChangeIfNeeded();
} }
bool VideoDecoderPipeline::HasPendingFrames() const { bool VideoDecoderPipeline::HasPendingFrames() const {
...@@ -468,19 +468,19 @@ void VideoDecoderPipeline::CallFlushCbIfNeeded(DecodeStatus status) { ...@@ -468,19 +468,19 @@ void VideoDecoderPipeline::CallFlushCbIfNeeded(DecodeStatus status) {
void VideoDecoderPipeline::PrepareChangeResolution() { void VideoDecoderPipeline::PrepareChangeResolution() {
DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
DVLOGF(3); DVLOGF(3);
DCHECK(!need_notify_decoder_flushed_); DCHECK(!need_apply_new_resolution);
need_notify_decoder_flushed_ = true; need_apply_new_resolution = true;
CallOnPipelineFlushedIfNeeded(); CallApplyResolutionChangeIfNeeded();
} }
void VideoDecoderPipeline::CallOnPipelineFlushedIfNeeded() { void VideoDecoderPipeline::CallApplyResolutionChangeIfNeeded() {
DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
DVLOGF(3); DVLOGF(3);
if (need_notify_decoder_flushed_ && !HasPendingFrames()) { if (need_apply_new_resolution && !HasPendingFrames()) {
need_notify_decoder_flushed_ = false; need_apply_new_resolution = false;
decoder_->OnPipelineFlushed(); decoder_->ApplyResolutionChange();
} }
} }
......
...@@ -59,7 +59,7 @@ class MEDIA_GPU_EXPORT DecoderInterface { ...@@ -59,7 +59,7 @@ class MEDIA_GPU_EXPORT DecoderInterface {
virtual DmabufVideoFramePool* GetVideoFramePool() const = 0; virtual DmabufVideoFramePool* GetVideoFramePool() const = 0;
// After this method is called from |decoder_|, the client needs to call // After this method is called from |decoder_|, the client needs to call
// DecoderInterface::OnPipelineFlushed() when all pending frames are // DecoderInterface::ApplyResolutionChange() when all pending frames are
// flushed. // flushed.
virtual void PrepareChangeResolution() = 0; virtual void PrepareChangeResolution() = 0;
...@@ -114,7 +114,7 @@ class MEDIA_GPU_EXPORT DecoderInterface { ...@@ -114,7 +114,7 @@ class MEDIA_GPU_EXPORT DecoderInterface {
// After DecoderInterface calls |prepare_change_resolution_cb| passed // After DecoderInterface calls |prepare_change_resolution_cb| passed
// from the constructor, this method is called when the pipeline flushes // from the constructor, this method is called when the pipeline flushes
// pending frames. // pending frames.
virtual void OnPipelineFlushed() = 0; virtual void ApplyResolutionChange() = 0;
protected: protected:
// Decoder task runner. All public methods of // Decoder task runner. All public methods of
...@@ -217,8 +217,8 @@ class MEDIA_GPU_EXPORT VideoDecoderPipeline : public VideoDecoder, ...@@ -217,8 +217,8 @@ class MEDIA_GPU_EXPORT VideoDecoderPipeline : public VideoDecoder,
// i.e. |image_processor_| or |frame_converter_| has pending frames. // i.e. |image_processor_| or |frame_converter_| has pending frames.
bool HasPendingFrames() const; bool HasPendingFrames() const;
// Call DecoderInterface::OnPipelineFlushed() when we need to. // Call DecoderInterface::ApplyResolutionChange() when we need to.
void CallOnPipelineFlushedIfNeeded(); void CallApplyResolutionChangeIfNeeded();
// Call |client_flush_cb_| with |status|. // Call |client_flush_cb_| with |status|.
void CallFlushCbIfNeeded(DecodeStatus status); void CallFlushCbIfNeeded(DecodeStatus status);
...@@ -271,8 +271,8 @@ class MEDIA_GPU_EXPORT VideoDecoderPipeline : public VideoDecoder, ...@@ -271,8 +271,8 @@ class MEDIA_GPU_EXPORT VideoDecoderPipeline : public VideoDecoder,
base::OnceClosure client_reset_cb_; base::OnceClosure client_reset_cb_;
// True if we need to notify |decoder_| that the pipeline is flushed via // True if we need to notify |decoder_| that the pipeline is flushed via
// DecoderInterface::OnPipelineFlushed(). // DecoderInterface::ApplyResolutionChange().
bool need_notify_decoder_flushed_ = false; bool need_apply_new_resolution = false;
// True if the decoder needs bitstream conversion before decoding. // True if the decoder needs bitstream conversion before decoding.
bool needs_bitstream_conversion_ = false; bool needs_bitstream_conversion_ = false;
......
...@@ -425,7 +425,7 @@ void V4L2SliceVideoDecoder::ChangeResolution(gfx::Size pic_size, ...@@ -425,7 +425,7 @@ void V4L2SliceVideoDecoder::ChangeResolution(gfx::Size pic_size,
client_->PrepareChangeResolution(); client_->PrepareChangeResolution();
} }
void V4L2SliceVideoDecoder::OnPipelineFlushed() { void V4L2SliceVideoDecoder::ApplyResolutionChange() {
DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
DVLOGF(3); DVLOGF(3);
DCHECK(continue_change_resolution_cb_); DCHECK(continue_change_resolution_cb_);
......
...@@ -55,7 +55,7 @@ class MEDIA_GPU_EXPORT V4L2SliceVideoDecoder ...@@ -55,7 +55,7 @@ class MEDIA_GPU_EXPORT V4L2SliceVideoDecoder
const OutputCB& output_cb) override; const OutputCB& output_cb) override;
void Reset(base::OnceClosure closure) override; void Reset(base::OnceClosure closure) override;
void Decode(scoped_refptr<DecoderBuffer> buffer, DecodeCB decode_cb) override; void Decode(scoped_refptr<DecoderBuffer> buffer, DecodeCB decode_cb) override;
void OnPipelineFlushed() override; void ApplyResolutionChange() override;
// V4L2VideoDecoderBackend::Client implementation // V4L2VideoDecoderBackend::Client implementation
void OnBackendError() override; void OnBackendError() override;
......
...@@ -240,7 +240,7 @@ void VaapiVideoDecoder::HandleDecodeTask() { ...@@ -240,7 +240,7 @@ void VaapiVideoDecoder::HandleDecodeTask() {
case AcceleratedVideoDecoder::kConfigChange: case AcceleratedVideoDecoder::kConfigChange:
// A new set of output buffers is requested. We either didn't have any // A new set of output buffers is requested. We either didn't have any
// output buffers yet or encountered a resolution change. // output buffers yet or encountered a resolution change.
// After the pipeline flushes all frames, OnPipelineFlushed() will be // After the pipeline flushes all frames, ApplyResolutionChange() will be
// called and we can start changing resolution. // called and we can start changing resolution.
DCHECK(client_); DCHECK(client_);
SetState(State::kChangingResolution); SetState(State::kChangingResolution);
...@@ -392,7 +392,7 @@ void VaapiVideoDecoder::OutputFrameTask(scoped_refptr<VideoFrame> video_frame, ...@@ -392,7 +392,7 @@ void VaapiVideoDecoder::OutputFrameTask(scoped_refptr<VideoFrame> video_frame,
output_cb_.Run(std::move(video_frame)); output_cb_.Run(std::move(video_frame));
} }
void VaapiVideoDecoder::OnPipelineFlushed() { void VaapiVideoDecoder::ApplyResolutionChange() {
DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
DCHECK(state_ == State::kChangingResolution || DCHECK(state_ == State::kChangingResolution ||
state_ == State::kWaitingForInput); state_ == State::kWaitingForInput);
......
...@@ -54,7 +54,7 @@ class VaapiVideoDecoder : public DecoderInterface, ...@@ -54,7 +54,7 @@ class VaapiVideoDecoder : public DecoderInterface,
const OutputCB& output_cb) override; const OutputCB& output_cb) override;
void Decode(scoped_refptr<DecoderBuffer> buffer, DecodeCB decode_cb) override; void Decode(scoped_refptr<DecoderBuffer> buffer, DecodeCB decode_cb) override;
void Reset(base::OnceClosure reset_cb) override; void Reset(base::OnceClosure reset_cb) override;
void OnPipelineFlushed() override; void ApplyResolutionChange() override;
// DecodeSurfaceHandler<VASurface> implementation. // DecodeSurfaceHandler<VASurface> implementation.
scoped_refptr<VASurface> CreateSurface() override; scoped_refptr<VASurface> CreateSurface() override;
......
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