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

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

Issue 1179323002: Video Capture: extract storage info from pixel format in VideoCaptureFormat. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 size_t y_stride, 341 size_t y_stride,
342 size_t u_stride, 342 size_t u_stride,
343 size_t v_stride, 343 size_t v_stride,
344 const media::VideoCaptureFormat& frame_format, 344 const media::VideoCaptureFormat& frame_format,
345 int clockwise_rotation, 345 int clockwise_rotation,
346 const base::TimeTicks& timestamp)); 346 const base::TimeTicks& timestamp));
347 347
348 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void)); 348 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void));
349 349
350 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> ReserveOutputBuffer( 350 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> ReserveOutputBuffer(
351 media::VideoPixelFormat format, 351 const media::VideoCaptureFormat& frame_format) override {
352 const gfx::Size& dimensions) override { 352 CHECK_EQ(frame_format.pixel_format, media::PIXEL_FORMAT_I420);
353 CHECK_EQ(format, media::PIXEL_FORMAT_I420);
354 int buffer_id_to_drop = VideoCaptureBufferPool::kInvalidId; // Ignored. 353 int buffer_id_to_drop = VideoCaptureBufferPool::kInvalidId; // Ignored.
355 int buffer_id = buffer_pool_->ReserveForProducer(format, dimensions, 354 int buffer_id = buffer_pool_->ReserveForProducer(
356 &buffer_id_to_drop); 355 frame_format.pixel_format,
356 frame_format.pixel_storage,
357 frame_format.frame_size,
358 &buffer_id_to_drop);
357 if (buffer_id == VideoCaptureBufferPool::kInvalidId) 359 if (buffer_id == VideoCaptureBufferPool::kInvalidId)
358 return NULL; 360 return NULL;
359 361
360 return scoped_ptr<media::VideoCaptureDevice::Client::Buffer>( 362 return scoped_ptr<media::VideoCaptureDevice::Client::Buffer>(
361 new AutoReleaseBuffer( 363 new AutoReleaseBuffer(
362 buffer_pool_, buffer_pool_->GetBufferHandle(buffer_id), buffer_id)); 364 buffer_pool_, buffer_pool_->GetBufferHandle(buffer_id), buffer_id));
363 } 365 }
364 // Trampoline method to workaround GMOCK problems with scoped_ptr<>. 366 // Trampoline method to workaround GMOCK problems with scoped_ptr<>.
365 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer, 367 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer,
366 const media::VideoCaptureFormat& frame_format, 368 const media::VideoCaptureFormat& frame_format,
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 SK_ColorBLACK, gfx::Size(kTestWidth, 1089 SK_ColorBLACK, gfx::Size(kTestWidth,
1088 kTestWidth * arbitrary_source_size.height() / 1090 kTestWidth * arbitrary_source_size.height() /
1089 arbitrary_source_size.width()))); 1091 arbitrary_source_size.width())));
1090 } 1092 }
1091 1093
1092 device()->StopAndDeAllocate(); 1094 device()->StopAndDeAllocate();
1093 } 1095 }
1094 1096
1095 } // namespace 1097 } // namespace
1096 } // namespace content 1098 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698