OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 int16_t* decoded, | 40 int16_t* decoded, |
41 SpeechType* speech_type) { | 41 SpeechType* speech_type) { |
42 RTC_DCHECK_EQ(sample_rate_hz_, sample_rate_hz); | 42 RTC_DCHECK_EQ(sample_rate_hz_, sample_rate_hz); |
43 size_t ret = WebRtcPcm16b_Decode(encoded, encoded_len, decoded); | 43 size_t ret = WebRtcPcm16b_Decode(encoded, encoded_len, decoded); |
44 *speech_type = ConvertSpeechType(1); | 44 *speech_type = ConvertSpeechType(1); |
45 return static_cast<int>(ret); | 45 return static_cast<int>(ret); |
46 } | 46 } |
47 | 47 |
48 std::vector<AudioDecoder::ParseResult> AudioDecoderPcm16B::ParsePayload( | 48 std::vector<AudioDecoder::ParseResult> AudioDecoderPcm16B::ParsePayload( |
49 rtc::Buffer&& payload, | 49 rtc::Buffer&& payload, |
50 uint32_t timestamp, | 50 uint32_t timestamp) { |
51 bool is_primary) { | |
52 const int samples_per_ms = rtc::CheckedDivExact(sample_rate_hz_, 1000); | 51 const int samples_per_ms = rtc::CheckedDivExact(sample_rate_hz_, 1000); |
53 return LegacyEncodedAudioFrame::SplitBySamples( | 52 return LegacyEncodedAudioFrame::SplitBySamples( |
54 this, std::move(payload), timestamp, is_primary, | 53 this, std::move(payload), timestamp, samples_per_ms * 2 * num_channels_, |
55 samples_per_ms * 2 * num_channels_, samples_per_ms); | 54 samples_per_ms); |
56 } | 55 } |
57 | 56 |
58 int AudioDecoderPcm16B::PacketDuration(const uint8_t* encoded, | 57 int AudioDecoderPcm16B::PacketDuration(const uint8_t* encoded, |
59 size_t encoded_len) const { | 58 size_t encoded_len) const { |
60 // Two encoded byte per sample per channel. | 59 // Two encoded byte per sample per channel. |
61 return static_cast<int>(encoded_len / (2 * Channels())); | 60 return static_cast<int>(encoded_len / (2 * Channels())); |
62 } | 61 } |
63 | 62 |
64 } // namespace webrtc | 63 } // namespace webrtc |
OLD | NEW |