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

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

Issue 1319683002: AudioDecoder: Replace Init() with Reset() (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@buffer
Patch Set: review fixes Created 5 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 if (!CodecSupported(codec_type)) { 66 if (!CodecSupported(codec_type)) {
67 return kCodecNotSupported; 67 return kCodecNotSupported;
68 } 68 }
69 if (fs_hz != 8000 && fs_hz != 16000 && fs_hz != 32000 && fs_hz != 48000) { 69 if (fs_hz != 8000 && fs_hz != 16000 && fs_hz != 32000 && fs_hz != 48000) {
70 return kInvalidSampleRate; 70 return kInvalidSampleRate;
71 } 71 }
72 if (!decoder) { 72 if (!decoder) {
73 return kInvalidPointer; 73 return kInvalidPointer;
74 } 74 }
75 decoder->Init();
76 std::pair<DecoderMap::iterator, bool> ret; 75 std::pair<DecoderMap::iterator, bool> ret;
77 DecoderInfo info(codec_type, fs_hz, decoder, true); 76 DecoderInfo info(codec_type, fs_hz, decoder, true);
78 ret = decoders_.insert(std::make_pair(rtp_payload_type, info)); 77 ret = decoders_.insert(std::make_pair(rtp_payload_type, info));
79 if (ret.second == false) { 78 if (ret.second == false) {
80 // Database already contains a decoder with type |rtp_payload_type|. 79 // Database already contains a decoder with type |rtp_payload_type|.
81 return kDecoderExists; 80 return kDecoderExists;
82 } 81 }
83 return kOK; 82 return kOK;
84 } 83 }
85 84
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 if (it == decoders_.end()) { 128 if (it == decoders_.end()) {
130 // Decoder not found. 129 // Decoder not found.
131 return NULL; 130 return NULL;
132 } 131 }
133 DecoderInfo* info = &(*it).second; 132 DecoderInfo* info = &(*it).second;
134 if (!info->decoder) { 133 if (!info->decoder) {
135 // Create the decoder object. 134 // Create the decoder object.
136 AudioDecoder* decoder = CreateAudioDecoder(info->codec_type); 135 AudioDecoder* decoder = CreateAudioDecoder(info->codec_type);
137 assert(decoder); // Should not be able to have an unsupported codec here. 136 assert(decoder); // Should not be able to have an unsupported codec here.
138 info->decoder = decoder; 137 info->decoder = decoder;
139 info->decoder->Init();
140 } 138 }
141 return info->decoder; 139 return info->decoder;
142 } 140 }
143 141
144 bool DecoderDatabase::IsType(uint8_t rtp_payload_type, 142 bool DecoderDatabase::IsType(uint8_t rtp_payload_type,
145 NetEqDecoder codec_type) const { 143 NetEqDecoder codec_type) const {
146 DecoderMap::const_iterator it = decoders_.find(rtp_payload_type); 144 DecoderMap::const_iterator it = decoders_.find(rtp_payload_type);
147 if (it == decoders_.end()) { 145 if (it == decoders_.end()) {
148 // Decoder not found. 146 // Decoder not found.
149 return false; 147 return false;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 LOG(LS_WARNING) << "CheckPayloadTypes: unknown RTP payload type " 251 LOG(LS_WARNING) << "CheckPayloadTypes: unknown RTP payload type "
254 << static_cast<int>((*it)->header.payloadType); 252 << static_cast<int>((*it)->header.payloadType);
255 return kDecoderNotFound; 253 return kDecoderNotFound;
256 } 254 }
257 } 255 }
258 return kOK; 256 return kOK;
259 } 257 }
260 258
261 259
262 } // namespace webrtc 260 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698