| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 "webrtc/modules/pacing/bitrate_prober.h" | 11 #include "webrtc/modules/pacing/bitrate_prober.h" |
| 12 | 12 |
| 13 #include <assert.h> | 13 #include <assert.h> |
| 14 #include <algorithm> | 14 #include <algorithm> |
| 15 #include <limits> | 15 #include <limits> |
| 16 #include <sstream> | 16 #include <sstream> |
| 17 | 17 |
| 18 #include "webrtc/base/logging.h" |
| 18 #include "webrtc/modules/pacing/paced_sender.h" | 19 #include "webrtc/modules/pacing/paced_sender.h" |
| 19 #include "webrtc/system_wrappers/include/logging.h" | |
| 20 | 20 |
| 21 namespace webrtc { | 21 namespace webrtc { |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 int ComputeDeltaFromBitrate(size_t packet_size, int bitrate_bps) { | 24 int ComputeDeltaFromBitrate(size_t packet_size, int bitrate_bps) { |
| 25 assert(bitrate_bps > 0); | 25 assert(bitrate_bps > 0); |
| 26 // Compute the time delta needed to send packet_size bytes at bitrate_bps | 26 // Compute the time delta needed to send packet_size bytes at bitrate_bps |
| 27 // bps. Result is in milliseconds. | 27 // bps. Result is in milliseconds. |
| 28 return static_cast<int>(1000ll * static_cast<int64_t>(packet_size) * 8ll / | 28 return static_cast<int>(1000ll * static_cast<int64_t>(packet_size) * 8ll / |
| 29 bitrate_bps); | 29 bitrate_bps); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 void BitrateProber::PacketSent(int64_t now_ms, size_t packet_size) { | 120 void BitrateProber::PacketSent(int64_t now_ms, size_t packet_size) { |
| 121 assert(packet_size > 0); | 121 assert(packet_size > 0); |
| 122 packet_size_last_send_ = packet_size; | 122 packet_size_last_send_ = packet_size; |
| 123 time_last_send_ms_ = now_ms; | 123 time_last_send_ms_ = now_ms; |
| 124 if (probing_state_ != kProbing) | 124 if (probing_state_ != kProbing) |
| 125 return; | 125 return; |
| 126 if (!probe_bitrates_.empty()) | 126 if (!probe_bitrates_.empty()) |
| 127 probe_bitrates_.pop_front(); | 127 probe_bitrates_.pop_front(); |
| 128 } | 128 } |
| 129 } // namespace webrtc | 129 } // namespace webrtc |
| OLD | NEW |