OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_AUDIO_SINK_H_ |
| 6 #define CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_AUDIO_SINK_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "content/common/content_export.h" |
| 12 |
| 13 namespace blink { |
| 14 class WebMediaStreamTrack; |
| 15 } |
| 16 |
| 17 namespace media { |
| 18 class AudioParameters; |
| 19 } |
| 20 |
| 21 namespace content { |
| 22 |
| 23 class MediaStreamAudioSink { |
| 24 public: |
| 25 // Adds a MediaStreamAudioSink to the audio track to receive audio data from |
| 26 // the track. |
| 27 // Called on the main render thread. |
| 28 static void AddToAudioTrack(MediaStreamAudioSink* sink, |
| 29 const blink::WebMediaStreamTrack& track); |
| 30 |
| 31 // Removes a MediaStreamAudioSink from the audio track to stop receiving |
| 32 // audio data from the track. |
| 33 // Called on the main render thread. |
| 34 static void RemoveFromAudioTrack(MediaStreamAudioSink* sink, |
| 35 const blink::WebMediaStreamTrack& track); |
| 36 |
| 37 // Callback on delivering the interleaved audio data. |
| 38 // |audio_data| is the pointer to the audio data. |
| 39 // |sample_rate| is the sample frequency of |audio_data|. |
| 40 // |number_of_channels| is the number of audio channels of |audio_data|. |
| 41 // |number_of_frames| is the number of audio frames in the |audio_data|. |
| 42 // Called on real-time audio thread. |
| 43 virtual void OnData(const int16* audio_data, |
| 44 int sample_rate, |
| 45 int number_of_channels, |
| 46 int number_of_frames) = 0; |
| 47 |
| 48 // Callback called when the format of the audio stream has changed. |
| 49 // This is called on the same thread as OnData(). |
| 50 virtual void OnSetFormat(const media::AudioParameters& params) = 0; |
| 51 |
| 52 protected: |
| 53 virtual ~MediaStreamAudioSink() {} |
| 54 }; |
| 55 |
| 56 } // namespace content |
| 57 |
| 58 #endif // CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_AUDIO_SINK_H_ |
OLD | NEW |