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

Side by Side Diff: media/capture/video/video_capture_device_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, 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
« no previous file with comments | « media/capture/video/video_capture_device.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "media/capture/video/video_capture_device.h" 5 #include "media/capture/video/video_capture_device.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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 const uint8_t* v_data, 78 const uint8_t* v_data,
79 size_t y_stride, 79 size_t y_stride,
80 size_t u_stride, 80 size_t u_stride,
81 size_t v_stride, 81 size_t v_stride,
82 const VideoCaptureFormat& frame_format, 82 const VideoCaptureFormat& frame_format,
83 int clockwise_rotation, 83 int clockwise_rotation,
84 const base::TimeTicks& timestamp)); 84 const base::TimeTicks& timestamp));
85 MOCK_METHOD0(DoReserveOutputBuffer, void(void)); 85 MOCK_METHOD0(DoReserveOutputBuffer, void(void));
86 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void)); 86 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void));
87 MOCK_METHOD0(DoOnIncomingCapturedVideoFrame, void(void)); 87 MOCK_METHOD0(DoOnIncomingCapturedVideoFrame, void(void));
88 MOCK_METHOD0(DoResurrectLastOutputBuffer, void(void));
88 MOCK_METHOD2(OnError, 89 MOCK_METHOD2(OnError,
89 void(const tracked_objects::Location& from_here, 90 void(const tracked_objects::Location& from_here,
90 const std::string& reason)); 91 const std::string& reason));
91 MOCK_CONST_METHOD0(GetBufferPoolUtilization, double(void)); 92 MOCK_CONST_METHOD0(GetBufferPoolUtilization, double(void));
92 93
93 explicit MockClient(base::Callback<void(const VideoCaptureFormat&)> frame_cb) 94 explicit MockClient(base::Callback<void(const VideoCaptureFormat&)> frame_cb)
94 : main_thread_(base::ThreadTaskRunnerHandle::Get()), 95 : main_thread_(base::ThreadTaskRunnerHandle::Get()),
95 frame_cb_(frame_cb) {} 96 frame_cb_(frame_cb) {}
96 97
97 void OnIncomingCapturedData(const uint8_t* data, 98 void OnIncomingCapturedData(const uint8_t* data,
(...skipping 18 matching lines...) Expand all
116 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer, 117 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer,
117 const VideoCaptureFormat& frame_format, 118 const VideoCaptureFormat& frame_format,
118 const base::TimeTicks& timestamp) override { 119 const base::TimeTicks& timestamp) override {
119 DoOnIncomingCapturedBuffer(); 120 DoOnIncomingCapturedBuffer();
120 } 121 }
121 void OnIncomingCapturedVideoFrame(scoped_ptr<Buffer> buffer, 122 void OnIncomingCapturedVideoFrame(scoped_ptr<Buffer> buffer,
122 const scoped_refptr<VideoFrame>& frame, 123 const scoped_refptr<VideoFrame>& frame,
123 const base::TimeTicks& timestamp) override { 124 const base::TimeTicks& timestamp) override {
124 DoOnIncomingCapturedVideoFrame(); 125 DoOnIncomingCapturedVideoFrame();
125 } 126 }
127 scoped_ptr<Buffer> ResurrectLastOutputBuffer(
128 const gfx::Size& dimensions,
129 media::VideoPixelFormat format,
130 media::VideoPixelStorage storage) {
131 DoResurrectLastOutputBuffer();
132 NOTREACHED() << "This should never be called";
133 return scoped_ptr<Buffer>();
134 }
126 135
127 private: 136 private:
128 scoped_refptr<base::SingleThreadTaskRunner> main_thread_; 137 scoped_refptr<base::SingleThreadTaskRunner> main_thread_;
129 base::Callback<void(const VideoCaptureFormat&)> frame_cb_; 138 base::Callback<void(const VideoCaptureFormat&)> frame_cb_;
130 }; 139 };
131 140
132 class DeviceEnumerationListener 141 class DeviceEnumerationListener
133 : public base::RefCounted<DeviceEnumerationListener> { 142 : public base::RefCounted<DeviceEnumerationListener> {
134 public: 143 public:
135 MOCK_METHOD1(OnEnumeratedDevicesCallbackPtr, 144 MOCK_METHOD1(OnEnumeratedDevicesCallbackPtr,
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 // GetDeviceSupportedFormats(). 489 // GetDeviceSupportedFormats().
481 scoped_ptr<VideoCaptureDevice::Name> name = 490 scoped_ptr<VideoCaptureDevice::Name> name =
482 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX); 491 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX);
483 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else 492 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else
484 // to test here 493 // to test here
485 // since we cannot forecast the hardware capabilities. 494 // since we cannot forecast the hardware capabilities.
486 ASSERT_FALSE(name); 495 ASSERT_FALSE(name);
487 } 496 }
488 497
489 }; // namespace media 498 }; // namespace media
OLDNEW
« no previous file with comments | « media/capture/video/video_capture_device.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698