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

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

Issue 1064703002: VideoCaptureBufferPool: Refactor to allow support of non-ShMem backed buffers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 size_t y_stride, 329 size_t y_stride,
330 size_t u_stride, 330 size_t u_stride,
331 size_t v_stride, 331 size_t v_stride,
332 const media::VideoCaptureFormat& frame_format, 332 const media::VideoCaptureFormat& frame_format,
333 int clockwise_rotation, 333 int clockwise_rotation,
334 const base::TimeTicks& timestamp) override { 334 const base::TimeTicks& timestamp) override {
335 FAIL(); 335 FAIL();
336 } 336 }
337 337
338 scoped_refptr<media::VideoCaptureDevice::Client::Buffer> ReserveOutputBuffer( 338 scoped_refptr<media::VideoCaptureDevice::Client::Buffer> ReserveOutputBuffer(
339 media::VideoFrame::Format format, 339 const media::VideoCaptureFormat& format) override {
340 const gfx::Size& dimensions) override { 340 CHECK_EQ(format.pixel_format, media::PIXEL_FORMAT_I420);
341 CHECK_EQ(format, media::VideoFrame::I420);
342 const size_t frame_bytes =
343 media::VideoFrame::AllocationSize(media::VideoFrame::I420, dimensions);
344 int buffer_id_to_drop = VideoCaptureBufferPool::kInvalidId; // Ignored. 341 int buffer_id_to_drop = VideoCaptureBufferPool::kInvalidId; // Ignored.
345 int buffer_id = 342 int buffer_id =
346 buffer_pool_->ReserveForProducer(frame_bytes, &buffer_id_to_drop); 343 buffer_pool_->ReserveForProducer(format, &buffer_id_to_drop);
347 if (buffer_id == VideoCaptureBufferPool::kInvalidId) 344 if (buffer_id == VideoCaptureBufferPool::kInvalidId)
348 return NULL; 345 return NULL;
349 void* data; 346 void* data;
350 size_t size; 347 size_t size;
351 buffer_pool_->GetBufferInfo(buffer_id, &data, &size); 348 buffer_pool_->GetBufferInfo(buffer_id, &data, &size);
352 return scoped_refptr<media::VideoCaptureDevice::Client::Buffer>( 349 return scoped_refptr<media::VideoCaptureDevice::Client::Buffer>(
353 new AutoReleaseBuffer(buffer_pool_, buffer_id, data, size)); 350 new AutoReleaseBuffer(buffer_pool_, buffer_id, data, size));
354 } 351 }
355 352
356 void OnIncomingCapturedVideoFrame( 353 void OnIncomingCapturedVideoFrame(
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 source()->SetSolidColor(SK_ColorGREEN); 866 source()->SetSolidColor(SK_ColorGREEN);
870 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); 867 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN));
871 source()->SetSolidColor(SK_ColorRED); 868 source()->SetSolidColor(SK_ColorRED);
872 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorRED)); 869 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorRED));
873 870
874 device()->StopAndDeAllocate(); 871 device()->StopAndDeAllocate();
875 } 872 }
876 873
877 } // namespace 874 } // namespace
878 } // namespace content 875 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698