mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Re-implement audio capturing based on the AudioService API (fixes issue #2755)
This commit is contained in:
committed by
Marshall Greenblatt
parent
d65483ae16
commit
8d01442d75
164
libcef_dll/ctocpp/audio_handler_ctocpp.cc
Normal file
164
libcef_dll/ctocpp/audio_handler_ctocpp.cc
Normal file
@@ -0,0 +1,164 @@
|
||||
// Copyright (c) 2020 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=d7f2fb8ad6fe2bd0ab928b09ab596b12e9049ddf$
|
||||
//
|
||||
|
||||
#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")
|
||||
bool CefAudioHandlerCToCpp::GetAudioParameters(CefRefPtr<CefBrowser> browser,
|
||||
CefAudioParameters& params) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_audio_handler_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, get_audio_parameters))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return false;
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->get_audio_parameters(
|
||||
_struct, CefBrowserCppToC::Wrap(browser), ¶ms);
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefAudioHandlerCToCpp::OnAudioStreamStarted(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
const CefAudioParameters& params,
|
||||
int channels) {
|
||||
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),
|
||||
¶ms, channels);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefAudioHandlerCToCpp::OnAudioStreamPacket(CefRefPtr<CefBrowser> browser,
|
||||
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),
|
||||
data, frames, pts);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefAudioHandlerCToCpp::OnAudioStreamStopped(
|
||||
CefRefPtr<CefBrowser> browser) {
|
||||
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));
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefAudioHandlerCToCpp::OnAudioStreamError(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& message) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_audio_handler_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_audio_stream_error))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
// Verify param: message; type: string_byref_const
|
||||
DCHECK(!message.empty());
|
||||
if (message.empty())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
_struct->on_audio_stream_error(_struct, CefBrowserCppToC::Wrap(browser),
|
||||
message.GetStruct());
|
||||
}
|
||||
|
||||
// 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<CefAudioHandlerCToCpp,
|
||||
CefAudioHandler,
|
||||
cef_audio_handler_t>::UnwrapDerived(CefWrapperType type,
|
||||
CefAudioHandler* c) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType CefCToCppRefCounted<CefAudioHandlerCToCpp,
|
||||
CefAudioHandler,
|
||||
cef_audio_handler_t>::kWrapperType =
|
||||
WT_AUDIO_HANDLER;
|
51
libcef_dll/ctocpp/audio_handler_ctocpp.h
Normal file
51
libcef_dll/ctocpp/audio_handler_ctocpp.h
Normal file
@@ -0,0 +1,51 @@
|
||||
// Copyright (c) 2020 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=e5517ccac966337ef7dc576a24eedfe1154b2813$
|
||||
//
|
||||
|
||||
#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<CefAudioHandlerCToCpp,
|
||||
CefAudioHandler,
|
||||
cef_audio_handler_t> {
|
||||
public:
|
||||
CefAudioHandlerCToCpp();
|
||||
virtual ~CefAudioHandlerCToCpp();
|
||||
|
||||
// CefAudioHandler methods.
|
||||
bool GetAudioParameters(CefRefPtr<CefBrowser> browser,
|
||||
CefAudioParameters& params) override;
|
||||
void OnAudioStreamStarted(CefRefPtr<CefBrowser> browser,
|
||||
const CefAudioParameters& params,
|
||||
int channels) override;
|
||||
void OnAudioStreamPacket(CefRefPtr<CefBrowser> browser,
|
||||
const float** data,
|
||||
int frames,
|
||||
int64 pts) override;
|
||||
void OnAudioStreamStopped(CefRefPtr<CefBrowser> browser) override;
|
||||
void OnAudioStreamError(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& message) override;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_AUDIO_HANDLER_CTOCPP_H_
|
@@ -9,13 +9,14 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=cb91642733be3dfd60a0d848c41c71bbe06a835c$
|
||||
// $hash=0e4556cf21b4d75aefbfa90963c6b5c9aba33bad$
|
||||
//
|
||||
|
||||
#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"
|
||||
@@ -32,6 +33,21 @@
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CefRefPtr<CefAudioHandler> CefClientCToCpp::GetAudioHandler() {
|
||||
cef_client_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, get_audio_handler))
|
||||
return nullptr;
|
||||
|
||||
// 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<CefContextMenuHandler> CefClientCToCpp::GetContextMenuHandler() {
|
||||
cef_client_t* _struct = GetStruct();
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=94a6eac6479bc8404b73ff49b581338ef198a0cc$
|
||||
// $hash=f751ee624cc3b8570cba8caa051c51bb7aeccaa7$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_CLIENT_CTOCPP_H_
|
||||
@@ -33,6 +33,7 @@ class CefClientCToCpp
|
||||
virtual ~CefClientCToCpp();
|
||||
|
||||
// CefClient methods.
|
||||
CefRefPtr<CefAudioHandler> GetAudioHandler() override;
|
||||
CefRefPtr<CefContextMenuHandler> GetContextMenuHandler() override;
|
||||
CefRefPtr<CefDialogHandler> GetDialogHandler() override;
|
||||
CefRefPtr<CefDisplayHandler> GetDisplayHandler() override;
|
||||
|
Reference in New Issue
Block a user