LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/modules/audio_coding/codecs/g711 - audio_decoder_pcm.cc (source / functions) Hit Total Coverage
Test: output.info Lines: 0 30 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 12 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  *  Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
       3             :  *
       4             :  *  Use of this source code is governed by a BSD-style license
       5             :  *  that can be found in the LICENSE file in the root of the source
       6             :  *  tree. An additional intellectual property rights grant can be found
       7             :  *  in the file PATENTS.  All contributing project authors may
       8             :  *  be found in the AUTHORS file in the root of the source tree.
       9             :  */
      10             : 
      11             : #include "webrtc/modules/audio_coding/codecs/g711/audio_decoder_pcm.h"
      12             : 
      13             : #include "webrtc/modules/audio_coding/codecs/legacy_encoded_audio_frame.h"
      14             : #include "webrtc/modules/audio_coding/codecs/g711/g711_interface.h"
      15             : 
      16             : namespace webrtc {
      17             : 
      18           0 : void AudioDecoderPcmU::Reset() {}
      19             : 
      20           0 : std::vector<AudioDecoder::ParseResult> AudioDecoderPcmU::ParsePayload(
      21             :     rtc::Buffer&& payload,
      22             :     uint32_t timestamp) {
      23             :   return LegacyEncodedAudioFrame::SplitBySamples(
      24           0 :       this, std::move(payload), timestamp, 8 * num_channels_, 8);
      25             : }
      26             : 
      27           0 : int AudioDecoderPcmU::SampleRateHz() const {
      28           0 :   return 8000;
      29             : }
      30             : 
      31           0 : size_t AudioDecoderPcmU::Channels() const {
      32           0 :   return num_channels_;
      33             : }
      34             : 
      35           0 : int AudioDecoderPcmU::DecodeInternal(const uint8_t* encoded,
      36             :                                      size_t encoded_len,
      37             :                                      int sample_rate_hz,
      38             :                                      int16_t* decoded,
      39             :                                      SpeechType* speech_type) {
      40           0 :   RTC_DCHECK_EQ(SampleRateHz(), sample_rate_hz);
      41           0 :   int16_t temp_type = 1;  // Default is speech.
      42           0 :   size_t ret = WebRtcG711_DecodeU(encoded, encoded_len, decoded, &temp_type);
      43           0 :   *speech_type = ConvertSpeechType(temp_type);
      44           0 :   return static_cast<int>(ret);
      45             : }
      46             : 
      47           0 : int AudioDecoderPcmU::PacketDuration(const uint8_t* encoded,
      48             :                                      size_t encoded_len) const {
      49             :   // One encoded byte per sample per channel.
      50           0 :   return static_cast<int>(encoded_len / Channels());
      51             : }
      52             : 
      53           0 : void AudioDecoderPcmA::Reset() {}
      54             : 
      55           0 : std::vector<AudioDecoder::ParseResult> AudioDecoderPcmA::ParsePayload(
      56             :     rtc::Buffer&& payload,
      57             :     uint32_t timestamp) {
      58             :   return LegacyEncodedAudioFrame::SplitBySamples(
      59           0 :       this, std::move(payload), timestamp, 8 * num_channels_, 8);
      60             : }
      61             : 
      62           0 : int AudioDecoderPcmA::SampleRateHz() const {
      63           0 :   return 8000;
      64             : }
      65             : 
      66           0 : size_t AudioDecoderPcmA::Channels() const {
      67           0 :   return num_channels_;
      68             : }
      69             : 
      70           0 : int AudioDecoderPcmA::DecodeInternal(const uint8_t* encoded,
      71             :                                      size_t encoded_len,
      72             :                                      int sample_rate_hz,
      73             :                                      int16_t* decoded,
      74             :                                      SpeechType* speech_type) {
      75           0 :   RTC_DCHECK_EQ(SampleRateHz(), sample_rate_hz);
      76           0 :   int16_t temp_type = 1;  // Default is speech.
      77           0 :   size_t ret = WebRtcG711_DecodeA(encoded, encoded_len, decoded, &temp_type);
      78           0 :   *speech_type = ConvertSpeechType(temp_type);
      79           0 :   return static_cast<int>(ret);
      80             : }
      81             : 
      82           0 : int AudioDecoderPcmA::PacketDuration(const uint8_t* encoded,
      83             :                                      size_t encoded_len) const {
      84             :   // One encoded byte per sample per channel.
      85           0 :   return static_cast<int>(encoded_len / Channels());
      86             : }
      87             : 
      88             : }  // namespace webrtc

Generated by: LCOV version 1.13