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

Side by Side Diff: webrtc/modules/audio_coding/codecs/audio_decoder.h

Issue 2342443005: Moved Opus-specific payload splitting into AudioDecoderOpus. (Closed)
Patch Set: Created 4 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
OLDNEW
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
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // Returns rtc::Optional containing the total number of samples across all 54 // Returns rtc::Optional containing the total number of samples across all
55 // channels, as well as whether the decoder produced comfort noise or 55 // channels, as well as whether the decoder produced comfort noise or
56 // speech. Decode must only be called once per frame object. 56 // speech. Decode must only be called once per frame object.
57 virtual rtc::Optional<DecodeResult> Decode( 57 virtual rtc::Optional<DecodeResult> Decode(
58 rtc::ArrayView<int16_t> decoded) const = 0; 58 rtc::ArrayView<int16_t> decoded) const = 0;
59 }; 59 };
60 60
61 struct ParseResult { 61 struct ParseResult {
62 ParseResult(); 62 ParseResult();
63 ParseResult(uint32_t timestamp, 63 ParseResult(uint32_t timestamp,
64 bool primary, 64 uint8_t priority,
hlundin-webrtc 2016/09/15 09:33:29 "You should not use the unsigned integer types suc
ossu 2016/09/15 12:22:53 You are technically correct - the best kind of cor
hlundin-webrtc 2016/09/16 07:51:27 Once upon a time, in an office building (not so) f
kwiberg-webrtc 2016/09/19 11:07:49 Function arguments and local variables are stored
ossu 2016/09/19 11:41:01 I've thought about this change as also applying to
kwiberg-webrtc 2016/09/19 11:55:16 I also thought about this change as applying to Pa
ossu 2016/09/19 14:07:33 If we want some priority level to correspond to "n
kwiberg-webrtc 2016/09/20 09:14:44 Ah, yes, for stats I can see why we'd care about t
65 std::unique_ptr<EncodedAudioFrame> frame); 65 std::unique_ptr<EncodedAudioFrame> frame);
66 ParseResult(ParseResult&& b); 66 ParseResult(ParseResult&& b);
67 ~ParseResult(); 67 ~ParseResult();
68 68
69 ParseResult& operator=(ParseResult&& b); 69 ParseResult& operator=(ParseResult&& b);
70 70
71 // The timestamp of the frame is in samples per channel. 71 // The timestamp of the frame is in samples per channel.
72 uint32_t timestamp; 72 uint32_t timestamp;
73 bool primary; 73 // The relative priority of the frame compared to other frames of the same
74 // payload and the same timeframe. A higher value means a lower priority.
75 uint8_t priority;
74 std::unique_ptr<EncodedAudioFrame> frame; 76 std::unique_ptr<EncodedAudioFrame> frame;
75 }; 77 };
76 78
77 // Let the decoder parse this payload and prepare zero or more decodable 79 // Let the decoder parse this payload and prepare zero or more decodable
78 // frames. Each frame must be at most 120 ms long. The decoder is free to swap 80 // frames. Each frame must be at most 120 ms long. The decoder is free to swap
79 // or move the data from the |payload| buffer. 81 // or move the data from the |payload| buffer.
80 virtual std::vector<ParseResult> ParsePayload(rtc::Buffer* payload, 82 virtual std::vector<ParseResult> ParsePayload(rtc::Buffer* payload,
81 uint32_t timestamp, 83 uint32_t timestamp);
82 bool is_primary);
83 84
84 // Decodes |encode_len| bytes from |encoded| and writes the result in 85 // Decodes |encode_len| bytes from |encoded| and writes the result in
85 // |decoded|. The maximum bytes allowed to be written into |decoded| is 86 // |decoded|. The maximum bytes allowed to be written into |decoded| is
86 // |max_decoded_bytes|. Returns the total number of samples across all 87 // |max_decoded_bytes|. Returns the total number of samples across all
87 // channels. If the decoder produced comfort noise, |speech_type| 88 // channels. If the decoder produced comfort noise, |speech_type|
88 // is set to kComfortNoise, otherwise it is kSpeech. The desired output 89 // is set to kComfortNoise, otherwise it is kSpeech. The desired output
89 // sample rate is provided in |sample_rate_hz|, which must be valid for the 90 // sample rate is provided in |sample_rate_hz|, which must be valid for the
90 // codec at hand. 91 // codec at hand.
91 int Decode(const uint8_t* encoded, 92 int Decode(const uint8_t* encoded,
92 size_t encoded_len, 93 size_t encoded_len,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 int sample_rate_hz, 164 int sample_rate_hz,
164 int16_t* decoded, 165 int16_t* decoded,
165 SpeechType* speech_type); 166 SpeechType* speech_type);
166 167
167 private: 168 private:
168 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoder); 169 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoder);
169 }; 170 };
170 171
171 } // namespace webrtc 172 } // namespace webrtc
172 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_INCLUDE_AUDIO_DECODER_H_ 173 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_INCLUDE_AUDIO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698