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

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

Issue 2271203003: Fixing timestamp comparison assert. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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 | no next file » | 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) 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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 470
471 int32_t AudioCodingModuleImpl::Encode(const InputData& input_data) { 471 int32_t AudioCodingModuleImpl::Encode(const InputData& input_data) {
472 AudioEncoder::EncodedInfo encoded_info; 472 AudioEncoder::EncodedInfo encoded_info;
473 uint8_t previous_pltype; 473 uint8_t previous_pltype;
474 474
475 // Check if there is an encoder before. 475 // Check if there is an encoder before.
476 if (!HaveValidEncoder("Process")) 476 if (!HaveValidEncoder("Process"))
477 return -1; 477 return -1;
478 478
479 if(!first_frame_) { 479 if(!first_frame_) {
480 RTC_DCHECK_GT(input_data.input_timestamp, last_timestamp_) 480 RTC_DCHECK(IsNewerTimestamp(input_data.input_timestamp, last_timestamp_))
481 << "Time should not move backwards"; 481 << "Time should not move backwards";
482 } 482 }
483 483
484 // Scale the timestamp to the codec's RTP timestamp rate. 484 // Scale the timestamp to the codec's RTP timestamp rate.
485 uint32_t rtp_timestamp = 485 uint32_t rtp_timestamp =
486 first_frame_ ? input_data.input_timestamp 486 first_frame_ ? input_data.input_timestamp
487 : last_rtp_timestamp_ + 487 : last_rtp_timestamp_ +
488 rtc::CheckedDivExact( 488 rtc::CheckedDivExact(
489 input_data.input_timestamp - last_timestamp_, 489 input_data.input_timestamp - last_timestamp_,
490 static_cast<uint32_t>(rtc::CheckedDivExact( 490 static_cast<uint32_t>(rtc::CheckedDivExact(
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 // Checks the validity of the parameters of the given codec 1347 // Checks the validity of the parameters of the given codec
1348 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) { 1348 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) {
1349 bool valid = acm2::RentACodec::IsCodecValid(codec); 1349 bool valid = acm2::RentACodec::IsCodecValid(codec);
1350 if (!valid) 1350 if (!valid)
1351 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1, 1351 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1,
1352 "Invalid codec setting"); 1352 "Invalid codec setting");
1353 return valid; 1353 return valid;
1354 } 1354 }
1355 1355
1356 } // namespace webrtc 1356 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698