OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 |
(...skipping 15 matching lines...) Expand all Loading... |
26 virtual ~AudioSink() {} | 26 virtual ~AudioSink() {} |
27 | 27 |
28 // Writes |num_samples| from |audio| to the AudioSink. Returns true if | 28 // Writes |num_samples| from |audio| to the AudioSink. Returns true if |
29 // successful, otherwise false. | 29 // successful, otherwise false. |
30 virtual bool WriteArray(const int16_t* audio, size_t num_samples) = 0; | 30 virtual bool WriteArray(const int16_t* audio, size_t num_samples) = 0; |
31 | 31 |
32 // Writes |audio_frame| to the AudioSink. Returns true if successful, | 32 // Writes |audio_frame| to the AudioSink. Returns true if successful, |
33 // otherwise false. | 33 // otherwise false. |
34 bool WriteAudioFrame(const AudioFrame& audio_frame) { | 34 bool WriteAudioFrame(const AudioFrame& audio_frame) { |
35 return WriteArray( | 35 return WriteArray( |
36 audio_frame.data_, | 36 audio_frame.data(), |
37 audio_frame.samples_per_channel_ * audio_frame.num_channels_); | 37 audio_frame.samples_per_channel_ * audio_frame.num_channels_); |
38 } | 38 } |
39 | 39 |
40 private: | 40 private: |
41 RTC_DISALLOW_COPY_AND_ASSIGN(AudioSink); | 41 RTC_DISALLOW_COPY_AND_ASSIGN(AudioSink); |
42 }; | 42 }; |
43 | 43 |
44 // Forks the output audio to two AudioSink objects. | 44 // Forks the output audio to two AudioSink objects. |
45 class AudioSinkFork : public AudioSink { | 45 class AudioSinkFork : public AudioSink { |
46 public: | 46 public: |
(...skipping 15 matching lines...) Expand all Loading... |
62 VoidAudioSink() = default; | 62 VoidAudioSink() = default; |
63 bool WriteArray(const int16_t* audio, size_t num_samples) override; | 63 bool WriteArray(const int16_t* audio, size_t num_samples) override; |
64 | 64 |
65 private: | 65 private: |
66 RTC_DISALLOW_COPY_AND_ASSIGN(VoidAudioSink); | 66 RTC_DISALLOW_COPY_AND_ASSIGN(VoidAudioSink); |
67 }; | 67 }; |
68 | 68 |
69 } // namespace test | 69 } // namespace test |
70 } // namespace webrtc | 70 } // namespace webrtc |
71 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_AUDIO_SINK_H_ | 71 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_AUDIO_SINK_H_ |
OLD | NEW |