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

Unified Diff: media/filters/video_renderer_base_unittest.cc

Issue 10173012: Fix VideoRendererBase to allow the decoder to be flushed with a pending read. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor fixes based on comments. Created 8 years, 8 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_renderer_base.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/video_renderer_base_unittest.cc
diff --git a/media/filters/video_renderer_base_unittest.cc b/media/filters/video_renderer_base_unittest.cc
index c5507a47df58334c5acb7662d5baad09820fdfd0..b7be329bed8f7b8a9b2e52cf69e3e3073a44911e 100644
--- a/media/filters/video_renderer_base_unittest.cc
+++ b/media/filters/video_renderer_base_unittest.cc
@@ -98,6 +98,9 @@ class VideoRendererBaseTest : public ::testing::Test {
EXPECT_CALL(*decoder_, Read(_))
.WillRepeatedly(Invoke(this, &VideoRendererBaseTest::FrameRequested));
+ EXPECT_CALL(*decoder_, Flush(_))
+ .WillRepeatedly(Invoke(this, &VideoRendererBaseTest::FlushRequested));
+
InSequence s;
// We expect the video size to be set.
@@ -322,6 +325,21 @@ class VideoRendererBaseTest : public ::testing::Test {
cv_.Signal();
}
+ void FlushRequested(const base::Closure& callback) {
+ // Lock+swap to avoid re-entrancy issues.
+ VideoDecoder::ReadCB read_cb;
+ {
+ base::AutoLock l(lock_);
+ std::swap(read_cb, read_cb_);
+ }
+
+ // Abort pending read.
+ if (!read_cb.is_null())
+ read_cb.Run(NULL);
+
+ callback.Run();
+ }
+
void OnSeekComplete(PipelineStatus expected_status, PipelineStatus status) {
base::AutoLock l(lock_);
EXPECT_EQ(status, expected_status);
@@ -579,9 +597,7 @@ TEST_F(VideoRendererBaseTest, AbortPendingRead_Flush) {
RenderFrame(kFrameDuration);
Pause();
- renderer_->Flush(NewWaitableClosure());
- AbortRead();
- WaitForClosure();
+ Flush();
Shutdown();
}
« no previous file with comments | « media/filters/video_renderer_base.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698