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/acm2/audio_coding_module.cc

Issue 2870043003: Handle padded audio packets correctly (Closed)
Patch Set: Add TODO bug for NACK 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
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 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 rtc::CritScope lock(&acm_crit_sect_); 1069 rtc::CritScope lock(&acm_crit_sect_);
1070 return receiver_.LastAudioCodec(current_codec); 1070 return receiver_.LastAudioCodec(current_codec);
1071 } 1071 }
1072 1072
1073 rtc::Optional<SdpAudioFormat> AudioCodingModuleImpl::ReceiveFormat() const { 1073 rtc::Optional<SdpAudioFormat> AudioCodingModuleImpl::ReceiveFormat() const {
1074 rtc::CritScope lock(&acm_crit_sect_); 1074 rtc::CritScope lock(&acm_crit_sect_);
1075 return receiver_.LastAudioFormat(); 1075 return receiver_.LastAudioFormat();
1076 } 1076 }
1077 1077
1078 // Incoming packet from network parsed and ready for decode. 1078 // Incoming packet from network parsed and ready for decode.
1079 int AudioCodingModuleImpl::IncomingPacket(const uint8_t* incoming_payload, 1079 int AudioCodingModuleImpl::IncomingPacket(const uint8_t* incoming_payload,
minyue-webrtc 2017/05/09 21:04:06 will this affect DTX sync packets?
hlundin-webrtc 2017/05/10 08:57:23 Aren't they 1 or 2 bytes? https://cs.chromium.org
minyue-webrtc 2017/05/10 09:44:12 Yes. Thanks
1080 const size_t payload_length, 1080 const size_t payload_length,
1081 const WebRtcRTPHeader& rtp_header) { 1081 const WebRtcRTPHeader& rtp_header) {
1082 if (payload_length == 0) {
1083 // This is an empty packet, which is not a problem, but we will have to
1084 // construct an empty ArrayView.
1085 return receiver_.InsertPacket(rtp_header, rtc::ArrayView<const uint8_t>());
1086 }
1082 return receiver_.InsertPacket( 1087 return receiver_.InsertPacket(
1083 rtp_header, 1088 rtp_header,
minyue-webrtc 2017/05/09 21:04:06 reading rtc::ArrayView i think it is safe to just
hlundin-webrtc 2017/05/10 08:57:23 I don't think so. If we construct an ArrayView wit
minyue-webrtc 2017/05/10 09:44:11 But shouldn't incoming_payload be a null?
hlundin-webrtc 2017/05/10 11:19:30 Done.
1084 rtc::ArrayView<const uint8_t>(incoming_payload, payload_length)); 1089 rtc::ArrayView<const uint8_t>(incoming_payload, payload_length));
1085 } 1090 }
1086 1091
1087 // Minimum playout delay (Used for lip-sync). 1092 // Minimum playout delay (Used for lip-sync).
1088 int AudioCodingModuleImpl::SetMinimumPlayoutDelay(int time_ms) { 1093 int AudioCodingModuleImpl::SetMinimumPlayoutDelay(int time_ms) {
1089 if ((time_ms < 0) || (time_ms > 10000)) { 1094 if ((time_ms < 0) || (time_ms > 10000)) {
1090 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_, 1095 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
1091 "Delay must be in the range of 0-1000 milliseconds."); 1096 "Delay must be in the range of 0-1000 milliseconds.");
1092 return -1; 1097 return -1;
1093 } 1098 }
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 // Checks the validity of the parameters of the given codec 1367 // Checks the validity of the parameters of the given codec
1363 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) { 1368 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) {
1364 bool valid = acm2::RentACodec::IsCodecValid(codec); 1369 bool valid = acm2::RentACodec::IsCodecValid(codec);
1365 if (!valid) 1370 if (!valid)
1366 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1, 1371 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1,
1367 "Invalid codec setting"); 1372 "Invalid codec setting");
1368 return valid; 1373 return valid;
1369 } 1374 }
1370 1375
1371 } // namespace webrtc 1376 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698