Commit 7b38a1f6 authored by Alexandre Courbot's avatar Alexandre Courbot Committed by Commit Bot

media/gpu/vdatest: manage zero-fps case in RenderingHelper

Make RenderingHelper::QueueVideoFrame() behave properly in the case that
the requested fps is 0. This allows us to drop a GLRenderingVDAClient
parameter and simplify the logic of the vdatest a bit.

BUG=819542
TEST=Verified that vdatest was still passing on eve, hana and kevin

Change-Id: I500a693d9834cc3791ff5213bfd8e7cc0cc92bbe
Reviewed-on: https://chromium-review.googlesource.com/954769Reviewed-by: default avatarWu-Cheng Li <wuchengli@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543979}
parent c18fe8a6
...@@ -364,6 +364,11 @@ void RenderingHelper::QueueVideoFrame( ...@@ -364,6 +364,11 @@ void RenderingHelper::QueueVideoFrame(
RenderedVideo* video = &videos_[window_id]; RenderedVideo* video = &videos_[window_id];
DCHECK(!video->is_flushing); DCHECK(!video->is_flushing);
// If running at zero fps, return immediately. This will give the frame
// back to the client once it drops its reference to video_frame.
if (frame_duration_.is_zero())
return;
video->pending_frames.push(video_frame); video->pending_frames.push(video_frame);
if (video->frames_to_drop > 0 && video->pending_frames.size() > 1) { if (video->frames_to_drop > 0 && video->pending_frames.size() > 1) {
......
...@@ -55,7 +55,8 @@ struct RenderingHelperParams { ...@@ -55,7 +55,8 @@ struct RenderingHelperParams {
RenderingHelperParams(const RenderingHelperParams& other); RenderingHelperParams(const RenderingHelperParams& other);
~RenderingHelperParams(); ~RenderingHelperParams();
// The rendering FPS. // The target rendering FPS. A value of 0 makes the RenderingHelper return
// frames immediately.
int rendering_fps; int rendering_fps;
// The number of windows. We play each stream in its own window // The number of windows. We play each stream in its own window
......
...@@ -400,7 +400,6 @@ class GLRenderingVDAClient ...@@ -400,7 +400,6 @@ class GLRenderingVDAClient
// calls have been made, N>=0 means interpret as ClientState. // calls have been made, N>=0 means interpret as ClientState.
// Both |reset_after_frame_num| & |delete_decoder_state| apply only to the // Both |reset_after_frame_num| & |delete_decoder_state| apply only to the
// last play-through (governed by |num_play_throughs|). // last play-through (governed by |num_play_throughs|).
// |suppress_rendering| indicates GL rendering is supressed or not.
// After |delay_reuse_after_frame_num| frame has been delivered, the client // After |delay_reuse_after_frame_num| frame has been delivered, the client
// will start delaying the call to ReusePictureBuffer() for kReuseDelay. // will start delaying the call to ReusePictureBuffer() for kReuseDelay.
// |decode_calls_per_second| is the number of VDA::Decode calls per second. // |decode_calls_per_second| is the number of VDA::Decode calls per second.
...@@ -417,7 +416,6 @@ class GLRenderingVDAClient ...@@ -417,7 +416,6 @@ class GLRenderingVDAClient
int frame_height, int frame_height,
VideoCodecProfile profile, VideoCodecProfile profile,
int fake_decoder, int fake_decoder,
bool suppress_rendering,
int delay_reuse_after_frame_num, int delay_reuse_after_frame_num,
int decode_calls_per_second, int decode_calls_per_second,
bool render_as_thumbnails); bool render_as_thumbnails);
...@@ -505,7 +503,6 @@ class GLRenderingVDAClient ...@@ -505,7 +503,6 @@ class GLRenderingVDAClient
int fake_decoder_; int fake_decoder_;
GLenum texture_target_; GLenum texture_target_;
VideoPixelFormat pixel_format_; VideoPixelFormat pixel_format_;
bool suppress_rendering_;
std::vector<base::TimeTicks> frame_delivery_times_; std::vector<base::TimeTicks> frame_delivery_times_;
int delay_reuse_after_frame_num_; int delay_reuse_after_frame_num_;
// A map from bitstream buffer id to the decode start time of the buffer. // A map from bitstream buffer id to the decode start time of the buffer.
...@@ -556,7 +553,6 @@ GLRenderingVDAClient::GLRenderingVDAClient( ...@@ -556,7 +553,6 @@ GLRenderingVDAClient::GLRenderingVDAClient(
int frame_height, int frame_height,
VideoCodecProfile profile, VideoCodecProfile profile,
int fake_decoder, int fake_decoder,
bool suppress_rendering,
int delay_reuse_after_frame_num, int delay_reuse_after_frame_num,
int decode_calls_per_second, int decode_calls_per_second,
bool render_as_thumbnails) bool render_as_thumbnails)
...@@ -580,7 +576,6 @@ GLRenderingVDAClient::GLRenderingVDAClient( ...@@ -580,7 +576,6 @@ GLRenderingVDAClient::GLRenderingVDAClient(
fake_decoder_(fake_decoder), fake_decoder_(fake_decoder),
texture_target_(0), texture_target_(0),
pixel_format_(PIXEL_FORMAT_UNKNOWN), pixel_format_(PIXEL_FORMAT_UNKNOWN),
suppress_rendering_(suppress_rendering),
delay_reuse_after_frame_num_(delay_reuse_after_frame_num), delay_reuse_after_frame_num_(delay_reuse_after_frame_num),
decode_calls_per_second_(decode_calls_per_second), decode_calls_per_second_(decode_calls_per_second),
render_as_thumbnails_(render_as_thumbnails), render_as_thumbnails_(render_as_thumbnails),
...@@ -766,7 +761,7 @@ void GLRenderingVDAClient::PictureReady(const Picture& picture) { ...@@ -766,7 +761,7 @@ void GLRenderingVDAClient::PictureReady(const Picture& picture) {
if (render_as_thumbnails_) { if (render_as_thumbnails_) {
rendering_helper_->RenderThumbnail(video_frame->texture_target(), rendering_helper_->RenderThumbnail(video_frame->texture_target(),
video_frame->texture_id()); video_frame->texture_id());
} else if (!suppress_rendering_) { } else {
rendering_helper_->QueueVideoFrame(window_id_, video_frame); rendering_helper_->QueueVideoFrame(window_id_, video_frame);
} }
} }
...@@ -1357,9 +1352,6 @@ TEST_P(VideoDecodeAcceleratorParamTest, TestSimpleDecode) { ...@@ -1357,9 +1352,6 @@ TEST_P(VideoDecodeAcceleratorParamTest, TestSimpleDecode) {
UpdateTestVideoFileParams(num_concurrent_decoders, reset_point, UpdateTestVideoFileParams(num_concurrent_decoders, reset_point,
&test_video_files_); &test_video_files_);
// Suppress GL rendering for all tests when the "--rendering_fps" is 0.
const bool suppress_rendering = g_rendering_fps == 0;
notes_.resize(num_concurrent_decoders); notes_.resize(num_concurrent_decoders);
clients_.resize(num_concurrent_decoders); clients_.resize(num_concurrent_decoders);
...@@ -1394,8 +1386,7 @@ TEST_P(VideoDecodeAcceleratorParamTest, TestSimpleDecode) { ...@@ -1394,8 +1386,7 @@ TEST_P(VideoDecodeAcceleratorParamTest, TestSimpleDecode) {
video_file->data_str, num_in_flight_decodes, num_play_throughs, video_file->data_str, num_in_flight_decodes, num_play_throughs,
video_file->reset_after_frame_num, delete_decoder_state, video_file->reset_after_frame_num, delete_decoder_state,
video_file->width, video_file->height, video_file->profile, video_file->width, video_file->height, video_file->profile,
g_fake_decoder, suppress_rendering, delay_after_frame_num, 0, g_fake_decoder, delay_after_frame_num, 0, render_as_thumbnails);
render_as_thumbnails);
clients_[index] = std::move(client); clients_[index] = std::move(client);
} }
...@@ -1474,8 +1465,8 @@ TEST_P(VideoDecodeAcceleratorParamTest, TestSimpleDecode) { ...@@ -1474,8 +1465,8 @@ TEST_P(VideoDecodeAcceleratorParamTest, TestSimpleDecode) {
} }
LOG(INFO) << "Decoder " << i << " fps: " << client->frames_per_second(); LOG(INFO) << "Decoder " << i << " fps: " << client->frames_per_second();
if (!render_as_thumbnails) { if (!render_as_thumbnails) {
int min_fps = suppress_rendering ? video_file->min_fps_no_render int min_fps = g_rendering_fps == 0 ? video_file->min_fps_no_render
: video_file->min_fps_render; : video_file->min_fps_render;
if (min_fps > 0 && !test_reuse_delay) if (min_fps > 0 && !test_reuse_delay)
EXPECT_GT(client->frames_per_second(), min_fps); EXPECT_GT(client->frames_per_second(), min_fps);
} }
...@@ -1738,7 +1729,7 @@ TEST_F(VideoDecodeAcceleratorTest, TestDecodeTimeMedian) { ...@@ -1738,7 +1729,7 @@ TEST_F(VideoDecodeAcceleratorTest, TestDecodeTimeMedian) {
0, &rendering_helper_, notes_[0].get(), test_video_files_[0]->data_str, 1, 0, &rendering_helper_, notes_[0].get(), test_video_files_[0]->data_str, 1,
1, test_video_files_[0]->reset_after_frame_num, CS_RESET, 1, test_video_files_[0]->reset_after_frame_num, CS_RESET,
test_video_files_[0]->width, test_video_files_[0]->height, test_video_files_[0]->width, test_video_files_[0]->height,
test_video_files_[0]->profile, g_fake_decoder, true, test_video_files_[0]->profile, g_fake_decoder,
std::numeric_limits<int>::max(), kWebRtcDecodeCallsPerSecond, false)); std::numeric_limits<int>::max(), kWebRtcDecodeCallsPerSecond, false));
RenderingHelperParams helper_params; RenderingHelperParams helper_params;
helper_params.num_windows = 1; helper_params.num_windows = 1;
...@@ -1766,7 +1757,7 @@ TEST_F(VideoDecodeAcceleratorTest, NoCrash) { ...@@ -1766,7 +1757,7 @@ TEST_F(VideoDecodeAcceleratorTest, NoCrash) {
0, &rendering_helper_, notes_[0].get(), test_video_files_[0]->data_str, 1, 0, &rendering_helper_, notes_[0].get(), test_video_files_[0]->data_str, 1,
1, test_video_files_[0]->reset_after_frame_num, CS_RESET, 1, test_video_files_[0]->reset_after_frame_num, CS_RESET,
test_video_files_[0]->width, test_video_files_[0]->height, test_video_files_[0]->width, test_video_files_[0]->height,
test_video_files_[0]->profile, g_fake_decoder, true, test_video_files_[0]->profile, g_fake_decoder,
std::numeric_limits<int>::max(), 0, false)); std::numeric_limits<int>::max(), 0, false));
RenderingHelperParams helper_params; RenderingHelperParams helper_params;
helper_params.num_windows = 1; helper_params.num_windows = 1;
......
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