Commit 4ac08d1e authored by Miguel Casas's avatar Miguel Casas Committed by Commit Bot

Vaapi: remove debug var |num_frames_at_client_|

This CL removes the debug variable |num_frames_at_client_| since it's
always equal to the difference between pictures_.size() and
available_picture_buffers_.size().

Test: Checked in crosvideo and v_d_a_unittests that the values are ==.
Bug: 721674
Change-Id: I946192bde8368210c4b65cf0084c34ee86ea3e62
Reviewed-on: https://chromium-review.googlesource.com/c/1357554Reviewed-by: default avatarHirokazu Honda <hiroh@chromium.org>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#613089}
parent a315b328
...@@ -162,7 +162,6 @@ VaapiVideoDecodeAccelerator::VaapiVideoDecodeAccelerator( ...@@ -162,7 +162,6 @@ VaapiVideoDecodeAccelerator::VaapiVideoDecodeAccelerator(
decode_using_client_picture_buffers_(false), decode_using_client_picture_buffers_(false),
task_runner_(base::ThreadTaskRunnerHandle::Get()), task_runner_(base::ThreadTaskRunnerHandle::Get()),
decoder_thread_("VaapiDecoderThread"), decoder_thread_("VaapiDecoderThread"),
num_frames_at_client_(0),
finish_flush_pending_(false), finish_flush_pending_(false),
awaiting_va_surfaces_recycle_(false), awaiting_va_surfaces_recycle_(false),
requested_num_pics_(0), requested_num_pics_(0),
...@@ -273,19 +272,21 @@ void VaapiVideoDecodeAccelerator::OutputPicture( ...@@ -273,19 +272,21 @@ void VaapiVideoDecodeAccelerator::OutputPicture(
"Failed putting surface into pixmap", "Failed putting surface into pixmap",
PLATFORM_FAILURE, ); PLATFORM_FAILURE, );
} }
// Notify the client a picture is ready to be displayed.
++num_frames_at_client_;
TRACE_COUNTER_ID2("media,gpu", "Vaapi frames at client", this, "used", TRACE_COUNTER_ID2("media,gpu", "Vaapi frames at client", this, "used",
num_frames_at_client_, "available", pictures_.size() - available_picture_buffers_.size(),
pictures_.size() - num_frames_at_client_); "available", available_picture_buffers_.size());
DVLOGF(4) << "Notifying output picture id " << output_id << " for input " DVLOGF(4) << "Notifying output picture id " << output_id << " for input "
<< input_id << input_id
<< " is ready. visible rect: " << visible_rect.ToString(); << " is ready. visible rect: " << visible_rect.ToString();
if (client_) { if (!client_)
client_->PictureReady(Picture(output_id, input_id, visible_rect, return;
picture_color_space.ToGfxColorSpace(),
picture->AllowOverlay())); // Notify the |client_| a picture is ready to be consumed.
} client_->PictureReady(Picture(output_id, input_id, visible_rect,
picture_color_space.ToGfxColorSpace(),
picture->AllowOverlay()));
} }
void VaapiVideoDecodeAccelerator::TryOutputPicture() { void VaapiVideoDecodeAccelerator::TryOutputPicture() {
...@@ -540,7 +541,6 @@ void VaapiVideoDecodeAccelerator::TryFinishSurfaceSetChange() { ...@@ -540,7 +541,6 @@ void VaapiVideoDecodeAccelerator::TryFinishSurfaceSetChange() {
client_->DismissPictureBuffer(iter->first); client_->DismissPictureBuffer(iter->first);
} }
pictures_.clear(); pictures_.clear();
num_frames_at_client_ = 0;
// And ask for a new set as requested. // And ask for a new set as requested.
VLOGF(2) << "Requesting " << requested_num_pics_ VLOGF(2) << "Requesting " << requested_num_pics_
...@@ -653,8 +653,7 @@ void VaapiVideoDecodeAccelerator::AssignPictureBuffers( ...@@ -653,8 +653,7 @@ void VaapiVideoDecodeAccelerator::AssignPictureBuffers(
} }
DCHECK_EQ(va_surface_ids.size(), buffers.size()); DCHECK_EQ(va_surface_ids.size(), buffers.size());
for (const auto id : va_surface_ids) available_va_surfaces_.assign(va_surface_ids.begin(), va_surface_ids.end());
available_va_surfaces_.push_back(id);
// Resume DecodeTask if it is still in decoding state. // Resume DecodeTask if it is still in decoding state.
if (state_ == kDecoding) { if (state_ == kDecoding) {
...@@ -723,14 +722,15 @@ void VaapiVideoDecodeAccelerator::ReusePictureBuffer( ...@@ -723,14 +722,15 @@ void VaapiVideoDecodeAccelerator::ReusePictureBuffer(
return; return;
} }
--num_frames_at_client_;
TRACE_COUNTER_ID2("media,gpu", "Vaapi frames at client", this, "used",
num_frames_at_client_, "available",
pictures_.size() - num_frames_at_client_);
{ {
base::AutoLock auto_lock(lock_); base::AutoLock auto_lock(lock_);
available_picture_buffers_.push_back(picture_buffer_id); available_picture_buffers_.push_back(picture_buffer_id);
} }
TRACE_COUNTER_ID2("media,gpu", "Vaapi frames at client", this, "used",
pictures_.size() - available_picture_buffers_.size(),
"available", available_picture_buffers_.size());
TryOutputPicture(); TryOutputPicture();
} }
......
...@@ -206,10 +206,6 @@ class MEDIA_GPU_EXPORT VaapiVideoDecodeAccelerator ...@@ -206,10 +206,6 @@ class MEDIA_GPU_EXPORT VaapiVideoDecodeAccelerator
// Current input buffer at decoder. // Current input buffer at decoder.
std::unique_ptr<InputBuffer> curr_input_buffer_; std::unique_ptr<InputBuffer> curr_input_buffer_;
// List of PictureBuffer ids available to be sent to |client_| via
// OutputPicture() (|client_| returns them via ReusePictureBuffer()).
std::list<int32_t> available_picture_buffers_;
std::unique_ptr<VaapiPictureFactory> vaapi_picture_factory_; std::unique_ptr<VaapiPictureFactory> vaapi_picture_factory_;
// Constructed in Initialize() when the codec information is received. // Constructed in Initialize() when the codec information is received.
...@@ -221,6 +217,9 @@ class MEDIA_GPU_EXPORT VaapiVideoDecodeAccelerator ...@@ -221,6 +217,9 @@ class MEDIA_GPU_EXPORT VaapiVideoDecodeAccelerator
// TryFinishSurfaceSetChange(). Comes after |vaapi_wrapper_| to ensure all // TryFinishSurfaceSetChange(). Comes after |vaapi_wrapper_| to ensure all
// pictures are destroyed before this is destroyed. // pictures are destroyed before this is destroyed.
base::small_map<std::map<int32_t, std::unique_ptr<VaapiPicture>>> pictures_; base::small_map<std::map<int32_t, std::unique_ptr<VaapiPicture>>> pictures_;
// List of PictureBuffer ids available to be sent to |client_| via
// OutputPicture() (|client_| returns them via ReusePictureBuffer()).
std::list<int32_t> available_picture_buffers_;
// VASurfaceIDs no longer in use that can be passed back to |decoder_| for // VASurfaceIDs no longer in use that can be passed back to |decoder_| for
// reuse, once it requests them. // reuse, once it requests them.
...@@ -267,8 +266,6 @@ class MEDIA_GPU_EXPORT VaapiVideoDecodeAccelerator ...@@ -267,8 +266,6 @@ class MEDIA_GPU_EXPORT VaapiVideoDecodeAccelerator
// |decoder_thread_.Stop()| returns. // |decoder_thread_.Stop()| returns.
scoped_refptr<base::SingleThreadTaskRunner> decoder_thread_task_runner_; scoped_refptr<base::SingleThreadTaskRunner> decoder_thread_task_runner_;
int num_frames_at_client_;
// Whether we are waiting for any pending_output_cbs_ to be run before // Whether we are waiting for any pending_output_cbs_ to be run before
// NotifyingFlushDone. // NotifyingFlushDone.
bool finish_flush_pending_; bool finish_flush_pending_;
......
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