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

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

Issue 1826643003: Add frame refresh to VideoCaptureDevice, and buffer pool resurrection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: REBASE before commit Created 4 years, 9 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/media/capture/desktop_capture_device_unittest.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/desktop_capture_device_aura.h" 5 #include "content/browser/media/capture/desktop_capture_device_aura.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 const uint8_t* v_data, 53 const uint8_t* v_data,
54 size_t y_stride, 54 size_t y_stride,
55 size_t u_stride, 55 size_t u_stride,
56 size_t v_stride, 56 size_t v_stride,
57 const media::VideoCaptureFormat& frame_format, 57 const media::VideoCaptureFormat& frame_format,
58 int clockwise_rotation, 58 int clockwise_rotation,
59 const base::TimeTicks& timestamp)); 59 const base::TimeTicks& timestamp));
60 MOCK_METHOD0(DoReserveOutputBuffer, void(void)); 60 MOCK_METHOD0(DoReserveOutputBuffer, void(void));
61 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void)); 61 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void));
62 MOCK_METHOD0(DoOnIncomingCapturedVideoFrame, void(void)); 62 MOCK_METHOD0(DoOnIncomingCapturedVideoFrame, void(void));
63 MOCK_METHOD0(DoResurrectLastOutputBuffer, void(void));
63 MOCK_METHOD2(OnError, 64 MOCK_METHOD2(OnError,
64 void(const tracked_objects::Location& from_here, 65 void(const tracked_objects::Location& from_here,
65 const std::string& reason)); 66 const std::string& reason));
66 67
67 // Trampoline methods to workaround GMOCK problems with scoped_ptr<>. 68 // Trampoline methods to workaround GMOCK problems with scoped_ptr<>.
68 scoped_ptr<Buffer> ReserveOutputBuffer( 69 scoped_ptr<Buffer> ReserveOutputBuffer(
69 const gfx::Size& dimensions, 70 const gfx::Size& dimensions,
70 media::VideoPixelFormat format, 71 media::VideoPixelFormat format,
71 media::VideoPixelStorage storage) override { 72 media::VideoPixelStorage storage) override {
72 EXPECT_EQ(media::PIXEL_FORMAT_I420, format); 73 EXPECT_EQ(media::PIXEL_FORMAT_I420, format);
73 EXPECT_EQ(media::PIXEL_STORAGE_CPU, storage); 74 EXPECT_EQ(media::PIXEL_STORAGE_CPU, storage);
74 DoReserveOutputBuffer(); 75 DoReserveOutputBuffer();
75 return scoped_ptr<Buffer>(); 76 return scoped_ptr<Buffer>();
76 } 77 }
77 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer, 78 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer,
78 const media::VideoCaptureFormat& frame_format, 79 const media::VideoCaptureFormat& frame_format,
79 const base::TimeTicks& timestamp) override { 80 const base::TimeTicks& timestamp) override {
80 DoOnIncomingCapturedBuffer(); 81 DoOnIncomingCapturedBuffer();
81 } 82 }
82 void OnIncomingCapturedVideoFrame( 83 void OnIncomingCapturedVideoFrame(
83 scoped_ptr<Buffer> buffer, 84 scoped_ptr<Buffer> buffer,
84 const scoped_refptr<media::VideoFrame>& frame, 85 const scoped_refptr<media::VideoFrame>& frame,
85 const base::TimeTicks& timestamp) override { 86 const base::TimeTicks& timestamp) override {
86 DoOnIncomingCapturedVideoFrame(); 87 DoOnIncomingCapturedVideoFrame();
87 } 88 }
88 89 scoped_ptr<Buffer> ResurrectLastOutputBuffer(
90 const gfx::Size& dimensions,
91 media::VideoPixelFormat format,
92 media::VideoPixelStorage storage) override {
93 EXPECT_EQ(media::PIXEL_FORMAT_I420, format);
94 EXPECT_EQ(media::PIXEL_STORAGE_CPU, storage);
95 DoResurrectLastOutputBuffer();
96 return scoped_ptr<Buffer>();
97 }
89 double GetBufferPoolUtilization() const override { return 0.0; } 98 double GetBufferPoolUtilization() const override { return 0.0; }
90 }; 99 };
91 100
92 // Test harness that sets up a minimal environment with necessary stubs. 101 // Test harness that sets up a minimal environment with necessary stubs.
93 class DesktopCaptureDeviceAuraTest : public testing::Test { 102 class DesktopCaptureDeviceAuraTest : public testing::Test {
94 public: 103 public:
95 DesktopCaptureDeviceAuraTest() 104 DesktopCaptureDeviceAuraTest()
96 : browser_thread_for_ui_(BrowserThread::UI, &message_loop_) {} 105 : browser_thread_for_ui_(BrowserThread::UI, &message_loop_) {}
97 ~DesktopCaptureDeviceAuraTest() override {} 106 ~DesktopCaptureDeviceAuraTest() override {}
98 107
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 media::VideoCaptureParams capture_params; 162 media::VideoCaptureParams capture_params;
154 capture_params.requested_format.frame_size.SetSize(640, 480); 163 capture_params.requested_format.frame_size.SetSize(640, 480);
155 capture_params.requested_format.frame_rate = kFrameRate; 164 capture_params.requested_format.frame_rate = kFrameRate;
156 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; 165 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420;
157 capture_device->AllocateAndStart(capture_params, std::move(client)); 166 capture_device->AllocateAndStart(capture_params, std::move(client));
158 capture_device->StopAndDeAllocate(); 167 capture_device->StopAndDeAllocate();
159 } 168 }
160 169
161 } // namespace 170 } // namespace
162 } // namespace content 171 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/media/capture/desktop_capture_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698