| OLD | NEW |
| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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->OnRendererFinishedWithBuffer(device_id, handle, 0, -1.0); | 154 this->OnRendererFinishedWithBuffer( |
| 155 device_id, handle, gpu::SyncToken(), -1.0); |
| 155 handle = GetReceivedDib(); | 156 handle = GetReceivedDib(); |
| 156 } | 157 } |
| 157 } | 158 } |
| 158 | 159 |
| 159 int GetReceivedDib() { | 160 int GetReceivedDib() { |
| 160 if (filled_dib_.empty()) | 161 if (filled_dib_.empty()) |
| 161 return 0; | 162 return 0; |
| 162 std::map<int, base::SharedMemory*>::iterator it = filled_dib_.begin(); | 163 std::map<int, base::SharedMemory*>::iterator it = filled_dib_.begin(); |
| 163 int h = it->first; | 164 int h = it->first; |
| 164 delete it->second; | 165 delete it->second; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 if (dumper_.coded_size().IsEmpty()) | 225 if (dumper_.coded_size().IsEmpty()) |
| 225 dumper_.StartDump(params.coded_size); | 226 dumper_.StartDump(params.coded_size); |
| 226 ASSERT_TRUE(dumper_.coded_size() == params.coded_size) | 227 ASSERT_TRUE(dumper_.coded_size() == params.coded_size) |
| 227 << "Dump format does not handle variable resolution."; | 228 << "Dump format does not handle variable resolution."; |
| 228 dumper_.NewVideoFrame(dib->memory()); | 229 dumper_.NewVideoFrame(dib->memory()); |
| 229 } | 230 } |
| 230 | 231 |
| 231 OnBufferFilled(params.device_id); | 232 OnBufferFilled(params.device_id); |
| 232 if (return_buffers_) { | 233 if (return_buffers_) { |
| 233 VideoCaptureHost::OnRendererFinishedWithBuffer( | 234 VideoCaptureHost::OnRendererFinishedWithBuffer( |
| 234 params.device_id, params.buffer_id, 0, -1.0); | 235 params.device_id, params.buffer_id, gpu::SyncToken(), -1.0); |
| 235 } | 236 } |
| 236 } | 237 } |
| 237 | 238 |
| 238 void OnStateChangedDispatch(int device_id, VideoCaptureState state) { | 239 void OnStateChangedDispatch(int device_id, VideoCaptureState state) { |
| 239 OnStateChanged(device_id, state); | 240 OnStateChanged(device_id, state); |
| 240 } | 241 } |
| 241 | 242 |
| 242 std::map<int, base::SharedMemory*> filled_dib_; | 243 std::map<int, base::SharedMemory*> filled_dib_; |
| 243 bool return_buffers_; | 244 bool return_buffers_; |
| 244 bool dump_video_; | 245 bool dump_video_; |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 #ifdef DUMP_VIDEO | 532 #ifdef DUMP_VIDEO |
| 532 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) { | 533 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) { |
| 533 CaptureAndDumpVideo(640, 480, 30); | 534 CaptureAndDumpVideo(640, 480, 30); |
| 534 } | 535 } |
| 535 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) { | 536 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) { |
| 536 CaptureAndDumpVideo(1280, 720, 30); | 537 CaptureAndDumpVideo(1280, 720, 30); |
| 537 } | 538 } |
| 538 #endif | 539 #endif |
| 539 | 540 |
| 540 } // namespace content | 541 } // namespace content |
| OLD | NEW |