blob: 6825f838f1373cb57d425472d1ea99e9c9ff69ed [file] [log] [blame]
// Copyright 2018 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 <string>
#include "base/time/time.h"
namespace media {
class AudioBus;
class AudioParameters;
} // namespace media
namespace audio {
class Snoopable {
class Snooper {
// Provides read-only access to the data flowing through a GroupMember. This
// must execute quickly, as it will typically be called on a realtime
// thread; otherwise, audio glitches may occur.
virtual void OnData(const media::AudioBus& audio_bus,
base::TimeTicks reference_time,
double volume) = 0;
virtual ~Snooper() = default;
// Returns the audio parameters of the snoopable audio data. The parameters
// must not change for the lifetime of this group member, but can be different
// than those of other members.
virtual const media::AudioParameters& GetAudioParameters() const = 0;
// Returns the id of the device the snoopable stream is connected to.
virtual std::string GetDeviceId() const = 0;
// Starts/Stops snooping on the audio data flowing through this group member.
virtual void StartSnooping(Snooper* snooper) = 0;
virtual void StopSnooping(Snooper* snooper) = 0;
virtual ~Snoopable() = default;
} // namespace audio