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

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

Issue 175223003: HW Video: Make media::VideoFrame handle the sync point of the compositor as well as webgl (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: rebase to ToT Created 6 years, 7 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/file_util.h" 10 #include "base/file_util.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 144 }
145 145
146 void SetReturnReceivedDibs(bool enable) { 146 void SetReturnReceivedDibs(bool enable) {
147 return_buffers_ = enable; 147 return_buffers_ = enable;
148 } 148 }
149 149
150 // Return Dibs we currently have received. 150 // Return Dibs we currently have received.
151 void ReturnReceivedDibs(int device_id) { 151 void ReturnReceivedDibs(int device_id) {
152 int handle = GetReceivedDib(); 152 int handle = GetReceivedDib();
153 while (handle) { 153 while (handle) {
154 this->OnReceiveEmptyBuffer(device_id, handle, 0); 154 this->OnReceiveEmptyBuffer(device_id, handle, std::vector<uint32>());
155 handle = GetReceivedDib(); 155 handle = GetReceivedDib();
156 } 156 }
157 } 157 }
158 158
159 int GetReceivedDib() { 159 int GetReceivedDib() {
160 if (filled_dib_.empty()) 160 if (filled_dib_.empty())
161 return 0; 161 return 0;
162 std::map<int, base::SharedMemory*>::iterator it = filled_dib_.begin(); 162 std::map<int, base::SharedMemory*>::iterator it = filled_dib_.begin();
163 int h = it->first; 163 int h = it->first;
164 delete it->second; 164 delete it->second;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 } 232 }
233 ASSERT_EQ(format_.frame_size.width(), frame_format.frame_size.width()) 233 ASSERT_EQ(format_.frame_size.width(), frame_format.frame_size.width())
234 << "Dump format does not handle variable resolution."; 234 << "Dump format does not handle variable resolution.";
235 ASSERT_EQ(format_.frame_size.height(), frame_format.frame_size.height()) 235 ASSERT_EQ(format_.frame_size.height(), frame_format.frame_size.height())
236 << "Dump format does not handle variable resolution."; 236 << "Dump format does not handle variable resolution.";
237 dumper_.NewVideoFrame(dib->memory()); 237 dumper_.NewVideoFrame(dib->memory());
238 } 238 }
239 239
240 OnBufferFilled(device_id, buffer_id, frame_format, timestamp); 240 OnBufferFilled(device_id, buffer_id, frame_format, timestamp);
241 if (return_buffers_) { 241 if (return_buffers_) {
242 VideoCaptureHost::OnReceiveEmptyBuffer(device_id, buffer_id, 0); 242 VideoCaptureHost::OnReceiveEmptyBuffer(
243 device_id, buffer_id, std::vector<uint32>());
243 } 244 }
244 } 245 }
245 246
246 void OnMailboxBufferFilledDispatch(int device_id, 247 void OnMailboxBufferFilledDispatch(int device_id,
247 int buffer_id, 248 int buffer_id,
248 const gpu::MailboxHolder& mailbox_holder, 249 const gpu::MailboxHolder& mailbox_holder,
249 const media::VideoCaptureFormat& format, 250 const media::VideoCaptureFormat& format,
250 base::TimeTicks timestamp) { 251 base::TimeTicks timestamp) {
251 OnMailboxBufferFilled( 252 OnMailboxBufferFilled(
252 device_id, buffer_id, mailbox_holder, format, timestamp); 253 device_id, buffer_id, mailbox_holder, format, timestamp);
253 if (return_buffers_) { 254 if (return_buffers_) {
254 VideoCaptureHost::OnReceiveEmptyBuffer( 255 VideoCaptureHost::OnReceiveEmptyBuffer(
255 device_id, buffer_id, mailbox_holder.sync_point); 256 device_id, buffer_id, std::vector<uint32>());
256 } 257 }
257 } 258 }
258 259
259 void OnStateChangedDispatch(int device_id, VideoCaptureState state) { 260 void OnStateChangedDispatch(int device_id, VideoCaptureState state) {
260 OnStateChanged(device_id, state); 261 OnStateChanged(device_id, state);
261 } 262 }
262 263
263 std::map<int, base::SharedMemory*> filled_dib_; 264 std::map<int, base::SharedMemory*> filled_dib_;
264 bool return_buffers_; 265 bool return_buffers_;
265 bool dump_video_; 266 bool dump_video_;
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 #ifdef DUMP_VIDEO 533 #ifdef DUMP_VIDEO
533 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) { 534 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) {
534 CaptureAndDumpVideo(640, 480, 30); 535 CaptureAndDumpVideo(640, 480, 30);
535 } 536 }
536 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) { 537 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) {
537 CaptureAndDumpVideo(1280, 720, 30); 538 CaptureAndDumpVideo(1280, 720, 30);
538 } 539 }
539 #endif 540 #endif
540 541
541 } // namespace content 542 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/video_capture_host.cc ('k') | content/common/media/video_capture_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698