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

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

Issue 2291893002: Let Contraints Controll Mute/Unmute Audio Local Playback For Desktop Sharing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unique_ptr Created 4 years, 3 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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 583
584 std::unique_ptr<media::VideoCaptureDevice> 584 std::unique_ptr<media::VideoCaptureDevice>
585 VideoCaptureManager::DoStartTabCaptureOnDeviceThread( 585 VideoCaptureManager::DoStartTabCaptureOnDeviceThread(
586 const std::string& id, 586 const std::string& id,
587 const media::VideoCaptureParams& params, 587 const media::VideoCaptureParams& params,
588 std::unique_ptr<VideoCaptureDevice::Client> device_client) { 588 std::unique_ptr<VideoCaptureDevice::Client> device_client) {
589 SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StartDeviceTime"); 589 SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StartDeviceTime");
590 DCHECK(IsOnDeviceThread()); 590 DCHECK(IsOnDeviceThread());
591 591
592 std::unique_ptr<VideoCaptureDevice> video_capture_device; 592 std::unique_ptr<VideoCaptureDevice> video_capture_device;
593 video_capture_device.reset(WebContentsVideoCaptureDevice::Create(id)); 593 video_capture_device = WebContentsVideoCaptureDevice::Create(id);
594 594
595 if (!video_capture_device) { 595 if (!video_capture_device) {
596 device_client->OnError(FROM_HERE, "Could not create capture device"); 596 device_client->OnError(FROM_HERE, "Could not create capture device");
597 return nullptr; 597 return nullptr;
598 } 598 }
599 599
600 video_capture_device->AllocateAndStart(params, std::move(device_client)); 600 video_capture_device->AllocateAndStart(params, std::move(device_client));
601 return video_capture_device; 601 return video_capture_device;
602 } 602 }
603 603
604 std::unique_ptr<media::VideoCaptureDevice> 604 std::unique_ptr<media::VideoCaptureDevice>
605 VideoCaptureManager::DoStartDesktopCaptureOnDeviceThread( 605 VideoCaptureManager::DoStartDesktopCaptureOnDeviceThread(
606 const std::string& id, 606 const std::string& id,
607 const media::VideoCaptureParams& params, 607 const media::VideoCaptureParams& params,
608 std::unique_ptr<VideoCaptureDevice::Client> device_client) { 608 std::unique_ptr<VideoCaptureDevice::Client> device_client) {
609 SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StartDeviceTime"); 609 SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StartDeviceTime");
610 DCHECK(IsOnDeviceThread()); 610 DCHECK(IsOnDeviceThread());
611 611
612 std::unique_ptr<VideoCaptureDevice> video_capture_device; 612 std::unique_ptr<VideoCaptureDevice> video_capture_device;
613 #if defined(ENABLE_SCREEN_CAPTURE) 613 #if defined(ENABLE_SCREEN_CAPTURE)
614 DesktopMediaID desktop_id = DesktopMediaID::Parse(id); 614 DesktopMediaID desktop_id = DesktopMediaID::Parse(id);
615 if (desktop_id.is_null()) { 615 if (desktop_id.is_null()) {
616 device_client->OnError(FROM_HERE, "Desktop media ID is null"); 616 device_client->OnError(FROM_HERE, "Desktop media ID is null");
617 return nullptr; 617 return nullptr;
618 } 618 }
619 619
620 if (desktop_id.type == DesktopMediaID::TYPE_WEB_CONTENTS) { 620 if (desktop_id.type == DesktopMediaID::TYPE_WEB_CONTENTS) {
621 video_capture_device.reset(WebContentsVideoCaptureDevice::Create(id)); 621 video_capture_device = WebContentsVideoCaptureDevice::Create(id);
622 IncrementDesktopCaptureCounter(TAB_VIDEO_CAPTURER_CREATED); 622 IncrementDesktopCaptureCounter(TAB_VIDEO_CAPTURER_CREATED);
623 } else { 623 } else {
624 #if defined(USE_AURA) 624 #if defined(USE_AURA)
625 video_capture_device = DesktopCaptureDeviceAura::Create(desktop_id); 625 video_capture_device = DesktopCaptureDeviceAura::Create(desktop_id);
626 #endif 626 #endif
627 if (!video_capture_device) 627 if (!video_capture_device)
628 video_capture_device = DesktopCaptureDevice::Create(desktop_id); 628 video_capture_device = DesktopCaptureDevice::Create(desktop_id);
629 } 629 }
630 #endif // defined(ENABLE_SCREEN_CAPTURE) 630 #endif // defined(ENABLE_SCREEN_CAPTURE)
631 631
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 if (!device_in_queue) { 1262 if (!device_in_queue) {
1263 // Session ID is only valid for Screen capture. So we can fake it to 1263 // Session ID is only valid for Screen capture. So we can fake it to
1264 // resume video capture devices here. 1264 // resume video capture devices here.
1265 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); 1265 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters);
1266 } 1266 }
1267 } 1267 }
1268 } 1268 }
1269 #endif // defined(OS_ANDROID) 1269 #endif // defined(OS_ANDROID)
1270 1270
1271 } // namespace content 1271 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698