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

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: mcasas comments 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 : buffer_pool_(std::move(buffer_pool)) {} 219 : buffer_pool_(std::move(buffer_pool)) {}
220 220
221 void SetBufferHold(int buffer_id) override { 221 void SetBufferHold(int buffer_id) override {
222 buffer_pool_->HoldForConsumers(buffer_id, 1); 222 buffer_pool_->HoldForConsumers(buffer_id, 1);
223 } 223 }
224 224
225 void ReleaseBufferHold(int buffer_id) override { 225 void ReleaseBufferHold(int buffer_id) override {
226 buffer_pool_->RelinquishConsumerHold(buffer_id, 1); 226 buffer_pool_->RelinquishConsumerHold(buffer_id, 1);
227 } 227 }
228 228
229 mojo::ScopedSharedBufferHandle GetHandleForTransit(int buffer_id) override {
230 return buffer_pool_->GetHandleForTransit(buffer_id);
231 }
232
233 private: 229 private:
234 scoped_refptr<media::VideoCaptureBufferPool> buffer_pool_; 230 scoped_refptr<media::VideoCaptureBufferPool> buffer_pool_;
235 }; 231 };
236 232
237 // Class used for queuing request for starting a device. 233 // Class used for queuing request for starting a device.
238 class VideoCaptureManager::CaptureDeviceStartRequest { 234 class VideoCaptureManager::CaptureDeviceStartRequest {
239 public: 235 public:
240 CaptureDeviceStartRequest(int serial_id, 236 CaptureDeviceStartRequest(int serial_id,
241 media::VideoCaptureSessionId session_id, 237 media::VideoCaptureSessionId session_id,
242 const media::VideoCaptureParams& params); 238 const media::VideoCaptureParams& params);
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 // First client starts the device. 735 // First client starts the device.
740 if (!entry->video_capture_controller.HasActiveClient() && 736 if (!entry->video_capture_controller.HasActiveClient() &&
741 !entry->video_capture_controller.HasPausedClient()) { 737 !entry->video_capture_controller.HasPausedClient()) {
742 DVLOG(1) << "VideoCaptureManager starting device (type = " 738 DVLOG(1) << "VideoCaptureManager starting device (type = "
743 << entry->stream_type << ", id = " << entry->id << ")"; 739 << entry->stream_type << ", id = " << entry->id << ")";
744 QueueStartDevice(session_id, entry, params); 740 QueueStartDevice(session_id, entry, params);
745 } 741 }
746 // Run the callback first, as AddClient() may trigger OnFrameInfo(). 742 // Run the callback first, as AddClient() may trigger OnFrameInfo().
747 done_cb.Run(entry->video_capture_controller.GetWeakPtrForIOThread()); 743 done_cb.Run(entry->video_capture_controller.GetWeakPtrForIOThread());
748 entry->video_capture_controller.AddClient(client_id, client_handler, 744 entry->video_capture_controller.AddClient(client_id, client_handler,
749 session_id, params); 745 session_id, params);
750 } 746 }
751 747
752 void VideoCaptureManager::StopCaptureForClient( 748 void VideoCaptureManager::StopCaptureForClient(
753 VideoCaptureController* controller, 749 VideoCaptureController* controller,
754 VideoCaptureControllerID client_id, 750 VideoCaptureControllerID client_id,
755 VideoCaptureControllerEventHandler* client_handler, 751 VideoCaptureControllerEventHandler* client_handler,
756 bool aborted_due_to_error) { 752 bool aborted_due_to_error) {
757 DCHECK_CURRENTLY_ON(BrowserThread::IO); 753 DCHECK_CURRENTLY_ON(BrowserThread::IO);
758 DCHECK(controller); 754 DCHECK(controller);
759 DCHECK(client_handler); 755 DCHECK(client_handler);
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 if (!device_in_queue) { 1313 if (!device_in_queue) {
1318 // Session ID is only valid for Screen capture. So we can fake it to 1314 // Session ID is only valid for Screen capture. So we can fake it to
1319 // resume video capture devices here. 1315 // resume video capture devices here.
1320 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); 1316 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters);
1321 } 1317 }
1322 } 1318 }
1323 } 1319 }
1324 #endif // defined(OS_ANDROID) 1320 #endif // defined(OS_ANDROID)
1325 1321
1326 } // namespace content 1322 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698