diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-11-24 14:43:00 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-11-24 14:43:00 +0100 |
commit | fda31ac6feae28b76e8cc4855cad87816fa27569 (patch) | |
tree | 3f1ec3858c0defff72bcee5ba97e80a00c99f4e7 /src/core/media_capture_devices_dispatcher.cpp | |
parent | a6a9a65e3ac7d1cd255cbe74df7070c091941216 (diff) | |
parent | 5537ff4437ea7a5f9ea140071343f88bf48deddc (diff) |
Merge remote-tracking branch 'origin/5.15.2' into 5.15
Change-Id: I516761e18c03c6cfd4d44a6ee176a2add9a5b022
Diffstat (limited to 'src/core/media_capture_devices_dispatcher.cpp')
-rw-r--r-- | src/core/media_capture_devices_dispatcher.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/core/media_capture_devices_dispatcher.cpp b/src/core/media_capture_devices_dispatcher.cpp index ecc3347f8..65c3df06a 100644 --- a/src/core/media_capture_devices_dispatcher.cpp +++ b/src/core/media_capture_devices_dispatcher.cpp @@ -322,7 +322,8 @@ void MediaCaptureDevicesDispatcher::handleMediaAccessPermissionResponse(content: break; } } else if (desktopVideoRequested) { - getDevicesForDesktopCapture(&devices, getDefaultScreenId(), desktopAudioRequested, + bool captureAudio = desktopAudioRequested && m_loopbackAudioSupported; + getDevicesForDesktopCapture(&devices, getDefaultScreenId(), captureAudio, request.video_type, request.audio_type); } } @@ -359,6 +360,10 @@ MediaCaptureDevicesDispatcher::MediaCaptureDevicesDispatcher() // content::NOTIFICATION_WEB_CONTENTS_DESTROYED, and that will result in // possible use after free. DCHECK_CURRENTLY_ON(BrowserThread::UI); +#if defined(OS_WIN) + // Currently loopback audio capture is supported only on Windows. + m_loopbackAudioSupported = true; +#endif m_notificationsRegistrar.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, content::NotificationService::AllSources()); } @@ -433,9 +438,11 @@ void MediaCaptureDevicesDispatcher::processDesktopCaptureAccessRequest(content:: } // Audio is only supported for screen capture streams. - bool capture_audio = (mediaId.type == content::DesktopMediaID::TYPE_SCREEN && request.audio_type == MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE); + bool audioRequested = request.audio_type == MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE; + bool audioSupported = (mediaId.type == content::DesktopMediaID::TYPE_SCREEN && m_loopbackAudioSupported); + bool captureAudio = (audioRequested && audioSupported); - getDevicesForDesktopCapture(&devices, mediaId, capture_audio, request.video_type, request.audio_type); + getDevicesForDesktopCapture(&devices, mediaId, captureAudio, request.video_type, request.audio_type); if (devices.empty()) std::move(callback).Run(devices, MediaStreamRequestResult::INVALID_STATE, |