summaryrefslogtreecommitdiffstats
path: root/content/browser/renderer_host/media/video_capture_controller_unittest.cc
diff options
context:
space:
mode:
authormiu <miu@chromium.org>2016-03-25 17:57:21 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-26 00:58:38 +0000
commite4a406a55b1fb94080258f5801338ff63b8dcbed (patch)
treeb26b94aaf2d348cda45b193e9e79dcd97b7c5886 /content/browser/renderer_host/media/video_capture_controller_unittest.cc
parenta4581858f57e20724f9b8a3166ef9c864f79a758 (diff)
downloadchromium_src-e4a406a55b1fb94080258f5801338ff63b8dcbed.zip
chromium_src-e4a406a55b1fb94080258f5801338ff63b8dcbed.tar.gz
chromium_src-e4a406a55b1fb94080258f5801338ff63b8dcbed.tar.bz2
Add frame refresh to VideoCaptureDevice, and buffer pool resurrection.
This is the first in a series of changes to solve the problems related to VideoCaptureDevices that can pause (i.e., basically, screen capture devices). This introduces new optional-to-implement methods to the media::VideoCaptureDevice interface, and the supporting functionality in content::VideoCaptureBufferPool. This change should not result in any end-user-visible differences, as it is just laying the groundwork for future changes. For more details on the overall plan, please see the crbug. BUG=486274 Review URL: https://codereview.chromium.org/1826643003 Cr-Commit-Position: refs/heads/master@{#383426}
Diffstat (limited to 'content/browser/renderer_host/media/video_capture_controller_unittest.cc')
-rw-r--r--content/browser/renderer_host/media/video_capture_controller_unittest.cc40
1 files changed, 27 insertions, 13 deletions
diff --git a/content/browser/renderer_host/media/video_capture_controller_unittest.cc b/content/browser/renderer_host/media/video_capture_controller_unittest.cc
index 99e563f..cdd8c16 100644
--- a/content/browser/renderer_host/media/video_capture_controller_unittest.cc
+++ b/content/browser/renderer_host/media/video_capture_controller_unittest.cc
@@ -331,6 +331,7 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) {
base::RunLoop().RunUntilIdle();
Mock::VerifyAndClearExpectations(client_a_.get());
Mock::VerifyAndClearExpectations(client_b_.get());
+
// Expect VideoCaptureController set the metadata in |video_frame| to hold a
// resource utilization of 0.5 (the largest of all reported values).
double resource_utilization_in_metadata = -1.0;
@@ -359,15 +360,27 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) {
base::TimeTicks());
// The buffer should be delivered to the clients in any order.
- EXPECT_CALL(*client_a_,
- DoI420BufferReady(client_a_route_1, capture_resolution))
- .Times(1);
- EXPECT_CALL(*client_b_,
- DoI420BufferReady(client_b_route_1, capture_resolution))
- .Times(1);
- EXPECT_CALL(*client_a_,
- DoI420BufferReady(client_a_route_2, capture_resolution))
- .Times(1);
+ {
+ InSequence s;
+ EXPECT_CALL(*client_a_, DoBufferCreated(client_a_route_1)).Times(1);
+ EXPECT_CALL(*client_a_,
+ DoI420BufferReady(client_a_route_1, capture_resolution))
+ .Times(1);
+ }
+ {
+ InSequence s;
+ EXPECT_CALL(*client_b_, DoBufferCreated(client_b_route_1)).Times(1);
+ EXPECT_CALL(*client_b_,
+ DoI420BufferReady(client_b_route_1, capture_resolution))
+ .Times(1);
+ }
+ {
+ InSequence s;
+ EXPECT_CALL(*client_a_, DoBufferCreated(client_a_route_2)).Times(1);
+ EXPECT_CALL(*client_a_,
+ DoI420BufferReady(client_a_route_2, capture_resolution))
+ .Times(1);
+ }
base::RunLoop().RunUntilIdle();
Mock::VerifyAndClearExpectations(client_a_.get());
Mock::VerifyAndClearExpectations(client_b_.get());
@@ -407,23 +420,24 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) {
media::PIXEL_FORMAT_I420,
media::PIXEL_STORAGE_CPU).get());
- // The new client needs to be told of 3 buffers; the old clients only 2.
+ // The new client needs to be notified of the creation of |kPoolSize| buffers;
+ // the old clients only |kPoolSize - 2|.
EXPECT_CALL(*client_b_, DoBufferCreated(client_b_route_2)).Times(kPoolSize);
EXPECT_CALL(*client_b_,
DoI420BufferReady(client_b_route_2, capture_resolution))
.Times(kPoolSize);
EXPECT_CALL(*client_a_, DoBufferCreated(client_a_route_1))
- .Times(kPoolSize - 1);
+ .Times(kPoolSize - 2);
EXPECT_CALL(*client_a_,
DoI420BufferReady(client_a_route_1, capture_resolution))
.Times(kPoolSize);
EXPECT_CALL(*client_a_, DoBufferCreated(client_a_route_2))
- .Times(kPoolSize - 1);
+ .Times(kPoolSize - 2);
EXPECT_CALL(*client_a_,
DoI420BufferReady(client_a_route_2, capture_resolution))
.Times(kPoolSize);
EXPECT_CALL(*client_b_, DoBufferCreated(client_b_route_1))
- .Times(kPoolSize - 1);
+ .Times(kPoolSize - 2);
EXPECT_CALL(*client_b_,
DoI420BufferReady(client_b_route_1, capture_resolution))
.Times(kPoolSize);