| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 |
| 11 #include <math.h> | 11 #include <math.h> |
| 12 |
| 12 #include <algorithm> | 13 #include <algorithm> |
| 13 | 14 |
| 15 #include "webrtc/logging/rtc_event_log/events/rtc_event_audio_network_adaptation
.h" |
| 14 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 16 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
| 15 #include "webrtc/modules/audio_coding/audio_network_adaptor/event_log_writer.h" | 17 #include "webrtc/modules/audio_coding/audio_network_adaptor/event_log_writer.h" |
| 18 #include "webrtc/rtc_base/ptr_util.h" |
| 16 | 19 |
| 17 namespace webrtc { | 20 namespace webrtc { |
| 18 | 21 |
| 19 EventLogWriter::EventLogWriter(RtcEventLog* event_log, | 22 EventLogWriter::EventLogWriter(RtcEventLog* event_log, |
| 20 int min_bitrate_change_bps, | 23 int min_bitrate_change_bps, |
| 21 float min_bitrate_change_fraction, | 24 float min_bitrate_change_fraction, |
| 22 float min_packet_loss_change_fraction) | 25 float min_packet_loss_change_fraction) |
| 23 : event_log_(event_log), | 26 : event_log_(event_log), |
| 24 min_bitrate_change_bps_(min_bitrate_change_bps), | 27 min_bitrate_change_bps_(min_bitrate_change_bps), |
| 25 min_bitrate_change_fraction_(min_bitrate_change_fraction), | 28 min_bitrate_change_fraction_(min_bitrate_change_fraction), |
| (...skipping 27 matching lines...) Expand all Loading... |
| 53 config.uplink_packet_loss_fraction && | 56 config.uplink_packet_loss_fraction && |
| 54 fabs(*last_logged_config_.uplink_packet_loss_fraction - | 57 fabs(*last_logged_config_.uplink_packet_loss_fraction - |
| 55 *config.uplink_packet_loss_fraction) >= | 58 *config.uplink_packet_loss_fraction) >= |
| 56 min_packet_loss_change_fraction_ * | 59 min_packet_loss_change_fraction_ * |
| 57 *last_logged_config_.uplink_packet_loss_fraction)) { | 60 *last_logged_config_.uplink_packet_loss_fraction)) { |
| 58 return LogEncoderConfig(config); | 61 return LogEncoderConfig(config); |
| 59 } | 62 } |
| 60 } | 63 } |
| 61 | 64 |
| 62 void EventLogWriter::LogEncoderConfig(const AudioEncoderRuntimeConfig& config) { | 65 void EventLogWriter::LogEncoderConfig(const AudioEncoderRuntimeConfig& config) { |
| 63 event_log_->LogAudioNetworkAdaptation(config); | 66 auto config_copy = rtc::MakeUnique<AudioEncoderRuntimeConfig>(config); |
| 67 event_log_->Log( |
| 68 rtc::MakeUnique<RtcEventAudioNetworkAdaptation>(std::move(config_copy))); |
| 64 last_logged_config_ = config; | 69 last_logged_config_ = config; |
| 65 } | 70 } |
| 66 | 71 |
| 67 } // namespace webrtc | 72 } // namespace webrtc |
| OLD | NEW |