Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: webrtc/modules/audio_coding/codecs/g711/audio_decoder_pcm.cc

Issue 1348613003: Move AudioDecoderPcm* next to AudioEncoderPcm* (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@dmove-pcm16
Patch Set: rebase Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/modules/audio_coding/BUILD.gn ('k') | webrtc/modules/audio_coding/codecs/g711/g711.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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/include/audio_decoder_pcm.h"
12
13 #include "webrtc/modules/audio_coding/codecs/g711/include/g711_interface.h"
14
15 namespace webrtc {
16
17 void AudioDecoderPcmU::Reset() {}
18
19 size_t AudioDecoderPcmU::Channels() const {
20 return 1;
21 }
22
23 int AudioDecoderPcmU::DecodeInternal(const uint8_t* encoded,
24 size_t encoded_len,
25 int sample_rate_hz,
26 int16_t* decoded,
27 SpeechType* speech_type) {
28 RTC_DCHECK_EQ(sample_rate_hz, 8000);
29 int16_t temp_type = 1; // Default is speech.
30 size_t ret = WebRtcG711_DecodeU(encoded, encoded_len, decoded, &temp_type);
31 *speech_type = ConvertSpeechType(temp_type);
32 return static_cast<int>(ret);
33 }
34
35 int AudioDecoderPcmU::PacketDuration(const uint8_t* encoded,
36 size_t encoded_len) const {
37 // One encoded byte per sample per channel.
38 return static_cast<int>(encoded_len / Channels());
39 }
40
41 size_t AudioDecoderPcmUMultiCh::Channels() const {
42 return channels_;
43 }
44
45 void AudioDecoderPcmA::Reset() {}
46
47 size_t AudioDecoderPcmA::Channels() const {
48 return 1;
49 }
50
51 int AudioDecoderPcmA::DecodeInternal(const uint8_t* encoded,
52 size_t encoded_len,
53 int sample_rate_hz,
54 int16_t* decoded,
55 SpeechType* speech_type) {
56 RTC_DCHECK_EQ(sample_rate_hz, 8000);
57 int16_t temp_type = 1; // Default is speech.
58 size_t ret = WebRtcG711_DecodeA(encoded, encoded_len, decoded, &temp_type);
59 *speech_type = ConvertSpeechType(temp_type);
60 return static_cast<int>(ret);
61 }
62
63 int AudioDecoderPcmA::PacketDuration(const uint8_t* encoded,
64 size_t encoded_len) const {
65 // One encoded byte per sample per channel.
66 return static_cast<int>(encoded_len / Channels());
67 }
68
69 size_t AudioDecoderPcmAMultiCh::Channels() const {
70 return channels_;
71 }
72
73 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/BUILD.gn ('k') | webrtc/modules/audio_coding/codecs/g711/g711.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698