#include "chrome/renderer/media/chrome_speech_recognition_client.h"
#include <utility>
#include "base/metrics/histogram_functions.h"
#include "base/task/bind_post_task.h"
#include "base/time/time.h"
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_frame_observer.h"
#include "media/audio/reconfigurable_audio_bus_pool.h"
#include "media/base/audio_bus.h"
#include "media/base/audio_parameters.h"
#include "media/base/audio_timestamp_helper.h"
#include "media/base/channel_mixer.h"
#include "media/mojo/mojom/audio_data.mojom.h"
#include "media/mojo/mojom/media_types.mojom.h"
#include "third_party/blink/public/platform/browser_interface_broker_proxy.h"
constexpr base::TimeDelta kAudioBusPoolDuration = …;
ChromeSpeechRecognitionClient::ChromeSpeechRecognitionClient(
content::RenderFrame* render_frame)
: … { … }
ChromeSpeechRecognitionClient::~ChromeSpeechRecognitionClient() = default;
void ChromeSpeechRecognitionClient::AddAudio(
scoped_refptr<media::AudioBuffer> buffer) { … }
void ChromeSpeechRecognitionClient::AddAudio(const media::AudioBus& audio_bus) { … }
bool ChromeSpeechRecognitionClient::IsSpeechRecognitionAvailable() { … }
void ChromeSpeechRecognitionClient::SetOnReadyCallback(
SpeechRecognitionClient::OnReadyCallback callback) { … }
void ChromeSpeechRecognitionClient::Reconfigure(
const media::AudioParameters& audio_parameters) { … }
void ChromeSpeechRecognitionClient::OnRecognizerBound(
bool is_multichannel_supported) { … }
void ChromeSpeechRecognitionClient::SpeechRecognitionAvailabilityChanged(
bool is_speech_recognition_available) { … }
void ChromeSpeechRecognitionClient::SpeechRecognitionLanguageChanged(
const std::string& language) { … }
void ChromeSpeechRecognitionClient::SpeechRecognitionMaskOffensiveWordsChanged(
bool mask_offensive_words) { … }
void ChromeSpeechRecognitionClient::OnDestruct() { … }
void ChromeSpeechRecognitionClient::Initialize() { … }
void ChromeSpeechRecognitionClient::Reset() { … }
void ChromeSpeechRecognitionClient::AddAudioBusOnMainSequence(
std::unique_ptr<media::AudioBus> audio_bus,
int sample_rate,
media::ChannelLayout channel_layout) { … }
void ChromeSpeechRecognitionClient::SendAudioToSpeechRecognitionService(
media::mojom::AudioDataS16Ptr audio_data) { … }
void ChromeSpeechRecognitionClient::OnRecognizerDisconnected() { … }