OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
11 #include "webrtc/modules/audio_coding/codecs/audio_decoder.h" | 11 #include "webrtc/modules/audio_coding/codecs/audio_decoder.h" |
12 | 12 |
13 #include <assert.h> | 13 #include <assert.h> |
14 #include <memory> | 14 #include <memory> |
15 #include <utility> | 15 #include <utility> |
16 | 16 |
17 #include "webrtc/base/array_view.h" | 17 #include "webrtc/base/array_view.h" |
18 #include "webrtc/base/checks.h" | 18 #include "webrtc/base/checks.h" |
19 #include "webrtc/base/sanitizer.h" | 19 #include "webrtc/base/sanitizer.h" |
20 #include "webrtc/base/trace_event.h" | 20 #include "webrtc/base/trace_event.h" |
21 #include "webrtc/modules/audio_coding/codecs/legacy_encoded_audio_frame.h" | 21 #include "webrtc/modules/audio_coding/codecs/legacy_encoded_audio_frame.h" |
22 | 22 |
23 namespace webrtc { | 23 namespace webrtc { |
24 | 24 |
25 AudioDecoder::ParseResult::ParseResult() = default; | 25 AudioDecoder::ParseResult::ParseResult() = default; |
26 AudioDecoder::ParseResult::ParseResult(ParseResult&& b) = default; | 26 AudioDecoder::ParseResult::ParseResult(ParseResult&& b) = default; |
27 AudioDecoder::ParseResult::ParseResult(uint32_t timestamp, | 27 AudioDecoder::ParseResult::ParseResult(uint32_t timestamp, |
28 bool primary, | 28 uint8_t priority, |
29 std::unique_ptr<EncodedAudioFrame> frame) | 29 std::unique_ptr<EncodedAudioFrame> frame) |
30 : timestamp(timestamp), primary(primary), frame(std::move(frame)) {} | 30 : timestamp(timestamp), priority(priority), frame(std::move(frame)) {} |
31 | 31 |
32 AudioDecoder::ParseResult::~ParseResult() = default; | 32 AudioDecoder::ParseResult::~ParseResult() = default; |
33 | 33 |
34 AudioDecoder::ParseResult& AudioDecoder::ParseResult::operator=( | 34 AudioDecoder::ParseResult& AudioDecoder::ParseResult::operator=( |
35 ParseResult&& b) = default; | 35 ParseResult&& b) = default; |
36 | 36 |
37 std::vector<AudioDecoder::ParseResult> AudioDecoder::ParsePayload( | 37 std::vector<AudioDecoder::ParseResult> AudioDecoder::ParsePayload( |
38 rtc::Buffer* payload, | 38 rtc::Buffer* payload, |
39 uint32_t timestamp, | 39 uint32_t timestamp) { |
40 bool is_primary) { | |
41 std::vector<ParseResult> results; | 40 std::vector<ParseResult> results; |
42 std::unique_ptr<EncodedAudioFrame> frame( | 41 std::unique_ptr<EncodedAudioFrame> frame( |
43 new LegacyEncodedAudioFrame(this, payload, is_primary)); | 42 new LegacyEncodedAudioFrame(this, payload)); |
44 results.emplace_back(timestamp, is_primary, std::move(frame)); | 43 results.emplace_back(timestamp, 0, std::move(frame)); |
45 return results; | 44 return results; |
46 } | 45 } |
47 | 46 |
48 int AudioDecoder::Decode(const uint8_t* encoded, size_t encoded_len, | 47 int AudioDecoder::Decode(const uint8_t* encoded, size_t encoded_len, |
49 int sample_rate_hz, size_t max_decoded_bytes, | 48 int sample_rate_hz, size_t max_decoded_bytes, |
50 int16_t* decoded, SpeechType* speech_type) { | 49 int16_t* decoded, SpeechType* speech_type) { |
51 TRACE_EVENT0("webrtc", "AudioDecoder::Decode"); | 50 TRACE_EVENT0("webrtc", "AudioDecoder::Decode"); |
52 rtc::MsanCheckInitialized(rtc::MakeArrayView(encoded, encoded_len)); | 51 rtc::MsanCheckInitialized(rtc::MakeArrayView(encoded, encoded_len)); |
53 int duration = PacketDuration(encoded, encoded_len); | 52 int duration = PacketDuration(encoded, encoded_len); |
54 if (duration >= 0 && | 53 if (duration >= 0 && |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 return kSpeech; | 118 return kSpeech; |
120 case 2: | 119 case 2: |
121 return kComfortNoise; | 120 return kComfortNoise; |
122 default: | 121 default: |
123 assert(false); | 122 assert(false); |
124 return kSpeech; | 123 return kSpeech; |
125 } | 124 } |
126 } | 125 } |
127 | 126 |
128 } // namespace webrtc | 127 } // namespace webrtc |
OLD | NEW |