OLD | NEW |
| (Empty) |
1 // Copyright 2014 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_RENDERER_MEDIA_WEBRTC_WEBRTC_AUDIO_SINK_ADAPTER_H_ | |
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_AUDIO_SINK_ADAPTER_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include <memory> | |
11 | |
12 #include "base/macros.h" | |
13 #include "content/public/renderer/media_stream_audio_sink.h" | |
14 #include "media/base/audio_parameters.h" | |
15 | |
16 namespace webrtc { | |
17 class AudioTrackSinkInterface; | |
18 } // namespace webrtc | |
19 | |
20 namespace content { | |
21 | |
22 // Adapter to the webrtc::AudioTrackSinkInterface of the audio track. | |
23 // This class is used in between the MediaStreamAudioSink and | |
24 // webrtc::AudioTrackSinkInterface. It gets data callback via the | |
25 // MediaStreamAudioSink::OnData() interface and pass the data to | |
26 // webrtc::AudioTrackSinkInterface. | |
27 class WebRtcAudioSinkAdapter : public MediaStreamAudioSink { | |
28 public: | |
29 explicit WebRtcAudioSinkAdapter( | |
30 webrtc::AudioTrackSinkInterface* sink); | |
31 ~WebRtcAudioSinkAdapter() override; | |
32 | |
33 bool IsEqual(const webrtc::AudioTrackSinkInterface* other) const; | |
34 | |
35 private: | |
36 // MediaStreamAudioSink implementation. | |
37 void OnData(const media::AudioBus& audio_bus, | |
38 base::TimeTicks estimated_capture_time) override; | |
39 void OnSetFormat(const media::AudioParameters& params) override; | |
40 | |
41 webrtc::AudioTrackSinkInterface* const sink_; | |
42 | |
43 media::AudioParameters params_; | |
44 std::unique_ptr<int16_t[]> interleaved_data_; | |
45 | |
46 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioSinkAdapter); | |
47 }; | |
48 | |
49 } // namespace content | |
50 | |
51 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_AUDIO_SINK_ADAPTER_H_ | |
OLD | NEW |