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