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

Side by Side Diff: content/browser/renderer_host/media/video_capture_host_unittest.cc

Issue 1157193002: RESOURCE_UTILIZATION in VideoFrameMetadata, a consumer feedback signal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@video_frame_done_callback
Patch Set: Created 5 years, 6 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 <map> 5 #include <map>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 } 156 }
157 157
158 void SetReturnReceivedDibs(bool enable) { 158 void SetReturnReceivedDibs(bool enable) {
159 return_buffers_ = enable; 159 return_buffers_ = enable;
160 } 160 }
161 161
162 // Return Dibs we currently have received. 162 // Return Dibs we currently have received.
163 void ReturnReceivedDibs(int device_id) { 163 void ReturnReceivedDibs(int device_id) {
164 int handle = GetReceivedDib(); 164 int handle = GetReceivedDib();
165 while (handle) { 165 while (handle) {
166 this->OnReceiveEmptyBuffer(device_id, handle, 0); 166 this->OnRendererFinishedWithBuffer(device_id, handle, 0, -1.0);
167 handle = GetReceivedDib(); 167 handle = GetReceivedDib();
168 } 168 }
169 } 169 }
170 170
171 int GetReceivedDib() { 171 int GetReceivedDib() {
172 if (filled_dib_.empty()) 172 if (filled_dib_.empty())
173 return 0; 173 return 0;
174 std::map<int, base::SharedMemory*>::iterator it = filled_dib_.begin(); 174 std::map<int, base::SharedMemory*>::iterator it = filled_dib_.begin();
175 int h = it->first; 175 int h = it->first;
176 delete it->second; 176 delete it->second;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 if (dumper_.coded_size().IsEmpty()) 238 if (dumper_.coded_size().IsEmpty())
239 dumper_.StartDump(params.coded_size); 239 dumper_.StartDump(params.coded_size);
240 ASSERT_TRUE(dumper_.coded_size() == params.coded_size) 240 ASSERT_TRUE(dumper_.coded_size() == params.coded_size)
241 << "Dump format does not handle variable resolution."; 241 << "Dump format does not handle variable resolution.";
242 dumper_.NewVideoFrame(dib->memory()); 242 dumper_.NewVideoFrame(dib->memory());
243 } 243 }
244 244
245 OnBufferFilled(params.device_id, params.buffer_id, params.coded_size, 245 OnBufferFilled(params.device_id, params.buffer_id, params.coded_size,
246 params.visible_rect, params.timestamp, params.metadata); 246 params.visible_rect, params.timestamp, params.metadata);
247 if (return_buffers_) { 247 if (return_buffers_) {
248 VideoCaptureHost::OnReceiveEmptyBuffer( 248 VideoCaptureHost::OnRendererFinishedWithBuffer(
249 params.device_id, params.buffer_id, 0); 249 params.device_id, params.buffer_id, 0, -1.0);
250 } 250 }
251 } 251 }
252 252
253 void OnMailboxBufferFilledDispatch( 253 void OnMailboxBufferFilledDispatch(
254 const VideoCaptureMsg_MailboxBufferReady_Params& params) { 254 const VideoCaptureMsg_MailboxBufferReady_Params& params) {
255 OnMailboxBufferFilled(params.device_id, params.buffer_id, 255 OnMailboxBufferFilled(params.device_id, params.buffer_id,
256 params.mailbox_holder, params.packed_frame_size, 256 params.mailbox_holder, params.packed_frame_size,
257 params.timestamp, params.metadata); 257 params.timestamp, params.metadata);
258 if (return_buffers_) { 258 if (return_buffers_) {
259 VideoCaptureHost::OnReceiveEmptyBuffer( 259 VideoCaptureHost::OnRendererFinishedWithBuffer(
260 params.device_id, params.buffer_id, 0); 260 params.device_id, params.buffer_id, 0, -1.0);
261 } 261 }
262 } 262 }
263 263
264 void OnStateChangedDispatch(int device_id, VideoCaptureState state) { 264 void OnStateChangedDispatch(int device_id, VideoCaptureState state) {
265 OnStateChanged(device_id, state); 265 OnStateChanged(device_id, state);
266 } 266 }
267 267
268 std::map<int, base::SharedMemory*> filled_dib_; 268 std::map<int, base::SharedMemory*> filled_dib_;
269 bool return_buffers_; 269 bool return_buffers_;
270 bool dump_video_; 270 bool dump_video_;
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 #ifdef DUMP_VIDEO 560 #ifdef DUMP_VIDEO
561 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) { 561 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) {
562 CaptureAndDumpVideo(640, 480, 30); 562 CaptureAndDumpVideo(640, 480, 30);
563 } 563 }
564 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) { 564 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) {
565 CaptureAndDumpVideo(1280, 720, 30); 565 CaptureAndDumpVideo(1280, 720, 30);
566 } 566 }
567 #endif 567 #endif
568 568
569 } // namespace content 569 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698