NetEq: Drop unnecessary dependency on the audio decoder implementations

BUG=webrtc:8396

Change-Id: I7524dae93b43b656a13fdd535e48373bc29b405e
Reviewed-on: https://webrtc-review.googlesource.com/10804
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20310}
This commit is contained in:
Karl Wiberg
2017-10-16 12:42:38 +02:00
committed by Commit Bot
parent f52a3a78c5
commit 31fbb5425e
12 changed files with 69 additions and 225 deletions

View File

@ -11,6 +11,7 @@
#include "modules/audio_coding/neteq/timestamp_scaler.h"
#include "modules/audio_coding/neteq/decoder_database.h"
#include "rtc_base/checks.h"
namespace webrtc {
@ -59,7 +60,7 @@ uint32_t TimestampScaler::ToInternal(uint32_t external_timestamp,
first_packet_received_ = true;
}
const int64_t external_diff = int64_t{external_timestamp} - external_ref_;
assert(denominator_ > 0); // Should not be possible.
RTC_DCHECK_GT(denominator_, 0);
external_ref_ = external_timestamp;
internal_ref_ += (external_diff * numerator_) / denominator_;
return internal_ref_;
@ -76,7 +77,7 @@ uint32_t TimestampScaler::ToExternal(uint32_t internal_timestamp) const {
return internal_timestamp;
} else {
const int64_t internal_diff = int64_t{internal_timestamp} - internal_ref_;
assert(numerator_ > 0); // Should not be possible.
RTC_DCHECK_GT(numerator_, 0);
// Do not update references in this method.
// Switch |denominator_| and |numerator_| to convert the other way.
return external_ref_ + (internal_diff * denominator_) / numerator_;