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

Side by Side Diff: media/capture/video/video_capture_device_unittest.cc

Issue 2518143004: [Mojo Video Capture] Replace RESOURCE_UTILIZATION with interface ReceiverLoadObserver (Closed)
Patch Set: miu's comments Created 4 years 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 "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 9
10 #include <memory> 10 #include <memory>
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 base::Callback<void(const VideoCaptureFormat&)> frame_cb) 107 base::Callback<void(const VideoCaptureFormat&)> frame_cb)
108 : main_thread_(base::ThreadTaskRunnerHandle::Get()), frame_cb_(frame_cb) { 108 : main_thread_(base::ThreadTaskRunnerHandle::Get()), frame_cb_(frame_cb) {
109 ON_CALL(*this, OnError(_, _)).WillByDefault(Invoke(DumpError)); 109 ON_CALL(*this, OnError(_, _)).WillByDefault(Invoke(DumpError));
110 } 110 }
111 111
112 void OnIncomingCapturedData(const uint8_t* data, 112 void OnIncomingCapturedData(const uint8_t* data,
113 int length, 113 int length,
114 const VideoCaptureFormat& format, 114 const VideoCaptureFormat& format,
115 int rotation, 115 int rotation,
116 base::TimeTicks reference_time, 116 base::TimeTicks reference_time,
117 base::TimeDelta timestamp) override { 117 base::TimeDelta timestamp,
118 int frame_feedback_id) override {
118 ASSERT_GT(length, 0); 119 ASSERT_GT(length, 0);
119 ASSERT_TRUE(data); 120 ASSERT_TRUE(data);
120 main_thread_->PostTask(FROM_HERE, base::Bind(frame_cb_, format)); 121 main_thread_->PostTask(FROM_HERE, base::Bind(frame_cb_, format));
121 } 122 }
122 123
123 // Trampoline methods to workaround GMOCK problems with std::unique_ptr<>. 124 // Trampoline methods to workaround GMOCK problems with std::unique_ptr<>.
124 std::unique_ptr<Buffer> ReserveOutputBuffer( 125 std::unique_ptr<Buffer> ReserveOutputBuffer(const gfx::Size& dimensions,
125 const gfx::Size& dimensions, 126 media::VideoPixelFormat format,
126 media::VideoPixelFormat format, 127 media::VideoPixelStorage storage,
127 media::VideoPixelStorage storage) override { 128 int frame_feedback_id) override {
128 DoReserveOutputBuffer(); 129 DoReserveOutputBuffer();
129 NOTREACHED() << "This should never be called"; 130 NOTREACHED() << "This should never be called";
130 return std::unique_ptr<Buffer>(); 131 return std::unique_ptr<Buffer>();
131 } 132 }
132 void OnIncomingCapturedBuffer(std::unique_ptr<Buffer> buffer, 133 void OnIncomingCapturedBuffer(std::unique_ptr<Buffer> buffer,
133 const VideoCaptureFormat& frame_format, 134 const VideoCaptureFormat& format,
134 base::TimeTicks reference_time, 135 base::TimeTicks reference_time,
135 base::TimeDelta timestamp) override { 136 base::TimeDelta timestamp) override {
136 DoOnIncomingCapturedBuffer(); 137 DoOnIncomingCapturedBuffer();
137 } 138 }
138 void OnIncomingCapturedVideoFrame(std::unique_ptr<Buffer> buffer, 139 void OnIncomingCapturedVideoFrame(std::unique_ptr<Buffer> buffer,
139 scoped_refptr<VideoFrame> frame) override { 140 scoped_refptr<VideoFrame> frame) override {
140 DoOnIncomingCapturedVideoFrame(); 141 DoOnIncomingCapturedVideoFrame();
141 } 142 }
142 std::unique_ptr<Buffer> ResurrectLastOutputBuffer( 143 std::unique_ptr<Buffer> ResurrectLastOutputBuffer(
143 const gfx::Size& dimensions, 144 const gfx::Size& dimensions,
144 media::VideoPixelFormat format, 145 media::VideoPixelFormat format,
145 media::VideoPixelStorage storage) { 146 media::VideoPixelStorage storage,
147 int frame_feedback_id) {
146 DoResurrectLastOutputBuffer(); 148 DoResurrectLastOutputBuffer();
147 NOTREACHED() << "This should never be called"; 149 NOTREACHED() << "This should never be called";
148 return std::unique_ptr<Buffer>(); 150 return std::unique_ptr<Buffer>();
149 } 151 }
150 152
151 private: 153 private:
152 scoped_refptr<base::SingleThreadTaskRunner> main_thread_; 154 scoped_refptr<base::SingleThreadTaskRunner> main_thread_;
153 base::Callback<void(const VideoCaptureFormat&)> frame_cb_; 155 base::Callback<void(const VideoCaptureFormat&)> frame_cb_;
154 }; 156 };
155 157
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 631
630 device->GetPhotoCapabilities(std::move(scoped_get_callback)); 632 device->GetPhotoCapabilities(std::move(scoped_get_callback));
631 run_loop.Run(); 633 run_loop.Run();
632 634
633 ASSERT_TRUE(image_capture_client_->capabilities()); 635 ASSERT_TRUE(image_capture_client_->capabilities());
634 636
635 device->StopAndDeAllocate(); 637 device->StopAndDeAllocate();
636 } 638 }
637 639
638 }; // namespace media 640 }; // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698