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

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

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

Powered by Google App Engine
This is Rietveld 408576698