OLD | NEW |
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 |
11 #include "webrtc/modules/audio_coding/neteq/timestamp_scaler.h" | 11 #include "webrtc/modules/audio_coding/neteq/timestamp_scaler.h" |
12 | 12 |
13 #include "webrtc/modules/audio_coding/neteq/decoder_database.h" | 13 #include "webrtc/modules/audio_coding/neteq/decoder_database.h" |
14 #include "webrtc/system_wrappers/include/logging.h" | |
15 | 14 |
16 namespace webrtc { | 15 namespace webrtc { |
17 | 16 |
18 void TimestampScaler::Reset() { | 17 void TimestampScaler::Reset() { |
19 first_packet_received_ = false; | 18 first_packet_received_ = false; |
20 } | 19 } |
21 | 20 |
22 void TimestampScaler::ToInternal(Packet* packet) { | 21 void TimestampScaler::ToInternal(Packet* packet) { |
23 if (!packet) { | 22 if (!packet) { |
24 return; | 23 return; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 } else { | 77 } else { |
79 const int64_t internal_diff = int64_t{internal_timestamp} - internal_ref_; | 78 const int64_t internal_diff = int64_t{internal_timestamp} - internal_ref_; |
80 assert(numerator_ > 0); // Should not be possible. | 79 assert(numerator_ > 0); // Should not be possible. |
81 // Do not update references in this method. | 80 // Do not update references in this method. |
82 // Switch |denominator_| and |numerator_| to convert the other way. | 81 // Switch |denominator_| and |numerator_| to convert the other way. |
83 return external_ref_ + (internal_diff * denominator_) / numerator_; | 82 return external_ref_ + (internal_diff * denominator_) / numerator_; |
84 } | 83 } |
85 } | 84 } |
86 | 85 |
87 } // namespace webrtc | 86 } // namespace webrtc |
OLD | NEW |