Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: webrtc/modules/audio_coding/neteq/timestamp_scaler.cc

Issue 2411183003: Removed RTPHeader from NetEq's Packet struct. (Closed)
Patch Set: Fixed naming of payloadType and sequenceNumber. Updated comments. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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" 14 #include "webrtc/system_wrappers/include/logging.h"
15 15
16 namespace webrtc { 16 namespace webrtc {
17 17
18 void TimestampScaler::Reset() { 18 void TimestampScaler::Reset() {
19 first_packet_received_ = false; 19 first_packet_received_ = false;
20 } 20 }
21 21
22 void TimestampScaler::ToInternal(Packet* packet) { 22 void TimestampScaler::ToInternal(Packet* packet) {
23 if (!packet) { 23 if (!packet) {
24 return; 24 return;
25 } 25 }
26 packet->header.timestamp = ToInternal(packet->header.timestamp, 26 packet->timestamp = ToInternal(packet->timestamp, packet->payload_type);
27 packet->header.payloadType);
28 } 27 }
29 28
30 void TimestampScaler::ToInternal(PacketList* packet_list) { 29 void TimestampScaler::ToInternal(PacketList* packet_list) {
31 PacketList::iterator it; 30 PacketList::iterator it;
32 for (it = packet_list->begin(); it != packet_list->end(); ++it) { 31 for (it = packet_list->begin(); it != packet_list->end(); ++it) {
33 ToInternal(*it); 32 ToInternal(*it);
34 } 33 }
35 } 34 }
36 35
37 uint32_t TimestampScaler::ToInternal(uint32_t external_timestamp, 36 uint32_t TimestampScaler::ToInternal(uint32_t external_timestamp,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } else { 78 } else {
80 const int64_t internal_diff = int64_t{internal_timestamp} - internal_ref_; 79 const int64_t internal_diff = int64_t{internal_timestamp} - internal_ref_;
81 assert(numerator_ > 0); // Should not be possible. 80 assert(numerator_ > 0); // Should not be possible.
82 // Do not update references in this method. 81 // Do not update references in this method.
83 // Switch |denominator_| and |numerator_| to convert the other way. 82 // Switch |denominator_| and |numerator_| to convert the other way.
84 return external_ref_ + (internal_diff * denominator_) / numerator_; 83 return external_ref_ + (internal_diff * denominator_) / numerator_;
85 } 84 }
86 } 85 }
87 86
88 } // namespace webrtc 87 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698