Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1214)

Unified Diff: media/filters/video_renderer_impl_unittest.cc

Issue 339653003: No EOS frame in {Audio|Video}Decoder::OutputCB. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase only Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/video_frame_stream_unittest.cc ('k') | media/filters/vpx_video_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/video_renderer_impl_unittest.cc
diff --git a/media/filters/video_renderer_impl_unittest.cc b/media/filters/video_renderer_impl_unittest.cc
index 6bf6ca1a5886acd52bf9a2668eedab44f1978275..355d8751741f82e7937efce893a167239c94e1e4 100644
--- a/media/filters/video_renderer_impl_unittest.cc
+++ b/media/filters/video_renderer_impl_unittest.cc
@@ -174,10 +174,9 @@ class VideoRendererImplTest : public ::testing::Test {
// nn - Queue a decoder buffer with timestamp nn * 1000us
// abort - Queue an aborted read
// error - Queue a decoder error
- // eos - Queue an end of stream decoder buffer
//
// Examples:
- // A clip that is four frames long: "0 10 20 30 eos"
+ // A clip that is four frames long: "0 10 20 30"
// A clip that has a decode error: "60 70 error"
void QueueFrames(const std::string& str) {
std::vector<std::string> tokens;
@@ -197,12 +196,6 @@ class VideoRendererImplTest : public ::testing::Test {
continue;
}
- if (tokens[i] == "eos") {
- decode_results_.push_back(
- std::make_pair(VideoDecoder::kOk, VideoFrame::CreateEOSFrame()));
- continue;
- }
-
int timestamp_in_ms = 0;
if (base::StringToInt(tokens[i], &timestamp_in_ms)) {
gfx::Size natural_size = TestVideoConfig::NormalCodedSize();
@@ -263,6 +256,26 @@ class VideoRendererImplTest : public ::testing::Test {
decode_results_.pop_front();
}
+ void SatisfyPendingReadWithEndOfStream() {
+ DCHECK(!decode_cb_.is_null());
+
+ // Return EOS buffer to trigger EOS frame.
+ EXPECT_CALL(demuxer_stream_, Read(_))
+ .WillOnce(RunCallback<0>(DemuxerStream::kOk,
+ DecoderBuffer::CreateEOSBuffer()));
+
+ // Satify pending |decode_cb_| to trigger a new DemuxerStream::Read().
+ message_loop_.PostTask(
+ FROM_HERE,
+ base::Bind(base::ResetAndReturn(&decode_cb_), VideoDecoder::kOk));
+
+ WaitForPendingRead();
+
+ message_loop_.PostTask(
+ FROM_HERE,
+ base::Bind(base::ResetAndReturn(&decode_cb_), VideoDecoder::kOk));
+ }
+
void AdvanceTimeInMs(int time_ms) {
DCHECK_EQ(&message_loop_, base::MessageLoop::current());
base::AutoLock l(lock_);
@@ -414,10 +427,12 @@ TEST_F(VideoRendererImplTest, EndOfStream_ClipDuration) {
// Next frame has timestamp way past duration. Its timestamp will be adjusted
// to match the duration of the video.
QueueFrames(base::IntToString(kVideoDurationInMs + 1000));
+ SatisfyPendingRead();
+ WaitForPendingRead();
// Queue the end of stream frame and wait for the last frame to be rendered.
- QueueFrames("eos");
- SatisfyPendingRead();
+ SatisfyPendingReadWithEndOfStream();
+
EXPECT_CALL(mock_display_cb_, Display(HasTimestamp(kVideoDurationInMs)));
AdvanceTimeInMs(kVideoDurationInMs);
WaitForEnded();
« no previous file with comments | « media/filters/video_frame_stream_unittest.cc ('k') | media/filters/vpx_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698