Re-implement audio capturing based on the AudioService API (fixes issue #2755)

This commit is contained in:
Mike Wiedenbauer
2020-05-01 18:18:18 +00:00
committed by Marshall Greenblatt
parent d65483ae16
commit 8d01442d75
24 changed files with 2210 additions and 6 deletions

View File

@ -48,6 +48,7 @@ class Widget;
}
#endif // defined(USE_AURA)
class CefAudioCapturer;
class CefBrowserInfo;
class CefBrowserPlatformDelegate;
class CefDevToolsFrontend;
@ -486,6 +487,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
base::ProcessId plugin_pid) override;
void DidUpdateFaviconURL(
const std::vector<blink::mojom::FaviconURLPtr>& candidates) override;
void OnAudioStateChanged(bool audible) override;
bool OnMessageReceived(const IPC::Message& message) override;
bool OnMessageReceived(const IPC::Message& message,
content::RenderFrameHost* render_frame_host) override;
@ -505,6 +507,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
bool HasObserver(Observer* observer) const;
class NavigationLock final {
private:
friend class CefBrowserHostImpl;
@ -585,6 +588,10 @@ class CefBrowserHostImpl : public CefBrowserHost,
void ConfigureAutoResize();
void StartAudioCapturer();
void OnRecentlyAudibleTimerFired();
CefBrowserSettings settings_;
CefRefPtr<CefClient> client_;
scoped_refptr<CefBrowserInfo> browser_info_;
@ -667,6 +674,14 @@ class CefBrowserHostImpl : public CefBrowserHost,
CefRefPtr<CefExtension> extension_;
bool is_background_host_ = false;
// Used for capturing audio for CefAudioHandler.
std::unique_ptr<CefAudioCapturer> audio_capturer_;
// Timer for determining when "recently audible" transitions to false. This
// starts running when a tab stops being audible, and is canceled if it starts
// being audible again before it fires.
base::OneShotTimer recently_audible_timer_;
// Used with auto-resize.
bool auto_resize_enabled_ = false;
gfx::Size auto_resize_min_;