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

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

Issue 1484343003: NetEq: Add codec name and RTP timestamp rate to DecoderInfo (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years 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
11 #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECODER_DATABASE_H_ 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECODER_DATABASE_H_
12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECODER_DATABASE_H_ 12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECODER_DATABASE_H_
13 13
14 #include <map> 14 #include <map>
15 #include <string>
15 16
16 #include "webrtc/base/constructormagic.h" 17 #include "webrtc/base/constructormagic.h"
18 #include "webrtc/base/scoped_ptr.h"
17 #include "webrtc/common_types.h" // NULL 19 #include "webrtc/common_types.h" // NULL
18 #include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h" 20 #include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h"
19 #include "webrtc/modules/audio_coding/neteq/packet.h" 21 #include "webrtc/modules/audio_coding/neteq/packet.h"
20 #include "webrtc/typedefs.h" 22 #include "webrtc/typedefs.h"
21 23
22 namespace webrtc { 24 namespace webrtc {
23 25
24 class DecoderDatabase { 26 class DecoderDatabase {
25 public: 27 public:
26 enum DatabaseReturnCodes { 28 enum DatabaseReturnCodes {
27 kOK = 0, 29 kOK = 0,
28 kInvalidRtpPayloadType = -1, 30 kInvalidRtpPayloadType = -1,
29 kCodecNotSupported = -2, 31 kCodecNotSupported = -2,
30 kInvalidSampleRate = -3, 32 kInvalidSampleRate = -3,
31 kDecoderExists = -4, 33 kDecoderExists = -4,
32 kDecoderNotFound = -5, 34 kDecoderNotFound = -5,
33 kInvalidPointer = -6 35 kInvalidPointer = -6
34 }; 36 };
35 37
36 // Struct used to store decoder info in the database. 38 // Struct used to store decoder info in the database.
37 struct DecoderInfo { 39 struct DecoderInfo {
38 // Constructors. 40 DecoderInfo() = default;
39 DecoderInfo()
40 : codec_type(NetEqDecoder::kDecoderArbitrary),
41 fs_hz(8000),
42 decoder(NULL),
43 external(false) {}
44 DecoderInfo(NetEqDecoder ct, int fs, AudioDecoder* dec, bool ext) 41 DecoderInfo(NetEqDecoder ct, int fs, AudioDecoder* dec, bool ext)
42 : DecoderInfo(ct, "", fs, dec, ext) {}
43 DecoderInfo(NetEqDecoder ct,
44 const std::string& nm,
45 int fs,
46 AudioDecoder* dec,
47 bool ext)
45 : codec_type(ct), 48 : codec_type(ct),
49 name(nm),
46 fs_hz(fs), 50 fs_hz(fs),
51 rtp_sample_rate_hz(fs),
47 decoder(dec), 52 decoder(dec),
48 external(ext) { 53 external(ext) {}
49 }
50 // Destructor. (Defined in decoder_database.cc.)
51 ~DecoderInfo(); 54 ~DecoderInfo();
52 55
53 NetEqDecoder codec_type; 56 NetEqDecoder codec_type = NetEqDecoder::kDecoderArbitrary;
54 int fs_hz; 57 std::string name;
55 AudioDecoder* decoder; 58 int fs_hz = 8000;
56 bool external; 59 int rtp_sample_rate_hz = 8000;
60 AudioDecoder* decoder = nullptr;
61 bool external = false;
57 }; 62 };
58 63
59 // 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
60 // only 7 bits). 65 // only 7 bits).
61 static const uint8_t kRtpPayloadTypeError = 0xFF; 66 static const uint8_t kRtpPayloadTypeError = 0xFF;
62 67
63 DecoderDatabase(); 68 DecoderDatabase();
64 69
65 virtual ~DecoderDatabase(); 70 virtual ~DecoderDatabase();
66 71
(...skipping 10 matching lines...) Expand all
77 82
78 // Registers |rtp_payload_type| as a decoder of type |codec_type|. Returns 83 // Registers |rtp_payload_type| as a decoder of type |codec_type|. Returns
79 // kOK on success; otherwise an error code. 84 // kOK on success; otherwise an error code.
80 virtual int RegisterPayload(uint8_t rtp_payload_type, 85 virtual int RegisterPayload(uint8_t rtp_payload_type,
81 NetEqDecoder codec_type); 86 NetEqDecoder codec_type);
82 87
83 // Registers an externally created AudioDecoder object, and associates it 88 // Registers an externally created AudioDecoder object, and associates it
84 // as a decoder of type |codec_type| with |rtp_payload_type|. 89 // as a decoder of type |codec_type| with |rtp_payload_type|.
85 virtual int InsertExternal(uint8_t rtp_payload_type, 90 virtual int InsertExternal(uint8_t rtp_payload_type,
86 NetEqDecoder codec_type, 91 NetEqDecoder codec_type,
87 int fs_hz, AudioDecoder* decoder); 92 const std::string& codec_name,
93 int fs_hz,
94 AudioDecoder* decoder);
88 95
89 // Removes the entry for |rtp_payload_type| from the database. 96 // Removes the entry for |rtp_payload_type| from the database.
90 // Returns kDecoderNotFound or kOK depending on the outcome of the operation. 97 // Returns kDecoderNotFound or kOK depending on the outcome of the operation.
91 virtual int Remove(uint8_t rtp_payload_type); 98 virtual int Remove(uint8_t rtp_payload_type);
92 99
93 // Returns a pointer to the DecoderInfo struct for |rtp_payload_type|. If 100 // Returns a pointer to the DecoderInfo struct for |rtp_payload_type|. If
94 // no decoder is registered with that |rtp_payload_type|, NULL is returned. 101 // no decoder is registered with that |rtp_payload_type|, NULL is returned.
95 virtual const DecoderInfo* GetDecoderInfo(uint8_t rtp_payload_type) const; 102 virtual const DecoderInfo* GetDecoderInfo(uint8_t rtp_payload_type) const;
96 103
97 // Returns one RTP payload type associated with |codec_type|, or 104 // Returns one RTP payload type associated with |codec_type|, or
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 151
145 DecoderMap decoders_; 152 DecoderMap decoders_;
146 int active_decoder_; 153 int active_decoder_;
147 int active_cng_decoder_; 154 int active_cng_decoder_;
148 155
149 RTC_DISALLOW_COPY_AND_ASSIGN(DecoderDatabase); 156 RTC_DISALLOW_COPY_AND_ASSIGN(DecoderDatabase);
150 }; 157 };
151 158
152 } // namespace webrtc 159 } // namespace webrtc
153 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECODER_DATABASE_H_ 160 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECODER_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698