Index: webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc |
diff --git a/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc b/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc |
index 6f6e39e32761b25ae7880db5785fed7d70d625b9..4c9ab6db62e3b71b4686624db45f33d311a1eeed 100644 |
--- a/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc |
+++ b/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc |
@@ -284,9 +284,8 @@ AudioEncoderOpus::Config AudioEncoderOpus::CreateConfig( |
class AudioEncoderOpus::PacketLossFractionSmoother { |
public: |
- explicit PacketLossFractionSmoother(const Clock* clock) |
- : clock_(clock), |
- last_sample_time_ms_(clock_->TimeInMilliseconds()), |
+ explicit PacketLossFractionSmoother() |
+ : last_sample_time_ms_(rtc::TimeMillis()), |
smoother_(kAlphaForPacketLossFractionSmoother) {} |
// Gets the smoothed packet loss fraction. |
@@ -297,14 +296,13 @@ class AudioEncoderOpus::PacketLossFractionSmoother { |
// Add new observation to the packet loss fraction smoother. |
void AddSample(float packet_loss_fraction) { |
- int64_t now_ms = clock_->TimeInMilliseconds(); |
+ int64_t now_ms = rtc::TimeMillis(); |
smoother_.Apply(static_cast<float>(now_ms - last_sample_time_ms_), |
packet_loss_fraction); |
last_sample_time_ms_ = now_ms; |
} |
private: |
- const Clock* const clock_; |
int64_t last_sample_time_ms_; |
// An exponential filter is used to smooth the packet loss fraction. |
@@ -366,21 +364,19 @@ AudioEncoderOpus::AudioEncoderOpus( |
"WebRTC-SendSideBwe-WithOverhead")), |
packet_loss_rate_(0.0), |
inst_(nullptr), |
- packet_loss_fraction_smoother_(new PacketLossFractionSmoother( |
- config.clock)), |
+ packet_loss_fraction_smoother_(new PacketLossFractionSmoother()), |
audio_network_adaptor_creator_( |
audio_network_adaptor_creator |
? std::move(audio_network_adaptor_creator) |
: [this](const ProtoString& config_string, |
- RtcEventLog* event_log, |
- const Clock* clock) { |
+ RtcEventLog* event_log) { |
return DefaultAudioNetworkAdaptorCreator(config_string, |
- event_log, clock); |
+ event_log); |
}), |
bitrate_smoother_(bitrate_smoother |
? std::move(bitrate_smoother) : std::unique_ptr<SmoothingFilter>( |
// We choose 5sec as initial time constant due to empirical data. |
- new SmoothingFilterImpl(5000, config.clock))) { |
+ new SmoothingFilterImpl(5000))) { |
RTC_CHECK(RecreateEncoderInstance(config)); |
} |
@@ -464,10 +460,9 @@ void AudioEncoderOpus::SetMaxPlaybackRate(int frequency_hz) { |
bool AudioEncoderOpus::EnableAudioNetworkAdaptor( |
const std::string& config_string, |
- RtcEventLog* event_log, |
- const Clock* clock) { |
+ RtcEventLog* event_log) { |
audio_network_adaptor_ = |
- audio_network_adaptor_creator_(config_string, event_log, clock); |
+ audio_network_adaptor_creator_(config_string, event_log); |
return audio_network_adaptor_.get() != nullptr; |
} |
@@ -723,17 +718,15 @@ void AudioEncoderOpus::ApplyAudioNetworkAdaptor() { |
std::unique_ptr<AudioNetworkAdaptor> |
AudioEncoderOpus::DefaultAudioNetworkAdaptorCreator( |
const ProtoString& config_string, |
- RtcEventLog* event_log, |
- const Clock* clock) const { |
+ RtcEventLog* event_log) const { |
AudioNetworkAdaptorImpl::Config config; |
- config.clock = clock; |
config.event_log = event_log; |
return std::unique_ptr<AudioNetworkAdaptor>(new AudioNetworkAdaptorImpl( |
config, |
ControllerManagerImpl::Create( |
config_string, NumChannels(), supported_frame_lengths_ms(), |
kOpusMinBitrateBps, num_channels_to_encode_, next_frame_length_ms_, |
- GetTargetBitrate(), config_.fec_enabled, GetDtx(), clock))); |
+ GetTargetBitrate(), config_.fec_enabled, GetDtx()))); |
} |
void AudioEncoderOpus::MaybeUpdateUplinkBandwidth() { |