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

Side by Side Diff: webrtc/modules/audio_coding/neteq/decoder_database.h

Issue 1899733002: NetEq: Simplify DecoderDatabase::DecoderInfo (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: review comments Created 4 years, 8 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 | « no previous file | webrtc/modules/audio_coding/neteq/decoder_database.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 16 matching lines...) Expand all
27 enum DatabaseReturnCodes { 27 enum DatabaseReturnCodes {
28 kOK = 0, 28 kOK = 0,
29 kInvalidRtpPayloadType = -1, 29 kInvalidRtpPayloadType = -1,
30 kCodecNotSupported = -2, 30 kCodecNotSupported = -2,
31 kInvalidSampleRate = -3, 31 kInvalidSampleRate = -3,
32 kDecoderExists = -4, 32 kDecoderExists = -4,
33 kDecoderNotFound = -5, 33 kDecoderNotFound = -5,
34 kInvalidPointer = -6 34 kInvalidPointer = -6
35 }; 35 };
36 36
37 // Struct used to store decoder info in the database. 37 // Class that stores decoder info in the database.
38 struct DecoderInfo { 38 class DecoderInfo {
39 DecoderInfo() = default; 39 public:
40 DecoderInfo(NetEqDecoder ct, int fs, AudioDecoder* dec, bool ext)
41 : DecoderInfo(ct, "", fs, dec, ext) {}
42 DecoderInfo(NetEqDecoder ct, 40 DecoderInfo(NetEqDecoder ct,
43 const std::string& nm, 41 const std::string& nm,
44 int fs, 42 int fs,
45 AudioDecoder* dec, 43 AudioDecoder* ext_dec);
46 bool ext) 44 DecoderInfo(DecoderInfo&&);
47 : codec_type(ct),
48 name(nm),
49 fs_hz(fs),
50 rtp_sample_rate_hz(fs),
51 decoder(dec),
52 external(ext) {}
53 ~DecoderInfo(); 45 ~DecoderInfo();
54 46
55 NetEqDecoder codec_type = NetEqDecoder::kDecoderArbitrary; 47 // Get the AudioDecoder object, creating it first if necessary.
56 std::string name; 48 AudioDecoder* GetDecoder();
57 int fs_hz = 8000; 49
58 int rtp_sample_rate_hz = 8000; 50 // Delete the AudioDecoder object, unless it's external. (This means we can
59 AudioDecoder* decoder = nullptr; 51 // always recreate it later if we need it.)
60 bool external = false; 52 void DropDecoder() { decoder_.reset(); }
53
54 const NetEqDecoder codec_type;
55 const std::string name;
56 const int fs_hz;
57 const int rtp_sample_rate_hz;
58 AudioDecoder* const external_decoder;
59
60 private:
61 std::unique_ptr<AudioDecoder> decoder_;
61 }; 62 };
62 63
63 // Maximum value for 8 bits, and an invalid RTP payload type (since it is 64 // Maximum value for 8 bits, and an invalid RTP payload type (since it is
64 // only 7 bits). 65 // only 7 bits).
65 static const uint8_t kRtpPayloadTypeError = 0xFF; 66 static const uint8_t kRtpPayloadTypeError = 0xFF;
66 67
67 DecoderDatabase(); 68 DecoderDatabase();
68 69
69 virtual ~DecoderDatabase(); 70 virtual ~DecoderDatabase();
70 71
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 154
154 DecoderMap decoders_; 155 DecoderMap decoders_;
155 int active_decoder_; 156 int active_decoder_;
156 int active_cng_decoder_; 157 int active_cng_decoder_;
157 158
158 RTC_DISALLOW_COPY_AND_ASSIGN(DecoderDatabase); 159 RTC_DISALLOW_COPY_AND_ASSIGN(DecoderDatabase);
159 }; 160 };
160 161
161 } // namespace webrtc 162 } // namespace webrtc
162 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECODER_DATABASE_H_ 163 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECODER_DATABASE_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/neteq/decoder_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698