blob: b36a2643d7a7dc6ca270cc62d0b0167a441e565d [file] [log] [blame]
// Copyright (c) 2012 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 "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "media/audio/audio_io.h"
#include "media/audio/audio_parameters.h"
#include "media/audio/fake_audio_worker.h"
namespace media {
class AudioManagerBase;
// A fake implementation of AudioOutputStream. Used for testing and when a real
// audio output device is unavailable or refusing output (e.g. remote desktop).
// Callbacks are driven on the AudioManager's message loop.
class MEDIA_EXPORT FakeAudioOutputStream : public AudioOutputStream {
static AudioOutputStream* MakeFakeStream(AudioManagerBase* manager,
const AudioParameters& params);
// AudioOutputStream implementation.
bool Open() override;
void Start(AudioSourceCallback* callback) override;
void Stop() override;
void SetVolume(double volume) override;
void GetVolume(double* volume) override;
void Close() override;
FakeAudioOutputStream(AudioManagerBase* manager,
const AudioParameters& params);
~FakeAudioOutputStream() override;
// Task that periodically calls OnMoreData() to consume audio data.
void CallOnMoreData();
AudioManagerBase* audio_manager_;
AudioSourceCallback* callback_;
FakeAudioWorker fake_worker_;
scoped_ptr<AudioBus> audio_bus_;
} // namespace media