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

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

Issue 2870043003: Handle padded audio packets correctly (Closed)
Patch Set: const size_t Created 3 years, 7 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/audio_coding_module.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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 int AcmReceiver::last_output_sample_rate_hz() const { 71 int AcmReceiver::last_output_sample_rate_hz() const {
72 return neteq_->last_output_sample_rate_hz(); 72 return neteq_->last_output_sample_rate_hz();
73 } 73 }
74 74
75 int AcmReceiver::InsertPacket(const WebRtcRTPHeader& rtp_header, 75 int AcmReceiver::InsertPacket(const WebRtcRTPHeader& rtp_header,
76 rtc::ArrayView<const uint8_t> incoming_payload) { 76 rtc::ArrayView<const uint8_t> incoming_payload) {
77 uint32_t receive_timestamp = 0; 77 uint32_t receive_timestamp = 0;
78 const RTPHeader* header = &rtp_header.header; // Just a shorthand. 78 const RTPHeader* header = &rtp_header.header; // Just a shorthand.
79 79
80 if (incoming_payload.empty()) {
81 neteq_->InsertEmptyPacket(rtp_header.header);
82 return 0;
83 }
84
80 { 85 {
81 rtc::CritScope lock(&crit_sect_); 86 rtc::CritScope lock(&crit_sect_);
82 87
83 const rtc::Optional<CodecInst> ci = 88 const rtc::Optional<CodecInst> ci =
84 RtpHeaderToDecoder(*header, incoming_payload[0]); 89 RtpHeaderToDecoder(*header, incoming_payload[0]);
85 if (!ci) { 90 if (!ci) {
86 LOG_F(LS_ERROR) << "Payload-type " 91 LOG_F(LS_ERROR) << "Payload-type "
87 << static_cast<int>(header->payloadType) 92 << static_cast<int>(header->payloadType)
88 << " is not registered."; 93 << " is not registered.";
89 return -1; 94 return -1;
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 396
392 void AcmReceiver::GetDecodingCallStatistics( 397 void AcmReceiver::GetDecodingCallStatistics(
393 AudioDecodingCallStats* stats) const { 398 AudioDecodingCallStats* stats) const {
394 rtc::CritScope lock(&crit_sect_); 399 rtc::CritScope lock(&crit_sect_);
395 *stats = call_stats_.GetDecodingStatistics(); 400 *stats = call_stats_.GetDecodingStatistics();
396 } 401 }
397 402
398 } // namespace acm2 403 } // namespace acm2
399 404
400 } // namespace webrtc 405 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/acm2/audio_coding_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698