Skip to content

Commit

Permalink
Remove IAudioHandler
Browse files Browse the repository at this point in the history
The Chromium implementation has changed so dramatically that CEF has removed support see https://bitbucket.org/chromiumembedded/cef/commits/1f893c76a97eaa88e3ff782b8e2e47dd0f5d27b2

Track https://bitbucket.org/chromiumembedded/cef/issues/2755/reimplement-audio-mirroring-for for details on when it will be reimplemented

Original Issue #2727
  • Loading branch information
amaitland committed Oct 1, 2019
1 parent c270d0a commit 802bb7f
Show file tree
Hide file tree
Showing 13 changed files with 5 additions and 359 deletions.
36 changes: 0 additions & 36 deletions CefSharp.Core/Internals/ClientAdapter.cpp
Expand Up @@ -978,42 +978,6 @@ namespace CefSharp
}
}

void ClientAdapter::OnAudioStreamStarted(CefRefPtr<CefBrowser> browser, int audio_stream_id, int channels, ChannelLayout channel_layout, int sample_rate, int frames_per_buffer)
{
auto handler = _browserControl->AudioHandler;

if (handler != nullptr)
{
auto browserWrapper = GetBrowserWrapper(browser->GetIdentifier(), browser->IsPopup());

handler->OnAudioStreamStarted(_browserControl, browserWrapper, audio_stream_id, channels, (CefSharp::Enums::ChannelLayout)channel_layout, sample_rate, frames_per_buffer);
}
}

void ClientAdapter::OnAudioStreamPacket(CefRefPtr<CefBrowser> browser, int audio_stream_id, const float** data, int frames, int64 pts)
{
auto handler = _browserControl->AudioHandler;

if (handler != nullptr)
{
auto browserWrapper = GetBrowserWrapper(browser->GetIdentifier(), browser->IsPopup());

handler->OnAudioStreamPacket(_browserControl, browserWrapper, audio_stream_id, IntPtr((void *)data), frames, pts);
}
}

void ClientAdapter::OnAudioStreamStopped(CefRefPtr<CefBrowser> browser, int audio_stream_id)
{
auto handler = _browserControl->AudioHandler;

if (handler != nullptr)
{
auto browserWrapper = GetBrowserWrapper(browser->GetIdentifier(), browser->IsPopup());

handler->OnAudioStreamStopped(_browserControl, browserWrapper, audio_stream_id);
}
}

bool ClientAdapter::OnProcessMessageReceived(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefProcessId source_process, CefRefPtr<CefProcessMessage> message)
{
auto handled = false;
Expand Down
19 changes: 1 addition & 18 deletions CefSharp.Core/Internals/ClientAdapter.h
Expand Up @@ -32,8 +32,7 @@ namespace CefSharp
public CefDialogHandler,
public CefDragHandler,
public CefDownloadHandler,
public CefFindHandler,
public CefAudioHandler
public CefFindHandler
{
private:
gcroot<IWebBrowserInternal^> _browserControl;
Expand Down Expand Up @@ -101,17 +100,6 @@ namespace CefSharp
virtual DECL CefRefPtr<CefDialogHandler> GetDialogHandler() OVERRIDE { return this; }
virtual DECL CefRefPtr<CefDragHandler> GetDragHandler() OVERRIDE { return this; }
virtual DECL CefRefPtr<CefFindHandler> GetFindHandler() OVERRIDE { return this; }
virtual DECL CefRefPtr<CefAudioHandler> GetAudioHandler() OVERRIDE
{
//Audio Mirroring in CEF is only enabled when we a handler is returned
//We return NULL if no handler is specified for performance reasons
if (_browserControl->AudioHandler == nullptr)
{
return NULL;
}

return this;
}
virtual DECL bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefProcessId source_process, CefRefPtr<CefProcessMessage> message) OVERRIDE;


Expand Down Expand Up @@ -202,11 +190,6 @@ namespace CefSharp
//CefFindHandler
virtual DECL void OnFindResult(CefRefPtr<CefBrowser> browser, int identifier, int count, const CefRect& selectionRect, int activeMatchOrdinal, bool finalUpdate) OVERRIDE;

//CefAudioHandler
virtual DECL void OnAudioStreamStarted(CefRefPtr<CefBrowser> browser, int audio_stream_id, int channels, ChannelLayout channel_layout, int sample_rate, int frames_per_buffer) OVERRIDE;
virtual DECL void OnAudioStreamPacket(CefRefPtr<CefBrowser> browser, int audio_stream_id, const float** data, int frames, int64 pts) OVERRIDE;
virtual DECL void OnAudioStreamStopped(CefRefPtr<CefBrowser> browser, int audio_stream_id) OVERRIDE;

IMPLEMENT_REFCOUNTING(ClientAdapter);
};
}
Expand Down
1 change: 0 additions & 1 deletion CefSharp.Example/CefSharp.Example.csproj
Expand Up @@ -72,7 +72,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Callback\RunFileDialogCallback.cs" />
<Compile Include="Handlers\AudioHandler.cs" />
<Compile Include="Handlers\ExampleResourceRequestHandler.cs" />
<Compile Include="Handlers\ExtensionHandler.cs" />
<Compile Include="JavascriptBinding\AsyncBoundObject.cs" />
Expand Down
35 changes: 0 additions & 35 deletions CefSharp.Example/Handlers/AudioHandler.cs

This file was deleted.

6 changes: 2 additions & 4 deletions CefSharp.OffScreen/ChromiumWebBrowser.cs
Expand Up @@ -183,15 +183,13 @@ public bool IsDisposed
/// </summary>
/// <value>The find handler.</value>
public IFindHandler FindHandler { get; set; }
/// <summary>
/// Implement <see cref="IAudioHandler" /> to handle audio events.
/// </summary>
public IAudioHandler AudioHandler { get; set; }

/// <summary>
/// Implement <see cref="IAccessibilityHandler" /> to handle events related to accessibility.
/// </summary>
/// <value>The accessibility handler.</value>
public IAccessibilityHandler AccessibilityHandler { get; set; }

/// <summary>
/// Event handler that will get called when the resource load for a navigation fails or is canceled.
/// It's important to note this event is fired on a CEF UI thread, which by default is not the same as your application UI
Expand Down
5 changes: 0 additions & 5 deletions CefSharp.WinForms/ChromiumWebBrowser.cs
Expand Up @@ -230,11 +230,6 @@ public IRequestContext RequestContext
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), DefaultValue(null)]
public IFindHandler FindHandler { get; set; }
/// <summary>
/// Implement <see cref="IAudioHandler" /> to handle audio events.
/// </summary>
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), DefaultValue(null)]
public IAudioHandler AudioHandler { get; set; }
/// <summary>
/// The <see cref="IFocusHandler" /> for this ChromiumWebBrowser.
/// </summary>
/// <value>The focus handler.</value>
Expand Down
3 changes: 1 addition & 2 deletions CefSharp.Wpf.Example/Views/BrowserTabView.xaml.cs
Expand Up @@ -99,7 +99,6 @@ public BrowserTabView()
downloadHandler.OnBeforeDownloadFired += OnBeforeDownloadFired;
downloadHandler.OnDownloadUpdatedFired += OnDownloadUpdatedFired;
browser.DownloadHandler = downloadHandler;
browser.AudioHandler = new AudioHandler();

//Read an embedded bitmap into a memory stream then register it as a resource you can then load custom://cefsharp/images/beach.jpg
var beachImageStream = new MemoryStream();
Expand Down Expand Up @@ -148,7 +147,7 @@ public BrowserTabView()
var errorBody = string.Format("<html><body bgcolor=\"white\"><h2>Failed to load URL {0} with error {1} ({2}).</h2></body></html>",
args.FailedUrl, args.ErrorText, args.ErrorCode);
args.Frame.LoadHtml(errorBody, base64Encode: true);
args.Frame.LoadHtml(errorBody, base64Encode:true);
};

CefExample.RegisterTestResources(browser);
Expand Down
5 changes: 1 addition & 4 deletions CefSharp.Wpf/ChromiumWebBrowser.cs
Expand Up @@ -279,10 +279,7 @@ public IRequestContext RequestContext
/// </summary>
/// <value>The find handler.</value>
public IFindHandler FindHandler { get; set; }
/// <summary>
/// Implement <see cref="IAudioHandler" /> to handle audio events.
/// </summary>
public IAudioHandler AudioHandler { get; set; }

/// <summary>
/// Implement <see cref="IAccessibilityHandler" /> to handle events related to accessibility.
/// </summary>
Expand Down
2 changes: 0 additions & 2 deletions CefSharp/CefSharp.csproj
Expand Up @@ -108,7 +108,6 @@
<Compile Include="ResourceRequestHandlerFactory.cs" />
<Compile Include="ResourceRequestHandlerFactoryItem.cs" />
<Compile Include="Enums\AlphaType.cs" />
<Compile Include="Enums\ChannelLayout.cs" />
<Compile Include="Enums\PointerType.cs" />
<Compile Include="Enums\TextInputMode.cs" />
<Compile Include="Enums\TouchEventType.cs" />
Expand All @@ -128,7 +127,6 @@
<Compile Include="Handler\ICookieAccessFilter.cs" />
<Compile Include="Handler\IResourceRequestHandler.cs" />
<Compile Include="IApp.cs" />
<Compile Include="Handler\IAudioHandler.cs" />
<Compile Include="IExtension.cs" />
<Compile Include="Internals\IMethodRunnerQueue.cs" />
<Compile Include="Internals\ConcurrentMethodRunnerQueue.cs" />
Expand Down
187 changes: 0 additions & 187 deletions CefSharp/Enums/ChannelLayout.cs

This file was deleted.

0 comments on commit 802bb7f

Please sign in to comment.