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

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

Issue 1204063005: Reland: Video Capture: extract storage info from pixel format in VideoCaptureFormat. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dcheng@ nit on DCHECK_EQ(expected, actual) Created 5 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 unified diff | Download patch
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 "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/debug/debugger.h" 8 #include "base/debug/debugger.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 size_t y_stride, 342 size_t y_stride,
343 size_t u_stride, 343 size_t u_stride,
344 size_t v_stride, 344 size_t v_stride,
345 const media::VideoCaptureFormat& frame_format, 345 const media::VideoCaptureFormat& frame_format,
346 int clockwise_rotation, 346 int clockwise_rotation,
347 const base::TimeTicks& timestamp)); 347 const base::TimeTicks& timestamp));
348 348
349 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void)); 349 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void));
350 350
351 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> ReserveOutputBuffer( 351 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> ReserveOutputBuffer(
352 const gfx::Size& dimensions,
352 media::VideoPixelFormat format, 353 media::VideoPixelFormat format,
353 const gfx::Size& dimensions) override { 354 media::VideoPixelStorage storage) override {
354 CHECK_EQ(format, media::PIXEL_FORMAT_I420); 355 CHECK_EQ(format, media::PIXEL_FORMAT_I420);
355 int buffer_id_to_drop = VideoCaptureBufferPool::kInvalidId; // Ignored. 356 int buffer_id_to_drop = VideoCaptureBufferPool::kInvalidId; // Ignored.
356 int buffer_id = buffer_pool_->ReserveForProducer(format, dimensions, 357 const int buffer_id = buffer_pool_->ReserveForProducer(
357 &buffer_id_to_drop); 358 format, storage, dimensions, &buffer_id_to_drop);
358 if (buffer_id == VideoCaptureBufferPool::kInvalidId) 359 if (buffer_id == VideoCaptureBufferPool::kInvalidId)
359 return NULL; 360 return NULL;
360 361
361 return scoped_ptr<media::VideoCaptureDevice::Client::Buffer>( 362 return scoped_ptr<media::VideoCaptureDevice::Client::Buffer>(
362 new AutoReleaseBuffer( 363 new AutoReleaseBuffer(
363 buffer_pool_, buffer_pool_->GetBufferHandle(buffer_id), buffer_id)); 364 buffer_pool_, buffer_pool_->GetBufferHandle(buffer_id), buffer_id));
364 } 365 }
365 // Trampoline method to workaround GMOCK problems with scoped_ptr<>. 366 // Trampoline method to workaround GMOCK problems with scoped_ptr<>.
366 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer, 367 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer,
367 const media::VideoCaptureFormat& frame_format, 368 const media::VideoCaptureFormat& frame_format,
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColorAndFrameSize( 1066 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColorAndFrameSize(
1066 SK_ColorBLACK, gfx::Size(kTestWidth, 1067 SK_ColorBLACK, gfx::Size(kTestWidth,
1067 kTestWidth * arbitrary_source_size.height() / 1068 kTestWidth * arbitrary_source_size.height() /
1068 arbitrary_source_size.width()))); 1069 arbitrary_source_size.width())));
1069 1070
1070 device()->StopAndDeAllocate(); 1071 device()->StopAndDeAllocate();
1071 } 1072 }
1072 1073
1073 } // namespace 1074 } // namespace
1074 } // namespace content 1075 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/capture/desktop_capture_device_unittest.cc ('k') | content/browser/media/media_internals_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698