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

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: miu@s nits 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 media::VideoPixelFormat format,
340 const gfx::Size& dimensions) override { 340 const gfx::Size& dimensions) override {
341 CHECK_EQ(format, media::VideoFrame::I420); 341 CHECK_EQ(format, media::PIXEL_FORMAT_I420);
342 const size_t frame_bytes =
343 media::VideoFrame::AllocationSize(media::VideoFrame::I420, dimensions);
344 int buffer_id_to_drop = VideoCaptureBufferPool::kInvalidId; // Ignored. 342 int buffer_id_to_drop = VideoCaptureBufferPool::kInvalidId; // Ignored.
345 int buffer_id = 343 int buffer_id = buffer_pool_->ReserveForProducer(format, dimensions,
346 buffer_pool_->ReserveForProducer(frame_bytes, &buffer_id_to_drop); 344 &buffer_id_to_drop);
347 if (buffer_id == VideoCaptureBufferPool::kInvalidId) 345 if (buffer_id == VideoCaptureBufferPool::kInvalidId)
348 return NULL; 346 return NULL;
349 void* data; 347 void* data;
350 size_t size; 348 size_t size;
351 buffer_pool_->GetBufferInfo(buffer_id, &data, &size); 349 buffer_pool_->GetBufferInfo(buffer_id, &data, &size);
352 return scoped_refptr<media::VideoCaptureDevice::Client::Buffer>( 350 return scoped_refptr<media::VideoCaptureDevice::Client::Buffer>(
353 new AutoReleaseBuffer(buffer_pool_, buffer_id, data, size)); 351 new AutoReleaseBuffer(buffer_pool_, buffer_id, data, size));
354 } 352 }
355 353
356 void OnIncomingCapturedVideoFrame( 354 void OnIncomingCapturedVideoFrame(
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 source()->SetSolidColor(SK_ColorGREEN); 867 source()->SetSolidColor(SK_ColorGREEN);
870 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); 868 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN));
871 source()->SetSolidColor(SK_ColorRED); 869 source()->SetSolidColor(SK_ColorRED);
872 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorRED)); 870 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorRED));
873 871
874 device()->StopAndDeAllocate(); 872 device()->StopAndDeAllocate();
875 } 873 }
876 874
877 } // namespace 875 } // namespace
878 } // namespace content 876 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698