Home | History | Annotate | Download | only in webrtc
      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 
     11 WebRtcAudioSinkAdapter::WebRtcAudioSinkAdapter(
     12     webrtc::AudioTrackSinkInterface* sink)
     13     : sink_(sink) {
     14   DCHECK(sink);
     15 }
     16 
     17 WebRtcAudioSinkAdapter::~WebRtcAudioSinkAdapter() {
     18 }
     19 
     20 bool WebRtcAudioSinkAdapter::IsEqual(
     21     const webrtc::AudioTrackSinkInterface* other) const {
     22   return (other == sink_);
     23 }
     24 
     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 
     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