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

Unified Diff: content/renderer/media_recorder/video_track_recorder_unittest.cc

Issue 2804843002: Handle HW encoder errors in VideoTrackRecorder (Closed)
Patch Set: Created 3 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
Index: content/renderer/media_recorder/video_track_recorder_unittest.cc
diff --git a/content/renderer/media_recorder/video_track_recorder_unittest.cc b/content/renderer/media_recorder/video_track_recorder_unittest.cc
index d10defbb62ec93a0681b8dd9d8582e977a7092b9..d764fe6bf51197ab50897bbcdb6499c0caad6c52 100644
--- a/content/renderer/media_recorder/video_track_recorder_unittest.cc
+++ b/content/renderer/media_recorder/video_track_recorder_unittest.cc
@@ -119,6 +119,8 @@ class VideoTrackRecorderTest
video_track_recorder_->OnVideoFrameForTesting(frame, capture_time);
}
+ void OnError() { video_track_recorder_->OnError(true); }
+
bool CanEncodeAlphaChannel() {
return video_track_recorder_->CanEncodeAlphaChannelForTesting();
}
@@ -292,6 +294,32 @@ TEST_F(VideoTrackRecorderTest, ForceKeyframeOnAlphaSwitch) {
Mock::VerifyAndClearExpectations(this);
}
+// Inserts an OnError() call between sent frames.
+TEST_F(VideoTrackRecorderTest, HandlesOnError) {
+ InitializeRecorder(VideoTrackRecorder::CodecId::VP8);
+
+ const gfx::Size& frame_size = kTrackRecorderTestSize[0];
+ const scoped_refptr<VideoFrame> video_frame =
+ VideoFrame::CreateBlackFrame(frame_size);
+
+ InSequence s;
+ EXPECT_CALL(*this, DoOnEncodedVideo(_, _, _, _, true)).Times(1);
+ Encode(video_frame, base::TimeTicks::Now());
+
+ // Insert OnError() call.
+ OnError();
+
+ base::RunLoop run_loop;
+ base::Closure quit_closure = run_loop.QuitClosure();
+ EXPECT_CALL(*this, DoOnEncodedVideo(_, _, _, _, true))
+ .Times(1)
+ .WillOnce(RunClosure(quit_closure));
+ Encode(video_frame, base::TimeTicks::Now());
+ run_loop.Run();
+
+ Mock::VerifyAndClearExpectations(this);
+}
+
INSTANTIATE_TEST_CASE_P(,
VideoTrackRecorderTest,
::testing::Combine(ValuesIn(kTrackRecorderTestCodec),

Powered by Google App Engine
This is Rietveld 408576698