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

Side by Side Diff: content/browser/media/capture/web_contents_video_capture_device_unittest.cc

Issue 2686763002: [Mojo Video Capture] Split OnIncomingCapturedVideoFrame() to OnNewBuffer() and OnFrameReadyInBuffer( (Closed)
Patch Set: rebase Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/media/video_capture_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/media/capture/web_contents_video_capture_device.h" 5 #include "content/browser/media/capture/web_contents_video_capture_device.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 gfx::Rect visible_rect, 277 gfx::Rect visible_rect,
278 const media::VideoFrameMetadata& additional_metadata) override { 278 const media::VideoFrameMetadata& additional_metadata) override {
279 EXPECT_FALSE(visible_rect.IsEmpty()); 279 EXPECT_FALSE(visible_rect.IsEmpty());
280 EXPECT_EQ(media::PIXEL_FORMAT_I420, format.pixel_format); 280 EXPECT_EQ(media::PIXEL_FORMAT_I420, format.pixel_format);
281 EXPECT_EQ(kTestFramesPerSecond, format.frame_rate); 281 EXPECT_EQ(kTestFramesPerSecond, format.frame_rate);
282 282
283 // TODO(miu): We just look at the center pixel presently, because if the 283 // TODO(miu): We just look at the center pixel presently, because if the
284 // analysis is too slow, the backlog of frames will grow without bound and 284 // analysis is too slow, the backlog of frames will grow without bound and
285 // trouble erupts. http://crbug.com/174519 285 // trouble erupts. http://crbug.com/174519
286 using media::VideoFrame; 286 using media::VideoFrame;
287 auto buffer_access = 287 auto buffer_access = buffer.handle_provider->GetHandleForInProcessAccess();
288 buffer.handle_provider()->GetHandleForInProcessAccess();
289 auto frame = VideoFrame::WrapExternalSharedMemory( 288 auto frame = VideoFrame::WrapExternalSharedMemory(
290 media::PIXEL_FORMAT_I420, format.frame_size, visible_rect, 289 media::PIXEL_FORMAT_I420, format.frame_size, visible_rect,
291 format.frame_size, buffer_access->data(), buffer_access->mapped_size(), 290 format.frame_size, buffer_access->data(), buffer_access->mapped_size(),
292 base::SharedMemory::NULLHandle(), 0u, base::TimeDelta()); 291 base::SharedMemory::NULLHandle(), 0u, base::TimeDelta());
293 const gfx::Point center = visible_rect.CenterPoint(); 292 const gfx::Point center = visible_rect.CenterPoint();
294 const int center_offset_y = 293 const int center_offset_y =
295 (frame->stride(VideoFrame::kYPlane) * center.y()) + center.x(); 294 (frame->stride(VideoFrame::kYPlane) * center.y()) + center.x();
296 const int center_offset_uv = 295 const int center_offset_uv =
297 (frame->stride(VideoFrame::kUPlane) * (center.y() / 2)) + 296 (frame->stride(VideoFrame::kUPlane) * (center.y() / 2)) +
298 (center.x() / 2); 297 (center.x() / 2);
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 for (int i = 0; i < 3; ++i) { 1008 for (int i = 0; i < 3; ++i) {
1010 SimulateRefreshFrameRequest(); 1009 SimulateRefreshFrameRequest();
1011 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); 1010 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN));
1012 } 1011 }
1013 1012
1014 device()->StopAndDeAllocate(); 1013 device()->StopAndDeAllocate();
1015 } 1014 }
1016 1015
1017 } // namespace 1016 } // namespace
1018 } // namespace content 1017 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/media/video_capture_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698