chromium/chrome/services/speech/audio_source_fetcher_impl.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/services/speech/audio_source_fetcher_impl.h"

#include <memory>

#include "base/check.h"
#include "base/functional/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/task/bind_post_task.h"
#include "base/task/sequenced_task_runner.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/services/speech/speech_recognition_recognizer_impl.h"
#include "media/audio/audio_device_description.h"
#include "media/base/audio_buffer.h"
#include "media/base/audio_bus.h"
#include "media/base/audio_capturer_source.h"
#include "media/base/audio_parameters.h"
#include "media/base/audio_sample_types.h"
#include "media/base/audio_timestamp_helper.h"
#include "media/base/channel_mixer.h"
#include "media/base/limits.h"
#include "media/mojo/common/media_type_converters.h"
#include "media/mojo/mojom/audio_data.mojom.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "services/audio/public/cpp/device_factory.h"

namespace speech {

namespace {

// Buffer size should be 100ms.
constexpr int kServerBasedRecognitionAudioSampleRate =;
constexpr base::TimeDelta kServerBasedRecognitionAudioBufferSize =;

constexpr char kServerBasedRecognitionSessionLength[] =;
constexpr char kOnDeviceRecognitionSessionLength[] =;

}  // namespace

AudioSourceFetcherImpl::AudioSourceFetcherImpl(
    std::unique_ptr<AudioSourceConsumer> audio_consumer,
    bool is_multi_channel_supported,
    bool is_server_based)
    :{}

AudioSourceFetcherImpl::~AudioSourceFetcherImpl() {}

void AudioSourceFetcherImpl::Create(
    mojo::PendingReceiver<media::mojom::AudioSourceFetcher> receiver,
    std::unique_ptr<AudioSourceConsumer> recognition_recognizer,
    bool is_multi_channel_supported,
    bool is_server_based) {}

void AudioSourceFetcherImpl::Start(
    mojo::PendingRemote<media::mojom::AudioStreamFactory> stream_factory,
    const std::string& device_id,
    const ::media::AudioParameters& audio_parameters) {}

void AudioSourceFetcherImpl::DrainConverterOutput() {}

void AudioSourceFetcherImpl::Stop() {}

void AudioSourceFetcherImpl::Capture(const media::AudioBus* audio_source,
                                     base::TimeTicks audio_capture_time,
                                     const media::AudioGlitchInfo& glitch_info,
                                     double volume,
                                     bool key_pressed) {}

void AudioSourceFetcherImpl::OnCaptureError(
    media::AudioCapturerSource::ErrorCode code,
    const std::string& message) {}

void AudioSourceFetcherImpl::SendAudioToSpeechRecognitionService(
    media::mojom::AudioDataS16Ptr buffer) {}

void AudioSourceFetcherImpl::SendAudioToResample(
    std::unique_ptr<media::AudioBus> audio_data) {}

void AudioSourceFetcherImpl::SendError() {}

media::AudioCapturerSource* AudioSourceFetcherImpl::GetAudioCapturerSource() {}

void AudioSourceFetcherImpl::OnCreated(const media::AudioParameters& params,
                                       const std::string& device_id) {}

void AudioSourceFetcherImpl::OnStarted() {}
void AudioSourceFetcherImpl::OnStopped() {}
void AudioSourceFetcherImpl::OnClosed() {}
void AudioSourceFetcherImpl::OnError() {}
void AudioSourceFetcherImpl::OnSetVolume(double volume) {}
void AudioSourceFetcherImpl::OnLogMessage(const std::string& message) {}
void AudioSourceFetcherImpl::OnProcessingStateChanged(
    const std::string& message) {}

void AudioSourceFetcherImpl::OnAudioFinishedConvert(
    const media::AudioBus* output_bus) {}

void AudioSourceFetcherImpl::SendAudioEndToSpeechRecognitionService() {}

}  // namespace speech