From 1f893c76a97eaa88e3ff782b8e2e47dd0f5d27b2 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Fri, 20 Sep 2019 16:56:57 +0300 Subject: [PATCH] Revert "Add ability to capture audio output to buffer (see issue #2381)" This reverts commit 9f41a27e586a6b557fc171d2f03b332c1338e8d2. This needs to be reimplemented to support out of process audio (see issue #2755). --- BUILD.gn | 4 - cef_paths.gypi | 8 +- cef_paths2.gypi | 1 - include/capi/cef_audio_handler_capi.h | 110 --- include/capi/cef_client_capi.h | 9 +- include/cef_api_hash.h | 10 +- include/cef_audio_handler.h | 98 --- include/cef_client.h | 7 - include/internal/cef_types.h | 111 --- libcef/browser/audio_mirror_destination.cc | 107 --- libcef/browser/audio_mirror_destination.h | 83 -- libcef/browser/audio_push_sink.cc | 172 ---- libcef/browser/audio_push_sink.h | 54 -- libcef/browser/browser_host_impl.cc | 28 - libcef/browser/browser_host_impl.h | 9 - libcef/common/main_delegate.cc | 7 - libcef_dll/cpptoc/audio_handler_cpptoc.cc | 128 --- libcef_dll/cpptoc/audio_handler_cpptoc.h | 37 - libcef_dll/cpptoc/client_cpptoc.cc | 20 +- libcef_dll/ctocpp/audio_handler_ctocpp.cc | 120 --- libcef_dll/ctocpp/audio_handler_ctocpp.h | 52 -- libcef_dll/ctocpp/client_ctocpp.cc | 18 +- libcef_dll/ctocpp/client_ctocpp.h | 3 +- libcef_dll/wrapper_types.h | 3 +- tests/ceftests/audio_output_unittest.cc | 923 --------------------- tests/ceftests/client_app_delegates.cc | 4 - tools/cef_parser.py | 1 - 27 files changed, 11 insertions(+), 2116 deletions(-) delete mode 100644 include/capi/cef_audio_handler_capi.h delete mode 100644 include/cef_audio_handler.h delete mode 100644 libcef/browser/audio_mirror_destination.cc delete mode 100644 libcef/browser/audio_mirror_destination.h delete mode 100644 libcef/browser/audio_push_sink.cc delete mode 100644 libcef/browser/audio_push_sink.h delete mode 100644 libcef_dll/cpptoc/audio_handler_cpptoc.cc delete mode 100644 libcef_dll/cpptoc/audio_handler_cpptoc.h delete mode 100644 libcef_dll/ctocpp/audio_handler_ctocpp.cc delete mode 100644 libcef_dll/ctocpp/audio_handler_ctocpp.h delete mode 100644 tests/ceftests/audio_output_unittest.cc diff --git a/BUILD.gn b/BUILD.gn index 873afb382..f5dd5cadf 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -364,10 +364,6 @@ if (is_win) { static_library("libcef_static") { sources = gypi_paths2.includes_common + gypi_paths.autogen_cpp_includes + [ - "libcef/browser/audio_mirror_destination.cc", - "libcef/browser/audio_mirror_destination.h", - "libcef/browser/audio_push_sink.cc", - "libcef/browser/audio_push_sink.h", "libcef/browser/browser_context.cc", "libcef/browser/browser_context.h", "libcef/browser/browser_context_keyed_service_factories.cc", diff --git a/cef_paths.gypi b/cef_paths.gypi index 5784ff7b6..40328e342 100644 --- a/cef_paths.gypi +++ b/cef_paths.gypi @@ -8,7 +8,7 @@ # by hand. See the translator.README.txt file in the tools directory for # more information. # -# $hash=a8e80ae73a0d30776c2e6aaceaf9dbd4031f6c74$ +# $hash=9e6f93e99114085f9251881661e562357608b75a$ # { @@ -16,7 +16,6 @@ 'autogen_cpp_includes': [ 'include/cef_accessibility_handler.h', 'include/cef_app.h', - 'include/cef_audio_handler.h', 'include/cef_auth_callback.h', 'include/cef_browser.h', 'include/cef_browser_process_handler.h', @@ -110,7 +109,6 @@ 'autogen_capi_includes': [ 'include/capi/cef_accessibility_handler_capi.h', 'include/capi/cef_app_capi.h', - 'include/capi/cef_audio_handler_capi.h', 'include/capi/cef_auth_callback_capi.h', 'include/capi/cef_browser_capi.h', 'include/capi/cef_browser_process_handler_capi.h', @@ -206,8 +204,6 @@ 'libcef_dll/ctocpp/accessibility_handler_ctocpp.h', 'libcef_dll/ctocpp/app_ctocpp.cc', 'libcef_dll/ctocpp/app_ctocpp.h', - 'libcef_dll/ctocpp/audio_handler_ctocpp.cc', - 'libcef_dll/ctocpp/audio_handler_ctocpp.h', 'libcef_dll/cpptoc/auth_callback_cpptoc.cc', 'libcef_dll/cpptoc/auth_callback_cpptoc.h', 'libcef_dll/cpptoc/before_download_callback_cpptoc.cc', @@ -498,8 +494,6 @@ 'libcef_dll/cpptoc/accessibility_handler_cpptoc.h', 'libcef_dll/cpptoc/app_cpptoc.cc', 'libcef_dll/cpptoc/app_cpptoc.h', - 'libcef_dll/cpptoc/audio_handler_cpptoc.cc', - 'libcef_dll/cpptoc/audio_handler_cpptoc.h', 'libcef_dll/ctocpp/auth_callback_ctocpp.cc', 'libcef_dll/ctocpp/auth_callback_ctocpp.h', 'libcef_dll/ctocpp/before_download_callback_ctocpp.cc', diff --git a/cef_paths2.gypi b/cef_paths2.gypi index 410523e4a..09f6047fd 100644 --- a/cef_paths2.gypi +++ b/cef_paths2.gypi @@ -444,7 +444,6 @@ 'tests/cefsimple/simple_handler_linux.cc', ], 'ceftests_sources_common': [ - 'tests/ceftests/audio_output_unittest.cc', 'tests/ceftests/browser_info_map_unittest.cc', 'tests/ceftests/command_line_unittest.cc', 'tests/ceftests/cookie_unittest.cc', diff --git a/include/capi/cef_audio_handler_capi.h b/include/capi/cef_audio_handler_capi.h deleted file mode 100644 index 920b7e1e3..000000000 --- a/include/capi/cef_audio_handler_capi.h +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) 2019 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// -// $hash=0385a38b6761c5dec07bb89a95a007ad3c11bea6$ -// - -#ifndef CEF_INCLUDE_CAPI_CEF_AUDIO_HANDLER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_AUDIO_HANDLER_CAPI_H_ -#pragma once - -#include "include/capi/cef_base_capi.h" -#include "include/capi/cef_browser_capi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/// -// Implement this structure to handle audio events All functions will be called -// on the UI thread -/// -typedef struct _cef_audio_handler_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Called when the stream identified by |audio_stream_id| has started. - // |audio_stream_id| will uniquely identify the stream across all future - // cef_audio_handler_t callbacks. OnAudioSteamStopped will always be called - // after OnAudioStreamStarted; both functions may be called multiple times for - // the same stream. |channels| is the number of channels, |channel_layout| is - // the layout of the channels and |sample_rate| is the stream sample rate. - // |frames_per_buffer| is the maximum number of frames that will occur in the - // PCM packet passed to OnAudioStreamPacket. - /// - void(CEF_CALLBACK* on_audio_stream_started)( - struct _cef_audio_handler_t* self, - struct _cef_browser_t* browser, - int audio_stream_id, - int channels, - cef_channel_layout_t channel_layout, - int sample_rate, - int frames_per_buffer); - - /// - // Called when a PCM packet is received for the stream identified by - // |audio_stream_id|. |data| is an array representing the raw PCM data as a - // floating point type, i.e. 4-byte value(s). |frames| is the number of frames - // in the PCM packet. |pts| is the presentation timestamp (in milliseconds - // since the Unix Epoch) and represents the time at which the decompressed - // packet should be presented to the user. Based on |frames| and the - // |channel_layout| value passed to OnAudioStreamStarted you can calculate the - // size of the |data| array in bytes. - /// - void(CEF_CALLBACK* on_audio_stream_packet)(struct _cef_audio_handler_t* self, - struct _cef_browser_t* browser, - int audio_stream_id, - const float** data, - int frames, - int64 pts); - - /// - // Called when the stream identified by |audio_stream_id| has stopped. - // OnAudioSteamStopped will always be called after OnAudioStreamStarted; both - // functions may be called multiple times for the same stream. - /// - void(CEF_CALLBACK* on_audio_stream_stopped)(struct _cef_audio_handler_t* self, - struct _cef_browser_t* browser, - int audio_stream_id); -} cef_audio_handler_t; - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_AUDIO_HANDLER_CAPI_H_ diff --git a/include/capi/cef_client_capi.h b/include/capi/cef_client_capi.h index 3c8c32428..3ce2c0f61 100644 --- a/include/capi/cef_client_capi.h +++ b/include/capi/cef_client_capi.h @@ -33,14 +33,13 @@ // by hand. See the translator.README.txt file in the tools directory for // more information. // -// $hash=c8b6ce6786bb8369c3d9bb9e932a115fb379b145$ +// $hash=f7ae1e9818919482e8eb526badb9013b039f0558$ // #ifndef CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_ #define CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_ #pragma once -#include "include/capi/cef_audio_handler_capi.h" #include "include/capi/cef_base_capi.h" #include "include/capi/cef_context_menu_handler_capi.h" #include "include/capi/cef_dialog_handler_capi.h" @@ -70,12 +69,6 @@ typedef struct _cef_client_t { /// cef_base_ref_counted_t base; - /// - // Return the handler for audio rendering events. - /// - struct _cef_audio_handler_t*(CEF_CALLBACK* get_audio_handler)( - struct _cef_client_t* self); - /// // Return the handler for context menus. If no handler is provided the default // implementation will be used. diff --git a/include/cef_api_hash.h b/include/cef_api_hash.h index 0f72f9375..7d009196f 100644 --- a/include/cef_api_hash.h +++ b/include/cef_api_hash.h @@ -34,7 +34,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=23774ff0da7e40bab8244ff4b661b1d9fed24107$ +// $hash=420dfefdb6497faaa2c0280ad70e66e0b7d37dfc$ // #ifndef CEF_INCLUDE_API_HASH_H_ @@ -47,13 +47,13 @@ // way that may cause binary incompatibility with other builds. The universal // hash value will change if any platform is affected whereas the platform hash // values will change only if that particular platform is affected. -#define CEF_API_HASH_UNIVERSAL "d04fc15ff27c5a8ee71fee4a88383e5c4bbb7b10" +#define CEF_API_HASH_UNIVERSAL "440be38b46f14493a9981a1d9282742a83b9070e" #if defined(OS_WIN) -#define CEF_API_HASH_PLATFORM "031426ad8eb80ee32fcf3605837cff8d3bbae3a4" +#define CEF_API_HASH_PLATFORM "e5386095f03ffc204bdeacac7a13275918c66eb1" #elif defined(OS_MACOSX) -#define CEF_API_HASH_PLATFORM "47422c9703f7c32013642707b976d299c72f42cb" +#define CEF_API_HASH_PLATFORM "1c87ca78fce1bd15cd78f33f8f4e1763d616556a" #elif defined(OS_LINUX) -#define CEF_API_HASH_PLATFORM "d333fdd7eee13c06f58e586513061ce121121e0b" +#define CEF_API_HASH_PLATFORM "0050dbeab6fe92dd6b954241224cb67c9d9ac23e" #endif #ifdef __cplusplus diff --git a/include/cef_audio_handler.h b/include/cef_audio_handler.h deleted file mode 100644 index a60990635..000000000 --- a/include/cef_audio_handler.h +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// The contents of this file must follow a specific format in order to -// support the CEF translator tool. See the translator.README.txt file in the -// tools directory for more information. -// - -#ifndef CEF_INCLUDE_CEF_AUDIO_HANDLER_H_ -#define CEF_INCLUDE_CEF_AUDIO_HANDLER_H_ -#pragma once - -#include "include/cef_base.h" -#include "include/cef_browser.h" - -/// -// Implement this interface to handle audio events -// All methods will be called on the UI thread -/// -/*--cef(source=client)--*/ -class CefAudioHandler : public virtual CefBaseRefCounted { - public: - typedef cef_channel_layout_t ChannelLayout; - - /// - // Called when the stream identified by |audio_stream_id| has started. - // |audio_stream_id| will uniquely identify the stream across all future - // CefAudioHandler callbacks. OnAudioSteamStopped will always be called after - // OnAudioStreamStarted; both methods may be called multiple times for the - // same stream. |channels| is the number of channels, |channel_layout| is the - // layout of the channels and |sample_rate| is the stream sample rate. - // |frames_per_buffer| is the maximum number of frames that will occur in the - // PCM packet passed to OnAudioStreamPacket. - /// - /*--cef()--*/ - virtual void OnAudioStreamStarted(CefRefPtr browser, - int audio_stream_id, - int channels, - ChannelLayout channel_layout, - int sample_rate, - int frames_per_buffer) = 0; - - /// - // Called when a PCM packet is received for the stream identified by - // |audio_stream_id|. |data| is an array representing the raw PCM data as a - // floating point type, i.e. 4-byte value(s). |frames| is the number of frames - // in the PCM packet. |pts| is the presentation timestamp (in milliseconds - // since the Unix Epoch) and represents the time at which the decompressed - // packet should be presented to the user. Based on |frames| and the - // |channel_layout| value passed to OnAudioStreamStarted you can calculate the - // size of the |data| array in bytes. - /// - /*--cef()--*/ - virtual void OnAudioStreamPacket(CefRefPtr browser, - int audio_stream_id, - const float** data, - int frames, - int64 pts) = 0; - - /// - // Called when the stream identified by |audio_stream_id| has stopped. - // OnAudioSteamStopped will always be called after OnAudioStreamStarted; both - // methods may be called multiple times for the same stream. - /// - /*--cef()--*/ - virtual void OnAudioStreamStopped(CefRefPtr browser, - int audio_stream_id) = 0; -}; - -#endif // CEF_INCLUDE_CEF_AUDIO_HANDLER_H_ diff --git a/include/cef_client.h b/include/cef_client.h index d4e3696f0..ce1c38450 100644 --- a/include/cef_client.h +++ b/include/cef_client.h @@ -38,7 +38,6 @@ #define CEF_INCLUDE_CEF_CLIENT_H_ #pragma once -#include "include/cef_audio_handler.h" #include "include/cef_base.h" #include "include/cef_context_menu_handler.h" #include "include/cef_dialog_handler.h" @@ -61,12 +60,6 @@ /*--cef(source=client,no_debugct_check)--*/ class CefClient : public virtual CefBaseRefCounted { public: - /// - // Return the handler for audio rendering events. - /// - /*--cef()--*/ - virtual CefRefPtr GetAudioHandler() { return NULL; } - /// // Return the handler for context menus. If no handler is provided the default // implementation will be used. diff --git a/include/internal/cef_types.h b/include/internal/cef_types.h index 782d44db5..87abf8bd8 100644 --- a/include/internal/cef_types.h +++ b/include/internal/cef_types.h @@ -2972,117 +2972,6 @@ typedef struct _cef_composition_underline_t { int thick; } cef_composition_underline_t; -/// -// Enumerates the various representations of the ordering of audio channels. -// Logged to UMA, so never reuse a value, always add new/greater ones! -// See media\base\channel_layout.h -/// -typedef enum { - CEF_CHANNEL_LAYOUT_NONE = 0, - CEF_CHANNEL_LAYOUT_UNSUPPORTED = 1, - - // Front C - CEF_CHANNEL_LAYOUT_MONO = 2, - - // Front L, Front R - CEF_CHANNEL_LAYOUT_STEREO = 3, - - // Front L, Front R, Back C - CEF_CHANNEL_LAYOUT_2_1 = 4, - - // Front L, Front R, Front C - CEF_CHANNEL_LAYOUT_SURROUND = 5, - - // Front L, Front R, Front C, Back C - CEF_CHANNEL_LAYOUT_4_0 = 6, - - // Front L, Front R, Side L, Side R - CEF_CHANNEL_LAYOUT_2_2 = 7, - - // Front L, Front R, Back L, Back R - CEF_CHANNEL_LAYOUT_QUAD = 8, - - // Front L, Front R, Front C, Side L, Side R - CEF_CHANNEL_LAYOUT_5_0 = 9, - - // Front L, Front R, Front C, LFE, Side L, Side R - CEF_CHANNEL_LAYOUT_5_1 = 10, - - // Front L, Front R, Front C, Back L, Back R - CEF_CHANNEL_LAYOUT_5_0_BACK = 11, - - // Front L, Front R, Front C, LFE, Back L, Back R - CEF_CHANNEL_LAYOUT_5_1_BACK = 12, - - // Front L, Front R, Front C, Side L, Side R, Back L, Back R - CEF_CHANNEL_LAYOUT_7_0 = 13, - - // Front L, Front R, Front C, LFE, Side L, Side R, Back L, Back R - CEF_CHANNEL_LAYOUT_7_1 = 14, - - // Front L, Front R, Front C, LFE, Side L, Side R, Front LofC, Front RofC - CEF_CHANNEL_LAYOUT_7_1_WIDE = 15, - - // Stereo L, Stereo R - CEF_CHANNEL_LAYOUT_STEREO_DOWNMIX = 16, - - // Stereo L, Stereo R, LFE - CEF_CHANNEL_LAYOUT_2POINT1 = 17, - - // Stereo L, Stereo R, Front C, LFE - CEF_CHANNEL_LAYOUT_3_1 = 18, - - // Stereo L, Stereo R, Front C, Rear C, LFE - CEF_CHANNEL_LAYOUT_4_1 = 19, - - // Stereo L, Stereo R, Front C, Side L, Side R, Back C - CEF_CHANNEL_LAYOUT_6_0 = 20, - - // Stereo L, Stereo R, Side L, Side R, Front LofC, Front RofC - CEF_CHANNEL_LAYOUT_6_0_FRONT = 21, - - // Stereo L, Stereo R, Front C, Rear L, Rear R, Rear C - CEF_CHANNEL_LAYOUT_HEXAGONAL = 22, - - // Stereo L, Stereo R, Front C, LFE, Side L, Side R, Rear Center - CEF_CHANNEL_LAYOUT_6_1 = 23, - - // Stereo L, Stereo R, Front C, LFE, Back L, Back R, Rear Center - CEF_CHANNEL_LAYOUT_6_1_BACK = 24, - - // Stereo L, Stereo R, Side L, Side R, Front LofC, Front RofC, LFE - CEF_CHANNEL_LAYOUT_6_1_FRONT = 25, - - // Front L, Front R, Front C, Side L, Side R, Front LofC, Front RofC - CEF_CHANNEL_LAYOUT_7_0_FRONT = 26, - - // Front L, Front R, Front C, LFE, Back L, Back R, Front LofC, Front RofC - CEF_CHANNEL_LAYOUT_7_1_WIDE_BACK = 27, - - // Front L, Front R, Front C, Side L, Side R, Rear L, Back R, Back C. - CEF_CHANNEL_LAYOUT_OCTAGONAL = 28, - - // Channels are not explicitly mapped to speakers. - CEF_CHANNEL_LAYOUT_DISCRETE = 29, - - // Front L, Front R, Front C. Front C contains the keyboard mic audio. This - // layout is only intended for input for WebRTC. The Front C channel - // is stripped away in the WebRTC audio input pipeline and never seen outside - // of that. - CEF_CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC = 30, - - // Front L, Front R, Side L, Side R, LFE - CEF_CHANNEL_LAYOUT_4_1_QUAD_SIDE = 31, - - // Actual channel layout is specified in the bitstream and the actual channel - // count is unknown at Chromium media pipeline level (useful for audio - // pass-through mode). - CEF_CHANNEL_LAYOUT_BITSTREAM = 32, - - // Max value, must always equal the largest entry ever logged. - CEF_CHANNEL_LAYOUT_MAX = CEF_CHANNEL_LAYOUT_BITSTREAM -} cef_channel_layout_t; - #ifdef __cplusplus } #endif diff --git a/libcef/browser/audio_mirror_destination.cc b/libcef/browser/audio_mirror_destination.cc deleted file mode 100644 index d74f83aca..000000000 --- a/libcef/browser/audio_mirror_destination.cc +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) 2018 The Chromium Embedded Framework Authors. -// Portions copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "libcef/browser/audio_mirror_destination.h" -#include "libcef/browser/audio_push_sink.h" - -#include "base/task/post_task.h" -#include "content/public/browser/browser_task_traits.h" -#include "media/base/bind_to_current_loop.h" - -CefAudioMirrorDestination::CefAudioMirrorDestination( - CefRefPtr browser, - CefRefPtr cef_audio_handler, - content::AudioMirroringManager* mirroring_manager) - : browser_(browser), - cef_audio_handler_(cef_audio_handler), - mirroring_manager_(mirroring_manager) { - DCHECK(mirroring_manager_); - - thread_checker_.DetachFromThread(); -} - -void CefAudioMirrorDestination::Start() { - DCHECK(thread_checker_.CalledOnValidThread()); - - base::PostTaskWithTraits( - FROM_HERE, {content::BrowserThread::IO}, - base::BindOnce(&content::AudioMirroringManager::StartMirroring, - base::Unretained(mirroring_manager_), - base::RetainedRef(this))); -} - -void CefAudioMirrorDestination::Stop() { - DCHECK(thread_checker_.CalledOnValidThread()); - - base::PostTaskWithTraits( - FROM_HERE, {content::BrowserThread::IO}, - base::BindOnce(&content::AudioMirroringManager::StopMirroring, - base::Unretained(mirroring_manager_), - base::RetainedRef(this))); -} - -// Asynchronously query whether this MirroringDestination wants to consume -// audio sourced from each of the |candidates|. |results_callback| is run -// to indicate which of them (or none) should have audio routed to this -// MirroringDestination. The second parameter of |results_callback| -// indicates whether the MirroringDestination wants either: 1) exclusive -// access to a diverted audio flow versus 2) a duplicate copy of the audio -// flow. |results_callback| must be run on the same thread as the one that -// called QueryForMatches(). -void CefAudioMirrorDestination::QueryForMatches( - const std::set& candidates, - MatchesCallback results_callback) { - base::PostTaskWithTraits( - FROM_HERE, {content::BrowserThread::UI}, - base::BindOnce(&CefAudioMirrorDestination::QueryForMatchesOnUIThread, - base::RetainedRef(this), candidates, - media::BindToCurrentLoop(std::move(results_callback)))); -} - -void CefAudioMirrorDestination::QueryForMatchesOnUIThread( - const std::set& candidates, - MatchesCallback results_callback) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - - std::set matches; - for (auto& candidate : candidates) { - CefRefPtr browser = - CefBrowserHostImpl::GetBrowserForFrameRoute(candidate.child_id, - candidate.frame_routing_id); - if (browser == browser_) { - matches.insert(candidate); - } - } - - std::move(results_callback).Run(matches, true); -} - -// Create a consumer of audio data in the format specified by |params|, and -// connect it as an input to mirroring. This is used to provide -// MirroringDestination with exclusive access to pull the audio flow from -// the source. When Close() is called on the returned AudioOutputStream, the -// input is disconnected and the object becomes invalid. -media::AudioOutputStream* CefAudioMirrorDestination::AddInput( - const media::AudioParameters& params) { - // TODO Check and add usage on CEF - return nullptr; -} - -// Create a consumer of audio data in the format specified by |params|, and -// connect it as an input to mirroring. This is used to provide -// MirroringDestination with duplicate audio data, which is pushed from the -// main audio flow. When Close() is called on the returned AudioPushSink, -// the input is disconnected and the object becomes invalid. -media::AudioPushSink* CefAudioMirrorDestination::AddPushInput( - const media::AudioParameters& params) { - return new CefAudioPushSink( - params, browser_, cef_audio_handler_, - base::Bind(&CefAudioMirrorDestination::ReleasePushInput, - base::RetainedRef(this))); -} - -void CefAudioMirrorDestination::ReleasePushInput(CefAudioPushSink* sink) { - delete sink; -} diff --git a/libcef/browser/audio_mirror_destination.h b/libcef/browser/audio_mirror_destination.h deleted file mode 100644 index e4b0caf08..000000000 --- a/libcef/browser/audio_mirror_destination.h +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2018 The Chromium Embedded Framework Authors. -// Portions copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CEF_LIBCEF_BROWSER_AUDIO_MIRROR_DESTINATION_H_ -#define CEF_LIBCEF_BROWSER_AUDIO_MIRROR_DESTINATION_H_ -#pragma once - -#include "include/cef_audio_handler.h" -#include "include/cef_base.h" -#include "libcef/browser/browser_host_impl.h" - -#include "base/callback.h" -#include "base/threading/thread_checker.h" -#include "content/browser/media/capture/audio_mirroring_manager.h" -#include "media/audio/audio_io.h" -#include "media/base/audio_converter.h" -#include "media/base/audio_parameters.h" - -class CefAudioPushSink; -class CefBrowserHostImpl; - -class CefAudioMirrorDestination - : public base::RefCountedThreadSafe, - public content::AudioMirroringManager::MirroringDestination { - public: - CefAudioMirrorDestination(CefRefPtr browser, - CefRefPtr cef_audio_handler, - content::AudioMirroringManager* mirroring_manager); - - // Start mirroring. This needs to be triggered on the IO thread. - void Start(); - - // Stop mirroring. This needs to be triggered on the IO thread. - void Stop(); - - // Asynchronously query whether this MirroringDestination wants to consume - // audio sourced from each of the |candidates|. |results_callback| is run - // to indicate which of them (or none) should have audio routed to this - // MirroringDestination. The second parameter of |results_callback| - // indicates whether the MirroringDestination wants either: 1) exclusive - // access to a diverted audio flow versus 2) a duplicate copy of the audio - // flow. |results_callback| must be run on the same thread as the one that - // called QueryForMatches(). - void QueryForMatches( - const std::set& candidates, - MatchesCallback results_callback) override; - - // Create a consumer of audio data in the format specified by |params|, and - // connect it as an input to mirroring. This is used to provide - // MirroringDestination with exclusive access to pull the audio flow from - // the source. When Close() is called on the returned AudioOutputStream, the - // input is disconnected and the object becomes invalid. - media::AudioOutputStream* AddInput( - const media::AudioParameters& params) override; - - // Create a consumer of audio data in the format specified by |params|, and - // connect it as an input to mirroring. This is used to provide - // MirroringDestination with duplicate audio data, which is pushed from the - // main audio flow. When Close() is called on the returned AudioPushSink, - // the input is disconnected and the object becomes invalid. - media::AudioPushSink* AddPushInput( - const media::AudioParameters& params) override; - - private: - friend class base::RefCountedThreadSafe; - - ~CefAudioMirrorDestination() override = default; - - void QueryForMatchesOnUIThread( - const std::set& candidates, - MatchesCallback results_callback); - void ReleasePushInput(CefAudioPushSink* sink); - - CefRefPtr browser_; - CefRefPtr cef_audio_handler_; - content::AudioMirroringManager* mirroring_manager_; - - base::ThreadChecker thread_checker_; -}; - -#endif // CEF_LIBCEF_BROWSER_AUDIO_MIRROR_DESTINATION_H_ diff --git a/libcef/browser/audio_push_sink.cc b/libcef/browser/audio_push_sink.cc deleted file mode 100644 index 10747f899..000000000 --- a/libcef/browser/audio_push_sink.cc +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright (c) 2018 The Chromium Embedded Framework Authors. -// Portions copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "libcef/browser/audio_push_sink.h" -#include "libcef/browser/thread_util.h" - -#include "base/bind.h" -#include "base/logging.h" -#include "media/base/audio_sample_types.h" -#include "media/base/data_buffer.h" - -using namespace media; - -namespace { -cef_channel_layout_t TranslateChannelLayout(ChannelLayout channel) { - switch (channel) { - case CHANNEL_LAYOUT_UNSUPPORTED: - return CEF_CHANNEL_LAYOUT_UNSUPPORTED; - case CHANNEL_LAYOUT_MONO: - return CEF_CHANNEL_LAYOUT_MONO; - case CHANNEL_LAYOUT_STEREO: - return CEF_CHANNEL_LAYOUT_STEREO; - case CHANNEL_LAYOUT_2_1: - return CEF_CHANNEL_LAYOUT_2_1; - case CHANNEL_LAYOUT_SURROUND: - return CEF_CHANNEL_LAYOUT_SURROUND; - case CHANNEL_LAYOUT_4_0: - return CEF_CHANNEL_LAYOUT_4_0; - case CHANNEL_LAYOUT_2_2: - return CEF_CHANNEL_LAYOUT_2_2; - case CHANNEL_LAYOUT_QUAD: - return CEF_CHANNEL_LAYOUT_QUAD; - case CHANNEL_LAYOUT_5_0: - return CEF_CHANNEL_LAYOUT_5_0; - case CHANNEL_LAYOUT_5_1: - return CEF_CHANNEL_LAYOUT_5_1; - case CHANNEL_LAYOUT_5_0_BACK: - return CEF_CHANNEL_LAYOUT_5_0_BACK; - case CHANNEL_LAYOUT_5_1_BACK: - return CEF_CHANNEL_LAYOUT_5_1_BACK; - case CHANNEL_LAYOUT_7_0: - return CEF_CHANNEL_LAYOUT_7_0; - case CHANNEL_LAYOUT_7_1: - return CEF_CHANNEL_LAYOUT_7_1; - case CHANNEL_LAYOUT_7_1_WIDE: - return CEF_CHANNEL_LAYOUT_7_1_WIDE; - case CHANNEL_LAYOUT_STEREO_DOWNMIX: - return CEF_CHANNEL_LAYOUT_STEREO_DOWNMIX; - case CHANNEL_LAYOUT_2POINT1: - return CEF_CHANNEL_LAYOUT_2POINT1; - case CHANNEL_LAYOUT_3_1: - return CEF_CHANNEL_LAYOUT_3_1; - case CHANNEL_LAYOUT_4_1: - return CEF_CHANNEL_LAYOUT_4_1; - case CHANNEL_LAYOUT_6_0: - return CEF_CHANNEL_LAYOUT_6_0; - case CHANNEL_LAYOUT_6_0_FRONT: - return CEF_CHANNEL_LAYOUT_6_0_FRONT; - case CHANNEL_LAYOUT_HEXAGONAL: - return CEF_CHANNEL_LAYOUT_HEXAGONAL; - case CHANNEL_LAYOUT_6_1: - return CEF_CHANNEL_LAYOUT_6_1; - case CHANNEL_LAYOUT_6_1_BACK: - return CEF_CHANNEL_LAYOUT_6_1_BACK; - case CHANNEL_LAYOUT_6_1_FRONT: - return CEF_CHANNEL_LAYOUT_6_1_FRONT; - case CHANNEL_LAYOUT_7_0_FRONT: - return CEF_CHANNEL_LAYOUT_7_0_FRONT; - case CHANNEL_LAYOUT_7_1_WIDE_BACK: - return CEF_CHANNEL_LAYOUT_7_1_WIDE_BACK; - case CHANNEL_LAYOUT_OCTAGONAL: - return CEF_CHANNEL_LAYOUT_OCTAGONAL; - case CHANNEL_LAYOUT_DISCRETE: - return CEF_CHANNEL_LAYOUT_DISCRETE; - case CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC: - return CEF_CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC; - case CHANNEL_LAYOUT_4_1_QUAD_SIDE: - return CEF_CHANNEL_LAYOUT_4_1_QUAD_SIDE; - case CHANNEL_LAYOUT_BITSTREAM: - return CEF_CHANNEL_LAYOUT_BITSTREAM; - case CHANNEL_LAYOUT_NONE: - return CEF_CHANNEL_LAYOUT_NONE; - } - return CEF_CHANNEL_LAYOUT_NONE; -} -} // namespace - -int CefAudioPushSink::audio_stream_id = 0; - -CefAudioPushSink::CefAudioPushSink(const AudioParameters& params, - CefRefPtr browser, - CefRefPtr cef_audio_handler, - const CloseCallback& callback) - : params_(params), - browser_(browser), - cef_audio_handler_(cef_audio_handler), - close_callback_(callback), - stop_stream_(false), - audio_stream_id_(++audio_stream_id) { - // Verify that our enum matches Chromium's values. - static_assert( - static_cast(CEF_CHANNEL_LAYOUT_MAX) == - static_cast(CHANNEL_LAYOUT_MAX), - "cef_channel_layout_t must match the ChannelLayout enum in Chromium"); - - DCHECK(params_.IsValid()); - DCHECK(browser); - DCHECK(cef_audio_handler); - - // VAOS can be constructed on any thread, but will DCHECK that all - // AudioOutputStream methods are called from the same thread. - thread_checker_.DetachFromThread(); - - base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::UI}, - base::BindOnce(&CefAudioPushSink::InitOnUIThread, - base::Unretained(this))); -} - -CefAudioPushSink::~CefAudioPushSink() = default; - -void CefAudioPushSink::InitOnUIThread() { - DCHECK(thread_checker_.CalledOnValidThread()); - - cef_audio_handler_->OnAudioStreamStarted( - browser_.get(), audio_stream_id_, params_.channels(), - TranslateChannelLayout(params_.channel_layout()), params_.sample_rate(), - params_.frames_per_buffer()); -} - -void CefAudioPushSink::OnData(std::unique_ptr source, - base::TimeTicks reference_time) { - // early exit if stream already stopped - if (stop_stream_) - return; - - if (!CEF_CURRENTLY_ON_UIT()) { - CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefAudioPushSink::OnData, - base::Unretained(this), - std::move(source), reference_time)); - return; - } - - const int channels = source->channels(); - std::vector data(channels); - for (int c = 0; c < channels; ++c) { - data[c] = source->channel(c); - } - // Add the packet to the buffer. - base::TimeDelta pts = reference_time - base::TimeTicks::UnixEpoch(); - cef_audio_handler_->OnAudioStreamPacket(browser_.get(), audio_stream_id_, - data.data(), source->frames(), - pts.InMilliseconds()); -} - -void CefAudioPushSink::Close() { - if (!CEF_CURRENTLY_ON_UIT()) { - CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefAudioPushSink::Close, - base::Unretained(this))); - return; - } - - if (!stop_stream_) { - stop_stream_ = true; - cef_audio_handler_->OnAudioStreamStopped(browser_.get(), audio_stream_id_); - - if (!close_callback_.is_null()) { - std::move(close_callback_).Run(this); - } - } -} diff --git a/libcef/browser/audio_push_sink.h b/libcef/browser/audio_push_sink.h deleted file mode 100644 index 097c12729..000000000 --- a/libcef/browser/audio_push_sink.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CEF_LIBCEF_BROWSER_AUDIO_PUSH_SINK_H_ -#define CEF_LIBCEF_BROWSER_AUDIO_PUSH_SINK_H_ -#pragma once - -#include "include/cef_audio_handler.h" -#include "include/cef_base.h" -#include "libcef/browser/browser_host_impl.h" - -#include "base/callback.h" -#include "base/memory/weak_ptr.h" -#include "base/message_loop/message_loop.h" -#include "base/threading/thread_checker.h" -#include "media/audio/audio_io.h" -#include "media/base/audio_converter.h" -#include "media/base/audio_parameters.h" -#include "media/base/channel_layout.h" - -class CefAudioPushSink : public media::AudioPushSink { - public: - typedef base::Callback CloseCallback; - - CefAudioPushSink(const media::AudioParameters& params, - CefRefPtr browser, - CefRefPtr cef_audio_handler, - const CloseCallback& callback); - virtual ~CefAudioPushSink(); - - void OnData(std::unique_ptr source, - base::TimeTicks reference_time) override; - void Close() override; - - private: - void InitOnUIThread(); - - const media::AudioParameters params_; - CefRefPtr browser_; - CefRefPtr cef_audio_handler_; - CloseCallback close_callback_; - - base::ThreadChecker thread_checker_; - - bool stop_stream_; - int audio_stream_id_; - - static int audio_stream_id; - - DISALLOW_COPY_AND_ASSIGN(CefAudioPushSink); -}; - -#endif // CEF_LIBCEF_BROWSER_AUDIO_PUSH_SINK_H_ diff --git a/libcef/browser/browser_host_impl.cc b/libcef/browser/browser_host_impl.cc index 51c28d4cd..c8ee66d98 100644 --- a/libcef/browser/browser_host_impl.cc +++ b/libcef/browser/browser_host_impl.cc @@ -8,7 +8,6 @@ #include #include -#include "libcef/browser/audio_mirror_destination.h" #include "libcef/browser/browser_context.h" #include "libcef/browser/browser_info.h" #include "libcef/browser/browser_info_manager.h" @@ -49,7 +48,6 @@ #include "chrome/browser/ui/prefs/prefs_tab_helper.h" #include "components/zoom/zoom_controller.h" #include "content/browser/gpu/compositor_util.h" -#include "content/browser/media/capture/audio_mirroring_manager.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/common/widget_messages.h" #include "content/public/browser/desktop_media_id.h" @@ -1543,8 +1541,6 @@ void CefBrowserHostImpl::DestroyBrowser() { menu_manager_->Destroy(); DestroyExtensionHost(); - StopAudioMirroring(); - // Notify any observers that may have state associated with this browser. for (auto& observer : observers_) observer.OnBrowserDestroyed(this); @@ -2768,28 +2764,6 @@ bool CefBrowserHostImpl::HasObserver(Observer* observer) const { return observers_.HasObserver(observer); } -bool CefBrowserHostImpl::StartAudioMirroring() { - if (client_.get()) { - CefRefPtr audio_handler = client_->GetAudioHandler(); - if (audio_handler.get()) { - audio_mirror_destination_ = new CefAudioMirrorDestination( - this, audio_handler, content::AudioMirroringManager::GetInstance()); - audio_mirror_destination_->Start(); - return true; - } - } - return false; -} - -bool CefBrowserHostImpl::StopAudioMirroring() { - if (audio_mirror_destination_.get()) { - audio_mirror_destination_->Stop(); - audio_mirror_destination_.reset(); - return true; - } - return false; -} - CefBrowserHostImpl::NavigationLock::NavigationLock( CefRefPtr browser) : browser_(browser) { @@ -2913,8 +2887,6 @@ CefBrowserHostImpl::CefBrowserHostImpl( // Make sure RenderViewCreated is called at least one time. RenderViewCreated(web_contents->GetRenderViewHost()); - StartAudioMirroring(); - // Associate the platform delegate with this browser. platform_delegate_->BrowserCreated(this); } diff --git a/libcef/browser/browser_host_impl.h b/libcef/browser/browser_host_impl.h index 383f1b19f..be9ce3021 100644 --- a/libcef/browser/browser_host_impl.h +++ b/libcef/browser/browser_host_impl.h @@ -15,7 +15,6 @@ #include "include/cef_client.h" #include "include/cef_frame.h" #include "include/views/cef_browser_view.h" -#include "libcef/browser/audio_mirror_destination.h" #include "libcef/browser/browser_info.h" #include "libcef/browser/file_dialog_manager.h" #include "libcef/browser/frame_host_impl.h" @@ -49,7 +48,6 @@ class Widget; } #endif // defined(USE_AURA) -class CefAudioMirrorDestination; class CefBrowserInfo; class CefBrowserPlatformDelegate; class CefDevToolsFrontend; @@ -502,10 +500,6 @@ class CefBrowserHostImpl : public CefBrowserHost, void AddObserver(Observer* observer); void RemoveObserver(Observer* observer); bool HasObserver(Observer* observer) const; - - bool StartAudioMirroring(); - bool StopAudioMirroring(); - class NavigationLock final { private: friend class CefBrowserHostImpl; @@ -668,9 +662,6 @@ class CefBrowserHostImpl : public CefBrowserHost, CefRefPtr extension_; bool is_background_host_ = false; - // Used to mirror audio streams - scoped_refptr audio_mirror_destination_; - // Used with auto-resize. bool auto_resize_enabled_ = false; gfx::Size auto_resize_min_; diff --git a/libcef/common/main_delegate.cc b/libcef/common/main_delegate.cc index d14ae4137..c832523e0 100644 --- a/libcef/common/main_delegate.cc +++ b/libcef/common/main_delegate.cc @@ -599,13 +599,6 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) { features::kMimeHandlerViewInCrossProcessFrame.name); } - if (features::kAudioServiceAudioStreams.default_state == - base::FEATURE_ENABLED_BY_DEFAULT) { - // TODO: Add support for audio service (see issue #2755) - disable_features.push_back( - features::kAudioServiceAudioStreams.name); - } - if (!disable_features.empty()) { DCHECK(!base::FeatureList::GetInstance()); std::string disable_features_str = diff --git a/libcef_dll/cpptoc/audio_handler_cpptoc.cc b/libcef_dll/cpptoc/audio_handler_cpptoc.cc deleted file mode 100644 index f1f8a3fde..000000000 --- a/libcef_dll/cpptoc/audio_handler_cpptoc.cc +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) 2019 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// -// $hash=7c55cffaa1094ff7aa49e7efbe8b4780867f6538$ -// - -#include "libcef_dll/cpptoc/audio_handler_cpptoc.h" -#include "libcef_dll/ctocpp/browser_ctocpp.h" -#include "libcef_dll/shutdown_checker.h" - -namespace { - -// MEMBER FUNCTIONS - Body may be edited by hand. - -void CEF_CALLBACK -audio_handler_on_audio_stream_started(struct _cef_audio_handler_t* self, - struct _cef_browser_t* browser, - int audio_stream_id, - int channels, - cef_channel_layout_t channel_layout, - int sample_rate, - int frames_per_buffer) { - shutdown_checker::AssertNotShutdown(); - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return; - - // Execute - CefAudioHandlerCppToC::Get(self)->OnAudioStreamStarted( - CefBrowserCToCpp::Wrap(browser), audio_stream_id, channels, - channel_layout, sample_rate, frames_per_buffer); -} - -void CEF_CALLBACK -audio_handler_on_audio_stream_packet(struct _cef_audio_handler_t* self, - struct _cef_browser_t* browser, - int audio_stream_id, - const float** data, - int frames, - int64 pts) { - shutdown_checker::AssertNotShutdown(); - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return; - // Verify param: data; type: simple_byaddr - DCHECK(data); - if (!data) - return; - - // Execute - CefAudioHandlerCppToC::Get(self)->OnAudioStreamPacket( - CefBrowserCToCpp::Wrap(browser), audio_stream_id, data, frames, pts); -} - -void CEF_CALLBACK -audio_handler_on_audio_stream_stopped(struct _cef_audio_handler_t* self, - struct _cef_browser_t* browser, - int audio_stream_id) { - shutdown_checker::AssertNotShutdown(); - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return; - - // Execute - CefAudioHandlerCppToC::Get(self)->OnAudioStreamStopped( - CefBrowserCToCpp::Wrap(browser), audio_stream_id); -} - -} // namespace - -// CONSTRUCTOR - Do not edit by hand. - -CefAudioHandlerCppToC::CefAudioHandlerCppToC() { - GetStruct()->on_audio_stream_started = audio_handler_on_audio_stream_started; - GetStruct()->on_audio_stream_packet = audio_handler_on_audio_stream_packet; - GetStruct()->on_audio_stream_stopped = audio_handler_on_audio_stream_stopped; -} - -// DESTRUCTOR - Do not edit by hand. - -CefAudioHandlerCppToC::~CefAudioHandlerCppToC() { - shutdown_checker::AssertNotShutdown(); -} - -template <> -CefRefPtr CefCppToCRefCounted< - CefAudioHandlerCppToC, - CefAudioHandler, - cef_audio_handler_t>::UnwrapDerived(CefWrapperType type, - cef_audio_handler_t* s) { - NOTREACHED() << "Unexpected class type: " << type; - return NULL; -} - -template <> -CefWrapperType CefCppToCRefCounted::kWrapperType = - WT_AUDIO_HANDLER; diff --git a/libcef_dll/cpptoc/audio_handler_cpptoc.h b/libcef_dll/cpptoc/audio_handler_cpptoc.h deleted file mode 100644 index 336193908..000000000 --- a/libcef_dll/cpptoc/audio_handler_cpptoc.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2019 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// -// $hash=7158e06e5c71ed020f193c698a2fdfd6d0b170c8$ -// - -#ifndef CEF_LIBCEF_DLL_CPPTOC_AUDIO_HANDLER_CPPTOC_H_ -#define CEF_LIBCEF_DLL_CPPTOC_AUDIO_HANDLER_CPPTOC_H_ -#pragma once - -#if !defined(WRAPPING_CEF_SHARED) -#error This file can be included wrapper-side only -#endif - -#include "include/capi/cef_audio_handler_capi.h" -#include "include/cef_audio_handler.h" -#include "libcef_dll/cpptoc/cpptoc_ref_counted.h" - -// Wrap a C++ class with a C structure. -// This class may be instantiated and accessed wrapper-side only. -class CefAudioHandlerCppToC : public CefCppToCRefCounted { - public: - CefAudioHandlerCppToC(); - virtual ~CefAudioHandlerCppToC(); -}; - -#endif // CEF_LIBCEF_DLL_CPPTOC_AUDIO_HANDLER_CPPTOC_H_ diff --git a/libcef_dll/cpptoc/client_cpptoc.cc b/libcef_dll/cpptoc/client_cpptoc.cc index 17f7bd8d6..e88e17840 100644 --- a/libcef_dll/cpptoc/client_cpptoc.cc +++ b/libcef_dll/cpptoc/client_cpptoc.cc @@ -9,11 +9,10 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=64b2576447d3776b829e06007036acf579b2c47c$ +// $hash=376e1cc8d7296348282ac0e9f74a1149bbb97780$ // #include "libcef_dll/cpptoc/client_cpptoc.h" -#include "libcef_dll/cpptoc/audio_handler_cpptoc.h" #include "libcef_dll/cpptoc/context_menu_handler_cpptoc.h" #include "libcef_dll/cpptoc/dialog_handler_cpptoc.h" #include "libcef_dll/cpptoc/display_handler_cpptoc.h" @@ -35,22 +34,6 @@ namespace { // MEMBER FUNCTIONS - Body may be edited by hand. -cef_audio_handler_t* CEF_CALLBACK -client_get_audio_handler(struct _cef_client_t* self) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return NULL; - - // Execute - CefRefPtr _retval = - CefClientCppToC::Get(self)->GetAudioHandler(); - - // Return type: refptr_same - return CefAudioHandlerCppToC::Wrap(_retval); -} - struct _cef_context_menu_handler_t* CEF_CALLBACK client_get_context_menu_handler(struct _cef_client_t* self) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING @@ -297,7 +280,6 @@ client_on_process_message_received(struct _cef_client_t* self, // CONSTRUCTOR - Do not edit by hand. CefClientCppToC::CefClientCppToC() { - GetStruct()->get_audio_handler = client_get_audio_handler; GetStruct()->get_context_menu_handler = client_get_context_menu_handler; GetStruct()->get_dialog_handler = client_get_dialog_handler; GetStruct()->get_display_handler = client_get_display_handler; diff --git a/libcef_dll/ctocpp/audio_handler_ctocpp.cc b/libcef_dll/ctocpp/audio_handler_ctocpp.cc deleted file mode 100644 index 013be2a41..000000000 --- a/libcef_dll/ctocpp/audio_handler_ctocpp.cc +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) 2019 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// -// $hash=c23055c6f30177626f9bf7946c6afed6c481d021$ -// - -#include "libcef_dll/ctocpp/audio_handler_ctocpp.h" -#include "libcef_dll/cpptoc/browser_cpptoc.h" -#include "libcef_dll/shutdown_checker.h" - -// VIRTUAL METHODS - Body may be edited by hand. - -NO_SANITIZE("cfi-icall") -void CefAudioHandlerCToCpp::OnAudioStreamStarted(CefRefPtr browser, - int audio_stream_id, - int channels, - ChannelLayout channel_layout, - int sample_rate, - int frames_per_buffer) { - shutdown_checker::AssertNotShutdown(); - - cef_audio_handler_t* _struct = GetStruct(); - if (CEF_MEMBER_MISSING(_struct, on_audio_stream_started)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: browser; type: refptr_diff - DCHECK(browser.get()); - if (!browser.get()) - return; - - // Execute - _struct->on_audio_stream_started(_struct, CefBrowserCppToC::Wrap(browser), - audio_stream_id, channels, channel_layout, - sample_rate, frames_per_buffer); -} - -NO_SANITIZE("cfi-icall") -void CefAudioHandlerCToCpp::OnAudioStreamPacket(CefRefPtr browser, - int audio_stream_id, - const float** data, - int frames, - int64 pts) { - shutdown_checker::AssertNotShutdown(); - - cef_audio_handler_t* _struct = GetStruct(); - if (CEF_MEMBER_MISSING(_struct, on_audio_stream_packet)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: browser; type: refptr_diff - DCHECK(browser.get()); - if (!browser.get()) - return; - // Verify param: data; type: simple_byaddr - DCHECK(data); - if (!data) - return; - - // Execute - _struct->on_audio_stream_packet(_struct, CefBrowserCppToC::Wrap(browser), - audio_stream_id, data, frames, pts); -} - -NO_SANITIZE("cfi-icall") -void CefAudioHandlerCToCpp::OnAudioStreamStopped(CefRefPtr browser, - int audio_stream_id) { - shutdown_checker::AssertNotShutdown(); - - cef_audio_handler_t* _struct = GetStruct(); - if (CEF_MEMBER_MISSING(_struct, on_audio_stream_stopped)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: browser; type: refptr_diff - DCHECK(browser.get()); - if (!browser.get()) - return; - - // Execute - _struct->on_audio_stream_stopped(_struct, CefBrowserCppToC::Wrap(browser), - audio_stream_id); -} - -// CONSTRUCTOR - Do not edit by hand. - -CefAudioHandlerCToCpp::CefAudioHandlerCToCpp() {} - -// DESTRUCTOR - Do not edit by hand. - -CefAudioHandlerCToCpp::~CefAudioHandlerCToCpp() { - shutdown_checker::AssertNotShutdown(); -} - -template <> -cef_audio_handler_t* -CefCToCppRefCounted::UnwrapDerived(CefWrapperType type, - CefAudioHandler* c) { - NOTREACHED() << "Unexpected class type: " << type; - return NULL; -} - -template <> -CefWrapperType CefCToCppRefCounted::kWrapperType = - WT_AUDIO_HANDLER; diff --git a/libcef_dll/ctocpp/audio_handler_ctocpp.h b/libcef_dll/ctocpp/audio_handler_ctocpp.h deleted file mode 100644 index a320822d3..000000000 --- a/libcef_dll/ctocpp/audio_handler_ctocpp.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2019 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// -// $hash=1ef8824abe88f3c6258ae3e9cb513c7f52b28899$ -// - -#ifndef CEF_LIBCEF_DLL_CTOCPP_AUDIO_HANDLER_CTOCPP_H_ -#define CEF_LIBCEF_DLL_CTOCPP_AUDIO_HANDLER_CTOCPP_H_ -#pragma once - -#if !defined(BUILDING_CEF_SHARED) -#error This file can be included DLL-side only -#endif - -#include "include/capi/cef_audio_handler_capi.h" -#include "include/cef_audio_handler.h" -#include "libcef_dll/ctocpp/ctocpp_ref_counted.h" - -// Wrap a C structure with a C++ class. -// This class may be instantiated and accessed DLL-side only. -class CefAudioHandlerCToCpp : public CefCToCppRefCounted { - public: - CefAudioHandlerCToCpp(); - virtual ~CefAudioHandlerCToCpp(); - - // CefAudioHandler methods. - void OnAudioStreamStarted(CefRefPtr browser, - int audio_stream_id, - int channels, - ChannelLayout channel_layout, - int sample_rate, - int frames_per_buffer) override; - void OnAudioStreamPacket(CefRefPtr browser, - int audio_stream_id, - const float** data, - int frames, - int64 pts) override; - void OnAudioStreamStopped(CefRefPtr browser, - int audio_stream_id) override; -}; - -#endif // CEF_LIBCEF_DLL_CTOCPP_AUDIO_HANDLER_CTOCPP_H_ diff --git a/libcef_dll/ctocpp/client_ctocpp.cc b/libcef_dll/ctocpp/client_ctocpp.cc index 96b63600b..b1e766fe6 100644 --- a/libcef_dll/ctocpp/client_ctocpp.cc +++ b/libcef_dll/ctocpp/client_ctocpp.cc @@ -9,14 +9,13 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=4cf201c5e2c106fe4054cb3704114f937e763295$ +// $hash=464799ae4e604aaadcf51130683e72e72ac0ea64$ // #include "libcef_dll/ctocpp/client_ctocpp.h" #include "libcef_dll/cpptoc/browser_cpptoc.h" #include "libcef_dll/cpptoc/frame_cpptoc.h" #include "libcef_dll/cpptoc/process_message_cpptoc.h" -#include "libcef_dll/ctocpp/audio_handler_ctocpp.h" #include "libcef_dll/ctocpp/context_menu_handler_ctocpp.h" #include "libcef_dll/ctocpp/dialog_handler_ctocpp.h" #include "libcef_dll/ctocpp/display_handler_ctocpp.h" @@ -33,21 +32,6 @@ // VIRTUAL METHODS - Body may be edited by hand. -NO_SANITIZE("cfi-icall") -CefRefPtr CefClientCToCpp::GetAudioHandler() { - cef_client_t* _struct = GetStruct(); - if (CEF_MEMBER_MISSING(_struct, get_audio_handler)) - return NULL; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_audio_handler_t* _retval = _struct->get_audio_handler(_struct); - - // Return type: refptr_same - return CefAudioHandlerCToCpp::Wrap(_retval); -} - NO_SANITIZE("cfi-icall") CefRefPtr CefClientCToCpp::GetContextMenuHandler() { cef_client_t* _struct = GetStruct(); diff --git a/libcef_dll/ctocpp/client_ctocpp.h b/libcef_dll/ctocpp/client_ctocpp.h index 6f285afe7..df525ee94 100644 --- a/libcef_dll/ctocpp/client_ctocpp.h +++ b/libcef_dll/ctocpp/client_ctocpp.h @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=bbac20a2027ea623832f37512f716092f29eef3f$ +// $hash=5d6b9cf99d27d848177db25cb9953b8d9c0e2ff0$ // #ifndef CEF_LIBCEF_DLL_CTOCPP_CLIENT_CTOCPP_H_ @@ -33,7 +33,6 @@ class CefClientCToCpp virtual ~CefClientCToCpp(); // CefClient methods. - CefRefPtr GetAudioHandler() override; CefRefPtr GetContextMenuHandler() override; CefRefPtr GetDialogHandler() override; CefRefPtr GetDisplayHandler() override; diff --git a/libcef_dll/wrapper_types.h b/libcef_dll/wrapper_types.h index f00441bfb..aa4115082 100644 --- a/libcef_dll/wrapper_types.h +++ b/libcef_dll/wrapper_types.h @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=98cdfe3302019e8169a9db0371a64ec7b3ad419b$ +// $hash=d256b13437952652b8121ea7d7e10eddfebf8552$ // #ifndef CEF_LIBCEF_DLL_WRAPPER_TYPES_H_ @@ -21,7 +21,6 @@ enum CefWrapperType { WT_BASE_SCOPED, WT_ACCESSIBILITY_HANDLER, WT_APP, - WT_AUDIO_HANDLER, WT_AUTH_CALLBACK, WT_BEFORE_DOWNLOAD_CALLBACK, WT_BINARY_VALUE, diff --git a/tests/ceftests/audio_output_unittest.cc b/tests/ceftests/audio_output_unittest.cc deleted file mode 100644 index 3b37fb243..000000000 --- a/tests/ceftests/audio_output_unittest.cc +++ /dev/null @@ -1,923 +0,0 @@ -// Copyright (c) 2018 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -#include "include/base/cef_bind.h" -#include "include/wrapper/cef_closure_task.h" -#include "tests/ceftests/test_handler.h" -#include "tests/gtest/include/gtest/gtest.h" -#include "tests/shared/browser/client_app_browser.h" - -using client::ClientAppBrowser; - -namespace { - -const int kNumChannels = 2; -const CefAudioHandler::ChannelLayout kChannelLayout = CEF_CHANNEL_LAYOUT_STEREO; - -const char kTestUrl[] = "http://tests/audiooutputtest"; - -// Taken from: -// http://www.iandevlin.com/blog/2012/09/html5/html5-media-and-data-uri/ -const char kTestHtml[] = - "

TEST

"; - -class AudioOutputTest : public ClientAppBrowser::Delegate { - public: - AudioOutputTest() {} - - void OnBeforeCommandLineProcessing( - CefRefPtr app, - CefRefPtr command_line) override { - // Allow media to autoplay without requiring user interaction. - command_line->AppendSwitchWithValue("autoplay-policy", - "no-user-gesture-required"); - } - - protected: - IMPLEMENT_REFCOUNTING(AudioOutputTest); -}; - -// a common base class for audio output tests -class AudioOutputTestHandler : public TestHandler, public CefAudioHandler { - public: - AudioOutputTestHandler() : audio_stream_id_(-1), frames_per_buffer_(-1) {} - - void RunTest() override { - // Add the resource - AddResource(kTestUrl, kTestHtml, "text/html"); - - // Create the browser. - CreateBrowser(kTestUrl); - - // Time out the test after a reasonable period of time. - SetTestTimeout(); - } - - CefRefPtr GetAudioHandler() override { return this; } - - void OnAudioStreamStarted(CefRefPtr browser, - int audio_stream_id, - int channels, - ChannelLayout channel_layout, - int sample_rate, - int frames_per_buffer) override { - EXPECT_FALSE(got_on_audio_stream_started_); - EXPECT_TRUE(GetBrowser()->IsSame(browser)); - EXPECT_TRUE(CefCurrentlyOn(TID_UI)); - EXPECT_EQ(channels, kNumChannels); - EXPECT_EQ(channel_layout, kChannelLayout); - EXPECT_GE(sample_rate, 22050); - EXPECT_LE(sample_rate, 48000); - EXPECT_GE(frames_per_buffer, 441); - EXPECT_LE(frames_per_buffer, 1280); - audio_stream_id_ = audio_stream_id; - frames_per_buffer_ = frames_per_buffer; - got_on_audio_stream_started_.yes(); - } - - void OnAudioStreamPacket(CefRefPtr browser, - int audio_stream_id, - const float** data, - int frames, - int64 pts) override { - if (!got_on_audio_stream_packet_.isSet()) { - EXPECT_TRUE(got_on_audio_stream_started_); - EXPECT_EQ(audio_stream_id_, audio_stream_id); - EXPECT_TRUE(CefCurrentlyOn(TID_UI)); - EXPECT_EQ(frames, frames_per_buffer_); - - browser->GetMainFrame()->ExecuteJavaScript( - "var ifr = document.getElementById(\"audio_output_frame\"); " - "ifr.parentNode.removeChild(ifr);", - CefString(), 0); - - got_on_audio_stream_packet_.yes(); - } - } - - void OnAudioStreamStopped(CefRefPtr browser, - int audio_stream_id) override { - EXPECT_FALSE(got_on_audio_stream_stopped_); - EXPECT_TRUE(got_on_audio_stream_started_); - EXPECT_EQ(audio_stream_id_, audio_stream_id); - EXPECT_TRUE(CefCurrentlyOn(TID_UI)); - got_on_audio_stream_stopped_.yes(); - DestroyTest(); - } - - protected: - void DestroyTest() override { - EXPECT_TRUE(got_on_audio_stream_started_); - EXPECT_TRUE(got_on_audio_stream_packet_); - EXPECT_TRUE(got_on_audio_stream_stopped_); - TestHandler::DestroyTest(); - } - - int audio_stream_id_; - int frames_per_buffer_; - - TrackCallback got_on_audio_stream_started_; - TrackCallback got_on_audio_stream_packet_; - TrackCallback got_on_audio_stream_stopped_; - - IMPLEMENT_REFCOUNTING(AudioOutputTestHandler); -}; -} // namespace - -// Test audio output callbacks called on valid threads -// TODO: Reimplement audio mirroring support (see issue #2755). -/* -TEST(AudioOutputTest, AudioOutputTest) { - CefRefPtr handler = new AudioOutputTestHandler(); - handler->ExecuteTest(); - ReleaseAndWaitForDestructor(handler); -} -*/ - -// Entry point for creating audio output test objects. -// Called from client_app_delegates.cc. -void CreateAudioOutputTests(ClientAppBrowser::DelegateSet& delegates) { - delegates.insert(new AudioOutputTest); -} diff --git a/tests/ceftests/client_app_delegates.cc b/tests/ceftests/client_app_delegates.cc index e078fd394..3ffd728f7 100644 --- a/tests/ceftests/client_app_delegates.cc +++ b/tests/ceftests/client_app_delegates.cc @@ -37,10 +37,6 @@ void CreateBrowserDelegates(ClientAppBrowser::DelegateSet& delegates) { // Bring in the V8 tests. extern void CreateV8BrowserTests(ClientAppBrowser::DelegateSet & delegates); CreateV8BrowserTests(delegates); - - // Bring in audio output tests. - extern void CreateAudioOutputTests(ClientAppBrowser::DelegateSet & delegates); - CreateAudioOutputTests(delegates); } void CreateRenderDelegates(ClientAppRenderer::DelegateSet& delegates) { diff --git a/tools/cef_parser.py b/tools/cef_parser.py index 409687cec..501c92a1c 100644 --- a/tools/cef_parser.py +++ b/tools/cef_parser.py @@ -375,7 +375,6 @@ _simpletypes = { 'uint64': ['uint64', '0'], 'double': ['double', '0'], 'float': ['float', '0'], - 'float*': ['float*', 'NULL'], 'long': ['long', '0'], 'unsigned long': ['unsigned long', '0'], 'long long': ['long long', '0'],