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.
5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_AUDIO_SINK_ADAPTER_H_
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_AUDIO_SINK_ADAPTER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "content/public/renderer/media_stream_audio_sink.h"
12 class AudioTrackSinkInterface;
17 // Adapter to the webrtc::AudioTrackSinkInterface of the audio track.
18 // This class is used in between the MediaStreamAudioSink and
19 // webrtc::AudioTrackSinkInterface. It gets data callback via the
20 // MediaStreamAudioSink::OnData() interface and pass the data to
21 // webrtc::AudioTrackSinkInterface.
22 class WebRtcAudioSinkAdapter : public MediaStreamAudioSink {
24 explicit WebRtcAudioSinkAdapter(
25 webrtc::AudioTrackSinkInterface* sink);
26 ~WebRtcAudioSinkAdapter() override;
28 bool IsEqual(const webrtc::AudioTrackSinkInterface* other) const;
31 // MediaStreamAudioSink implementation.
32 void OnData(const int16* audio_data,
34 int number_of_channels,
35 int number_of_frames) override;
36 void OnSetFormat(const media::AudioParameters& params) override;
38 webrtc::AudioTrackSinkInterface* const sink_;
40 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioSinkAdapter);
43 } // namespace content
45 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_AUDIO_SINK_ADAPTER_H_