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

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

Issue 2573223002: [Mojo Video Capture] Simplify media::VideoCaptureDevice::Client:Buffer to a struct (Closed)
Patch Set: Backport naming improvements and Ownership interface from future CLs Created 3 years, 11 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 "content/browser/renderer_host/media/video_capture_manager.h" 5 #include "content/browser/renderer_host/media/video_capture_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 : buffer_pool_(std::move(buffer_pool)) {} 218 : buffer_pool_(std::move(buffer_pool)) {}
219 219
220 void SetBufferHold(int buffer_id) override { 220 void SetBufferHold(int buffer_id) override {
221 buffer_pool_->HoldForConsumers(buffer_id, 1); 221 buffer_pool_->HoldForConsumers(buffer_id, 1);
222 } 222 }
223 223
224 void ReleaseBufferHold(int buffer_id) override { 224 void ReleaseBufferHold(int buffer_id) override {
225 buffer_pool_->RelinquishConsumerHold(buffer_id, 1); 225 buffer_pool_->RelinquishConsumerHold(buffer_id, 1);
226 } 226 }
227 227
228 mojo::ScopedSharedBufferHandle GetHandleForTransit(int buffer_id) override {
229 return buffer_pool_->GetHandleForTransit(buffer_id);
230 }
231
232 private: 228 private:
233 scoped_refptr<media::VideoCaptureBufferPool> buffer_pool_; 229 scoped_refptr<media::VideoCaptureBufferPool> buffer_pool_;
234 }; 230 };
235 231
236 // Class used for queuing request for starting a device. 232 // Class used for queuing request for starting a device.
237 class VideoCaptureManager::CaptureDeviceStartRequest { 233 class VideoCaptureManager::CaptureDeviceStartRequest {
238 public: 234 public:
239 CaptureDeviceStartRequest(int serial_id, 235 CaptureDeviceStartRequest(int serial_id,
240 media::VideoCaptureSessionId session_id, 236 media::VideoCaptureSessionId session_id,
241 const media::VideoCaptureParams& params); 237 const media::VideoCaptureParams& params);
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 // First client starts the device. 734 // First client starts the device.
739 if (!entry->video_capture_controller.HasActiveClient() && 735 if (!entry->video_capture_controller.HasActiveClient() &&
740 !entry->video_capture_controller.HasPausedClient()) { 736 !entry->video_capture_controller.HasPausedClient()) {
741 DVLOG(1) << "VideoCaptureManager starting device (type = " 737 DVLOG(1) << "VideoCaptureManager starting device (type = "
742 << entry->stream_type << ", id = " << entry->id << ")"; 738 << entry->stream_type << ", id = " << entry->id << ")";
743 QueueStartDevice(session_id, entry, params); 739 QueueStartDevice(session_id, entry, params);
744 } 740 }
745 // Run the callback first, as AddClient() may trigger OnFrameInfo(). 741 // Run the callback first, as AddClient() may trigger OnFrameInfo().
746 done_cb.Run(entry->video_capture_controller.GetWeakPtrForIOThread()); 742 done_cb.Run(entry->video_capture_controller.GetWeakPtrForIOThread());
747 entry->video_capture_controller.AddClient(client_id, client_handler, 743 entry->video_capture_controller.AddClient(client_id, client_handler,
748 session_id, params); 744 session_id, params);
749 } 745 }
750 746
751 void VideoCaptureManager::StopCaptureForClient( 747 void VideoCaptureManager::StopCaptureForClient(
752 VideoCaptureController* controller, 748 VideoCaptureController* controller,
753 VideoCaptureControllerID client_id, 749 VideoCaptureControllerID client_id,
754 VideoCaptureControllerEventHandler* client_handler, 750 VideoCaptureControllerEventHandler* client_handler,
755 bool aborted_due_to_error) { 751 bool aborted_due_to_error) {
756 DCHECK_CURRENTLY_ON(BrowserThread::IO); 752 DCHECK_CURRENTLY_ON(BrowserThread::IO);
757 DCHECK(controller); 753 DCHECK(controller);
758 DCHECK(client_handler); 754 DCHECK(client_handler);
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 if (!device_in_queue) { 1312 if (!device_in_queue) {
1317 // Session ID is only valid for Screen capture. So we can fake it to 1313 // Session ID is only valid for Screen capture. So we can fake it to
1318 // resume video capture devices here. 1314 // resume video capture devices here.
1319 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); 1315 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters);
1320 } 1316 }
1321 } 1317 }
1322 } 1318 }
1323 #endif // defined(OS_ANDROID) 1319 #endif // defined(OS_ANDROID)
1324 1320
1325 } // namespace content 1321 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698