• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "base/logging.h"
6 #include "content/renderer/media/webrtc/webrtc_audio_sink_adapter.h"
7 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h"
8 
9 namespace content {
10 
WebRtcAudioSinkAdapter(webrtc::AudioTrackSinkInterface * sink)11 WebRtcAudioSinkAdapter::WebRtcAudioSinkAdapter(
12     webrtc::AudioTrackSinkInterface* sink)
13     : sink_(sink) {
14   DCHECK(sink);
15 }
16 
~WebRtcAudioSinkAdapter()17 WebRtcAudioSinkAdapter::~WebRtcAudioSinkAdapter() {
18 }
19 
IsEqual(const webrtc::AudioTrackSinkInterface * other) const20 bool WebRtcAudioSinkAdapter::IsEqual(
21     const webrtc::AudioTrackSinkInterface* other) const {
22   return (other == sink_);
23 }
24 
OnData(const int16 * audio_data,int sample_rate,int number_of_channels,int number_of_frames)25 void WebRtcAudioSinkAdapter::OnData(const int16* audio_data,
26                                     int sample_rate,
27                                     int number_of_channels,
28                                     int number_of_frames) {
29   sink_->OnData(audio_data, 16, sample_rate, number_of_channels,
30                 number_of_frames);
31 }
32 
OnSetFormat(const media::AudioParameters & params)33 void WebRtcAudioSinkAdapter::OnSetFormat(
34     const media::AudioParameters& params) {
35   // No need to forward the OnSetFormat() callback to
36   // webrtc::AudioTrackSinkInterface sink since the sink will handle the
37   // format change in OnData().
38 }
39 
40 }  // namespace content
41