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

Unified Diff: content/renderer/media/media_stream_video_source_unittest.cc

Issue 332863002: Video Capture: Allow 0 fps frame rates to be deserializable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added passing 1 frame to MediaStreamVideoSourceTest.Use0FpsSupportedFormat 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 | « no previous file | media/video/capture/video_capture_types.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/media_stream_video_source_unittest.cc
diff --git a/content/renderer/media/media_stream_video_source_unittest.cc b/content/renderer/media/media_stream_video_source_unittest.cc
index 81e1626c47bac2c8b6d80b9eb71e52d6ea5e608d..d47fae5bdd605a26bc4beaf95fd09460a35b757a 100644
--- a/content/renderer/media/media_stream_video_source_unittest.cc
+++ b/content/renderer/media/media_stream_video_source_unittest.cc
@@ -662,4 +662,33 @@ TEST_F(MediaStreamVideoSourceTest, IsConstraintSupported) {
"something unsupported"));
}
+// Test that the constraint negotiation can handle 0.0 fps as frame rate.
+TEST_F(MediaStreamVideoSourceTest, Use0FpsSupportedFormat) {
+ media::VideoCaptureFormats formats;
+ formats.push_back(media::VideoCaptureFormat(
+ gfx::Size(640, 480), 0.0f, media::PIXEL_FORMAT_I420));
+ formats.push_back(media::VideoCaptureFormat(
+ gfx::Size(320, 240), 0.0f, media::PIXEL_FORMAT_I420));
+ mock_source()->SetSupportedFormats(formats);
+
+ blink::WebMediaConstraints constraints;
+ constraints.initialize();
+ blink::WebMediaStreamTrack track = CreateTrack("123", constraints);
+ mock_source()->CompleteGetSupportedFormats();
+ mock_source()->StartMockedSource();
+ EXPECT_EQ(1, NumberOfSuccessConstraintsCallbacks());
+
+ MockMediaStreamVideoSink sink;
+ MediaStreamVideoSink::AddToVideoTrack(
+ &sink, sink.GetDeliverFrameCB(), track);
+ EXPECT_EQ(0, sink.number_of_frames());
+ DeliverVideoFrameAndWaitForRenderer(320, 240, &sink);
+ EXPECT_EQ(1, sink.number_of_frames());
+ // Expect the delivered frame to be passed unchanged since its smaller than
+ // max requested.
+ EXPECT_EQ(320, sink.frame_size().width());
+ EXPECT_EQ(240, sink.frame_size().height());
+ MediaStreamVideoSink::RemoveFromVideoTrack(&sink, track);
+}
+
} // namespace content
« no previous file with comments | « no previous file | media/video/capture/video_capture_types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698