OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_AUDIO_SINK_H_ | 5 #ifndef CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_AUDIO_SINK_H_ |
6 #define CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_AUDIO_SINK_H_ | 6 #define CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_AUDIO_SINK_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 // Called on the main render thread. | 30 // Called on the main render thread. |
31 static void AddToAudioTrack(MediaStreamAudioSink* sink, | 31 static void AddToAudioTrack(MediaStreamAudioSink* sink, |
32 const blink::WebMediaStreamTrack& track); | 32 const blink::WebMediaStreamTrack& track); |
33 | 33 |
34 // Removes a MediaStreamAudioSink from the audio track to stop receiving | 34 // Removes a MediaStreamAudioSink from the audio track to stop receiving |
35 // audio data from the track. | 35 // audio data from the track. |
36 // Called on the main render thread. | 36 // Called on the main render thread. |
37 static void RemoveFromAudioTrack(MediaStreamAudioSink* sink, | 37 static void RemoveFromAudioTrack(MediaStreamAudioSink* sink, |
38 const blink::WebMediaStreamTrack& track); | 38 const blink::WebMediaStreamTrack& track); |
39 | 39 |
| 40 // Returns the format of the audio track. |
| 41 // Called on the main render thread. |
| 42 static media::AudioParameters GetFormatFromAudioTrack( |
| 43 const blink::WebMediaStreamTrack& track); |
| 44 |
40 // Callback called to deliver audio data. The data in |audio_bus| respects the | 45 // Callback called to deliver audio data. The data in |audio_bus| respects the |
41 // AudioParameters passed in the last call to OnSetFormat(). Called on | 46 // AudioParameters passed in the last call to OnSetFormat(). Called on |
42 // real-time audio thread. | 47 // real-time audio thread. |
43 // | 48 // |
44 // |estimated_capture_time| is the local time at which the first sample frame | 49 // |estimated_capture_time| is the local time at which the first sample frame |
45 // in |audio_bus| either: 1) was generated, if it was done so locally; or 2) | 50 // in |audio_bus| either: 1) was generated, if it was done so locally; or 2) |
46 // should be targeted for play-out, if it was generated from a remote | 51 // should be targeted for play-out, if it was generated from a remote |
47 // source. Either way, an implementation should not play-out the audio before | 52 // source. Either way, an implementation should not play-out the audio before |
48 // this point-in-time. This value is NOT a high-resolution timestamp, and so | 53 // this point-in-time. This value is NOT a high-resolution timestamp, and so |
49 // it should not be used as a presentation time; but, instead, it should be | 54 // it should not be used as a presentation time; but, instead, it should be |
50 // used for buffering playback and for A/V synchronization purposes. | 55 // used for buffering playback and for A/V synchronization purposes. |
51 virtual void OnData(const media::AudioBus& audio_bus, | 56 virtual void OnData(const media::AudioBus& audio_bus, |
52 base::TimeTicks estimated_capture_time) = 0; | 57 base::TimeTicks estimated_capture_time) = 0; |
53 | 58 |
54 // Callback called when the format of the audio stream has changed. This is | 59 // Callback called when the format of the audio stream has changed. This is |
55 // always called at least once before OnData(), and on the same thread. | 60 // always called at least once before OnData(), and on the same thread. |
56 virtual void OnSetFormat(const media::AudioParameters& params) = 0; | 61 virtual void OnSetFormat(const media::AudioParameters& params) = 0; |
57 | 62 |
58 protected: | 63 protected: |
59 ~MediaStreamAudioSink() override {} | 64 ~MediaStreamAudioSink() override {} |
60 }; | 65 }; |
61 | 66 |
62 } // namespace content | 67 } // namespace content |
63 | 68 |
64 #endif // CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_AUDIO_SINK_H_ | 69 #endif // CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_AUDIO_SINK_H_ |
OLD | NEW |