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

Unified Diff: media/filters/video_renderer_base_unittest.cc

Issue 10248002: Report VideoDecoder status through ReadCB instead of through FilterHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename VideoDecoder::Status to VideoDecoder::DecoderStatus since Status has been polluted by Xlib.h. 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 b7be329bed8f7b8a9b2e52cf69e3e3073a44911e..e7c3f0c4db33ba3fe4b0b7d294bd876743e8637f 100644
--- a/media/filters/video_renderer_base_unittest.cc
+++ b/media/filters/video_renderer_base_unittest.cc
@@ -131,7 +131,7 @@ class VideoRendererBaseTest : public ::testing::Test {
VideoDecoder::ReadCB read_cb(queued_read_cb_);
queued_read_cb_.Reset();
base::AutoUnlock u(lock_);
- read_cb.Run(VideoFrame::CreateEmptyFrame());
+ read_cb.Run(VideoDecoder::kOk, VideoFrame::CreateEmptyFrame());
}
void StartSeeking(int64 timestamp) {
@@ -192,27 +192,36 @@ class VideoRendererBaseTest : public ::testing::Test {
VideoDecoder::ReadCB read_cb;
{
base::AutoLock l(lock_);
- CHECK(!read_cb_.is_null()) << "Can't deliver a frame without a callback";
std::swap(read_cb, read_cb_);
}
if (timestamp == kEndOfStream) {
- read_cb.Run(VideoFrame::CreateEmptyFrame());
+ read_cb.Run(VideoDecoder::kOk, VideoFrame::CreateEmptyFrame());
} else {
- read_cb.Run(CreateFrame(timestamp, kFrameDuration));
+ read_cb.Run(VideoDecoder::kOk, CreateFrame(timestamp, kFrameDuration));
}
}
+ void DecoderError() {
+ // Lock+swap to avoid re-entrancy issues.
+ VideoDecoder::ReadCB read_cb;
+ {
+ base::AutoLock l(lock_);
+ std::swap(read_cb, read_cb_);
+ }
+
+ read_cb.Run(VideoDecoder::kDecodeError, NULL);
+ }
+
void AbortRead() {
// Lock+swap to avoid re-entrancy issues.
VideoDecoder::ReadCB read_cb;
{
base::AutoLock l(lock_);
- CHECK(!read_cb_.is_null()) << "Can't deliver a frame without a callback";
std::swap(read_cb, read_cb_);
}
- read_cb.Run(NULL);
+ read_cb.Run(VideoDecoder::kOk, NULL);
}
void ExpectCurrentFrame(bool present) {
@@ -335,7 +344,7 @@ class VideoRendererBaseTest : public ::testing::Test {
// Abort pending read.
if (!read_cb.is_null())
- read_cb.Run(NULL);
+ read_cb.Run(VideoDecoder::kOk, NULL);
callback.Run();
}
@@ -364,9 +373,10 @@ class VideoRendererBaseTest : public ::testing::Test {
// Unlock to deliver the frame to avoid re-entrancy issues.
base::AutoUnlock ul(lock_);
if (timestamp == kEndOfStream) {
- read_cb.Run(VideoFrame::CreateEmptyFrame());
+ read_cb.Run(VideoDecoder::kOk, VideoFrame::CreateEmptyFrame());
} else {
- read_cb.Run(CreateFrame(i * kFrameDuration, kFrameDuration));
+ read_cb.Run(VideoDecoder::kOk,
+ CreateFrame(i * kFrameDuration, kFrameDuration));
i++;
}
} else {
@@ -444,6 +454,15 @@ TEST_F(VideoRendererBaseTest, EndOfStream) {
Shutdown();
}
+TEST_F(VideoRendererBaseTest, DecoderError) {
+ Initialize();
+ Play();
+ RenderFrame(kFrameDuration);
+ EXPECT_CALL(host_, SetError(PIPELINE_ERROR_DECODE));
+ DecoderError();
+ Shutdown();
+}
+
TEST_F(VideoRendererBaseTest, Seek_Exact) {
Initialize();
Pause();
« 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