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

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: Nit Created 4 years, 2 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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 585
586 std::unique_ptr<media::VideoCaptureDevice> 586 std::unique_ptr<media::VideoCaptureDevice>
587 VideoCaptureManager::DoStartTabCaptureOnDeviceThread( 587 VideoCaptureManager::DoStartTabCaptureOnDeviceThread(
588 const std::string& id, 588 const std::string& id,
589 const media::VideoCaptureParams& params, 589 const media::VideoCaptureParams& params,
590 std::unique_ptr<VideoCaptureDevice::Client> device_client) { 590 std::unique_ptr<VideoCaptureDevice::Client> device_client) {
591 SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StartDeviceTime"); 591 SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StartDeviceTime");
592 DCHECK(IsOnDeviceThread()); 592 DCHECK(IsOnDeviceThread());
593 593
594 std::unique_ptr<VideoCaptureDevice> video_capture_device; 594 std::unique_ptr<VideoCaptureDevice> video_capture_device;
595 video_capture_device.reset(WebContentsVideoCaptureDevice::Create(id)); 595 video_capture_device = WebContentsVideoCaptureDevice::Create(id);
596 596
597 if (!video_capture_device) { 597 if (!video_capture_device) {
598 device_client->OnError(FROM_HERE, "Could not create capture device"); 598 device_client->OnError(FROM_HERE, "Could not create capture device");
599 return nullptr; 599 return nullptr;
600 } 600 }
601 601
602 video_capture_device->AllocateAndStart(params, std::move(device_client)); 602 video_capture_device->AllocateAndStart(params, std::move(device_client));
603 return video_capture_device; 603 return video_capture_device;
604 } 604 }
605 605
606 std::unique_ptr<media::VideoCaptureDevice> 606 std::unique_ptr<media::VideoCaptureDevice>
607 VideoCaptureManager::DoStartDesktopCaptureOnDeviceThread( 607 VideoCaptureManager::DoStartDesktopCaptureOnDeviceThread(
608 const std::string& id, 608 const std::string& id,
609 const media::VideoCaptureParams& params, 609 const media::VideoCaptureParams& params,
610 std::unique_ptr<VideoCaptureDevice::Client> device_client) { 610 std::unique_ptr<VideoCaptureDevice::Client> device_client) {
611 SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StartDeviceTime"); 611 SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StartDeviceTime");
612 DCHECK(IsOnDeviceThread()); 612 DCHECK(IsOnDeviceThread());
613 613
614 std::unique_ptr<VideoCaptureDevice> video_capture_device; 614 std::unique_ptr<VideoCaptureDevice> video_capture_device;
615 #if defined(ENABLE_SCREEN_CAPTURE) 615 #if defined(ENABLE_SCREEN_CAPTURE)
616 DesktopMediaID desktop_id = DesktopMediaID::Parse(id); 616 DesktopMediaID desktop_id = DesktopMediaID::Parse(id);
617 if (desktop_id.is_null()) { 617 if (desktop_id.is_null()) {
618 device_client->OnError(FROM_HERE, "Desktop media ID is null"); 618 device_client->OnError(FROM_HERE, "Desktop media ID is null");
619 return nullptr; 619 return nullptr;
620 } 620 }
621 621
622 if (desktop_id.type == DesktopMediaID::TYPE_WEB_CONTENTS) { 622 if (desktop_id.type == DesktopMediaID::TYPE_WEB_CONTENTS) {
623 video_capture_device.reset(WebContentsVideoCaptureDevice::Create(id)); 623 video_capture_device = WebContentsVideoCaptureDevice::Create(id);
624 IncrementDesktopCaptureCounter(TAB_VIDEO_CAPTURER_CREATED); 624 IncrementDesktopCaptureCounter(TAB_VIDEO_CAPTURER_CREATED);
625 if (desktop_id.audio_share) { 625 if (desktop_id.audio_share) {
626 IncrementDesktopCaptureCounter(TAB_VIDEO_CAPTURER_CREATED_WITH_AUDIO); 626 IncrementDesktopCaptureCounter(TAB_VIDEO_CAPTURER_CREATED_WITH_AUDIO);
627 } else { 627 } else {
628 IncrementDesktopCaptureCounter(TAB_VIDEO_CAPTURER_CREATED_WITHOUT_AUDIO); 628 IncrementDesktopCaptureCounter(TAB_VIDEO_CAPTURER_CREATED_WITHOUT_AUDIO);
629 } 629 }
630 } else { 630 } else {
631 #if defined(OS_ANDROID) 631 #if defined(OS_ANDROID)
632 video_capture_device = base::MakeUnique<ScreenCaptureDeviceAndroid>(); 632 video_capture_device = base::MakeUnique<ScreenCaptureDeviceAndroid>();
633 #elif defined(USE_AURA) 633 #elif defined(USE_AURA)
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 if (!device_in_queue) { 1264 if (!device_in_queue) {
1265 // Session ID is only valid for Screen capture. So we can fake it to 1265 // Session ID is only valid for Screen capture. So we can fake it to
1266 // resume video capture devices here. 1266 // resume video capture devices here.
1267 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); 1267 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters);
1268 } 1268 }
1269 } 1269 }
1270 } 1270 }
1271 #endif // defined(OS_ANDROID) 1271 #endif // defined(OS_ANDROID)
1272 1272
1273 } // namespace content 1273 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698