#include "third_party/blink/renderer/modules/speech/speech_recognition_media_stream_audio_sink.h"
#include <memory>
#include "media/base/audio_bus.h"
#include "media/base/audio_parameters.h"
#include "media/base/channel_layout.h"
#include "media/base/channel_mixer.h"
#include "media/mojo/mojom/audio_data.mojom-blink.h"
#include "media/mojo/mojom/speech_recognition.mojom-blink.h"
#include "media/mojo/mojom/speech_recognition_audio_forwarder.mojom-blink.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/platform/heap/cross_thread_handle.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
namespace WTF {
template <>
struct CrossThreadCopier<media::mojom::blink::AudioDataS16Ptr>
: public CrossThreadCopierByValuePassThrough<
media::mojom::blink::AudioDataS16Ptr> { … };
}
namespace blink {
SpeechRecognitionMediaStreamAudioSink::SpeechRecognitionMediaStreamAudioSink(
ExecutionContext* context,
mojo::PendingRemote<media::mojom::blink::SpeechRecognitionAudioForwarder>
audio_forwarder,
const media::AudioParameters& audio_parameters)
: … { … }
void SpeechRecognitionMediaStreamAudioSink::OnData(
const media::AudioBus& audio_bus,
base::TimeTicks estimated_capture_time) { … }
void SpeechRecognitionMediaStreamAudioSink::OnSetFormat(
const media::AudioParameters& audio_parameters) { … }
void SpeechRecognitionMediaStreamAudioSink::Trace(Visitor* visitor) const { … }
void SpeechRecognitionMediaStreamAudioSink::SendAudio(
media::mojom::blink::AudioDataS16Ptr audio_data) { … }
media::mojom::blink::AudioDataS16Ptr
SpeechRecognitionMediaStreamAudioSink::ConvertToAudioDataS16(
const media::AudioBus& audio_bus,
int sample_rate,
media::ChannelLayout channel_layout) { … }
void SpeechRecognitionMediaStreamAudioSink::ResetChannelMixerIfNeeded(
int frame_count,
media::ChannelLayout channel_layout,
int channel_count) { … }
}