You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.4 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef MEDIA_BASE_AUDIO_SOURCE_H_
  11. #define MEDIA_BASE_AUDIO_SOURCE_H_
  12. #include <cstddef>
  13. namespace cricket {
  14. // Abstract interface for providing the audio data.
  15. // TODO(deadbeef): Rename this to AudioSourceInterface, and rename
  16. // webrtc::AudioSourceInterface to AudioTrackSourceInterface.
  17. class AudioSource {
  18. public:
  19. class Sink {
  20. public:
  21. // Callback to receive data from the AudioSource.
  22. virtual void OnData(const void* audio_data,
  23. int bits_per_sample,
  24. int sample_rate,
  25. size_t number_of_channels,
  26. size_t number_of_frames) = 0;
  27. // Called when the AudioSource is going away.
  28. virtual void OnClose() = 0;
  29. protected:
  30. virtual ~Sink() {}
  31. };
  32. // Sets a sink to the AudioSource. There can be only one sink connected
  33. // to the source at a time.
  34. virtual void SetSink(Sink* sink) = 0;
  35. protected:
  36. virtual ~AudioSource() {}
  37. };
  38. } // namespace cricket
  39. #endif // MEDIA_BASE_AUDIO_SOURCE_H_