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