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

Side by Side Diff: webrtc/modules/audio_coding/acm2/acm_receiver.h

Issue 2354453003: AcmReceiver: Look up last decoder in NetEq's table of decoders (Closed)
Patch Set: grammar 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
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/acm2/acm_receiver.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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 21 matching lines...) Expand all
32 32
33 namespace webrtc { 33 namespace webrtc {
34 34
35 struct CodecInst; 35 struct CodecInst;
36 class NetEq; 36 class NetEq;
37 37
38 namespace acm2 { 38 namespace acm2 {
39 39
40 class AcmReceiver { 40 class AcmReceiver {
41 public: 41 public:
42 struct Decoder {
43 int acm_codec_id;
44 uint8_t payload_type;
45 // This field is meaningful for codecs where both mono and
46 // stereo versions are registered under the same ID.
47 size_t channels;
48 int sample_rate_hz;
49 };
50
51 // Constructor of the class 42 // Constructor of the class
52 explicit AcmReceiver(const AudioCodingModule::Config& config); 43 explicit AcmReceiver(const AudioCodingModule::Config& config);
53 44
54 // Destructor of the class. 45 // Destructor of the class.
55 ~AcmReceiver(); 46 ~AcmReceiver();
56 47
57 // 48 //
58 // Inserts a payload with its associated RTP-header into NetEq. 49 // Inserts a payload with its associated RTP-header into NetEq.
59 // 50 //
60 // Input: 51 // Input:
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 // -round_trip_time_ms : estimate of the round-trip-time (in milliseconds). 246 // -round_trip_time_ms : estimate of the round-trip-time (in milliseconds).
256 // Return value : list of packets to be retransmitted. 247 // Return value : list of packets to be retransmitted.
257 // 248 //
258 std::vector<uint16_t> GetNackList(int64_t round_trip_time_ms) const; 249 std::vector<uint16_t> GetNackList(int64_t round_trip_time_ms) const;
259 250
260 // 251 //
261 // Get statistics of calls to GetAudio(). 252 // Get statistics of calls to GetAudio().
262 void GetDecodingCallStatistics(AudioDecodingCallStats* stats) const; 253 void GetDecodingCallStatistics(AudioDecodingCallStats* stats) const;
263 254
264 private: 255 private:
265 const Decoder* RtpHeaderToDecoder(const RTPHeader& rtp_header, 256 struct Decoder {
266 uint8_t payload_type) const 257 int acm_codec_id;
267 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); 258 uint8_t payload_type;
259 // This field is meaningful for codecs where both mono and
260 // stereo versions are registered under the same ID.
261 size_t channels;
262 int sample_rate_hz;
263 };
264
265 const rtc::Optional<CodecInst> RtpHeaderToDecoder(
266 const RTPHeader& rtp_header,
267 uint8_t first_payload_byte) const EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
268 268
269 uint32_t NowInTimestamp(int decoder_sampling_rate) const; 269 uint32_t NowInTimestamp(int decoder_sampling_rate) const;
270 270
271 rtc::CriticalSection crit_sect_; 271 rtc::CriticalSection crit_sect_;
272 const Decoder* last_audio_decoder_ GUARDED_BY(crit_sect_); 272 rtc::Optional<CodecInst> last_audio_decoder_ GUARDED_BY(crit_sect_);
273 ACMResampler resampler_ GUARDED_BY(crit_sect_); 273 ACMResampler resampler_ GUARDED_BY(crit_sect_);
274 std::unique_ptr<int16_t[]> last_audio_buffer_ GUARDED_BY(crit_sect_); 274 std::unique_ptr<int16_t[]> last_audio_buffer_ GUARDED_BY(crit_sect_);
275 CallStatistics call_stats_ GUARDED_BY(crit_sect_); 275 CallStatistics call_stats_ GUARDED_BY(crit_sect_);
276 NetEq* neteq_; 276 NetEq* neteq_;
277 // Decoders map is keyed by payload type 277 // Decoders map is keyed by payload type
278 std::map<uint8_t, Decoder> decoders_ GUARDED_BY(crit_sect_); 278 std::map<uint8_t, Decoder> decoders_ GUARDED_BY(crit_sect_);
279 Clock* clock_; // TODO(henrik.lundin) Make const if possible. 279 Clock* clock_; // TODO(henrik.lundin) Make const if possible.
280 bool resampled_last_output_frame_ GUARDED_BY(crit_sect_); 280 bool resampled_last_output_frame_ GUARDED_BY(crit_sect_);
281 rtc::Optional<int> last_packet_sample_rate_hz_ GUARDED_BY(crit_sect_); 281 rtc::Optional<int> last_packet_sample_rate_hz_ GUARDED_BY(crit_sect_);
282 }; 282 };
283 283
284 } // namespace acm2 284 } // namespace acm2
285 285
286 } // namespace webrtc 286 } // namespace webrtc
287 287
288 #endif // WEBRTC_MODULES_AUDIO_CODING_ACM2_ACM_RECEIVER_H_ 288 #endif // WEBRTC_MODULES_AUDIO_CODING_ACM2_ACM_RECEIVER_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/acm2/acm_receiver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698