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

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

Issue 2902203002: [Mojo Video Capture] Hook up connection lost events (Closed)
Patch Set: Fix duplicate member introduced during merging Created 3 years, 6 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 348
349 device_start_request_queue_.pop_front(); 349 device_start_request_queue_.pop_front();
350 ProcessDeviceStartRequestQueue(); 350 ProcessDeviceStartRequestQueue();
351 } 351 }
352 352
353 void VideoCaptureManager::OnDeviceLaunchAborted() { 353 void VideoCaptureManager::OnDeviceLaunchAborted() {
354 device_start_request_queue_.pop_front(); 354 device_start_request_queue_.pop_front();
355 ProcessDeviceStartRequestQueue(); 355 ProcessDeviceStartRequestQueue();
356 } 356 }
357 357
358 void VideoCaptureManager::OnDeviceConnectionLost(
359 VideoCaptureController* controller) {
360 const std::string log_message = base::StringPrintf(
361 "Lost connection to device %d.", controller->serial_id());
362 DLOG(WARNING) << log_message;
363 controller->OnLog(log_message);
364 controller->OnError();
365 }
366
358 void VideoCaptureManager::ConnectClient( 367 void VideoCaptureManager::ConnectClient(
359 media::VideoCaptureSessionId session_id, 368 media::VideoCaptureSessionId session_id,
360 const media::VideoCaptureParams& params, 369 const media::VideoCaptureParams& params,
361 VideoCaptureControllerID client_id, 370 VideoCaptureControllerID client_id,
362 VideoCaptureControllerEventHandler* client_handler, 371 VideoCaptureControllerEventHandler* client_handler,
363 const DoneCB& done_cb) { 372 const DoneCB& done_cb) {
364 DCHECK_CURRENTLY_ON(BrowserThread::IO); 373 DCHECK_CURRENTLY_ON(BrowserThread::IO);
365 DVLOG(1) << __func__ << ", session_id = " << session_id << ", request: " 374 DVLOG(1) << __func__ << ", session_id = " << session_id << ", request: "
366 << media::VideoCaptureFormat::ToString(params.requested_format); 375 << media::VideoCaptureFormat::ToString(params.requested_format);
367 376
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 } 432 }
424 } 433 }
425 434
426 // Detach client from controller. 435 // Detach client from controller.
427 const media::VideoCaptureSessionId session_id = 436 const media::VideoCaptureSessionId session_id =
428 controller->RemoveClient(client_id, client_handler); 437 controller->RemoveClient(client_id, client_handler);
429 DVLOG(1) << __func__ << ", session_id = " << session_id; 438 DVLOG(1) << __func__ << ", session_id = " << session_id;
430 439
431 // If controller has no more clients, delete controller and device. 440 // If controller has no more clients, delete controller and device.
432 DestroyControllerIfNoClients(controller); 441 DestroyControllerIfNoClients(controller);
442
443 if (controllers_.empty()) {
444 video_capture_provider_->Uninitialize();
445 }
433 } 446 }
434 447
435 void VideoCaptureManager::PauseCaptureForClient( 448 void VideoCaptureManager::PauseCaptureForClient(
436 VideoCaptureController* controller, 449 VideoCaptureController* controller,
437 VideoCaptureControllerID client_id, 450 VideoCaptureControllerID client_id,
438 VideoCaptureControllerEventHandler* client_handler) { 451 VideoCaptureControllerEventHandler* client_handler) {
439 DCHECK_CURRENTLY_ON(BrowserThread::IO); 452 DCHECK_CURRENTLY_ON(BrowserThread::IO);
440 DCHECK(controller); 453 DCHECK(controller);
441 DCHECK(client_handler); 454 DCHECK(client_handler);
442 if (!IsControllerPointerValid(controller)) 455 if (!IsControllerPointerValid(controller))
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 // Session ID is only valid for Screen capture. So we can fake it to 864 // Session ID is only valid for Screen capture. So we can fake it to
852 // resume video capture devices here. 865 // resume video capture devices here.
853 QueueStartDevice(kFakeSessionId, controller.get(), 866 QueueStartDevice(kFakeSessionId, controller.get(),
854 controller->parameters()); 867 controller->parameters());
855 } 868 }
856 } 869 }
857 } 870 }
858 #endif // defined(OS_ANDROID) 871 #endif // defined(OS_ANDROID)
859 872
860 } // namespace content 873 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698