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

Side by Side Diff: webrtc/modules/audio_coding/neteq/tools/neteq_packet_source_input.cc

Issue 2266403005: Make neteq_rtpplay parse RTP header extensions (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@neteq-fake-decode-cng
Patch Set: Created 4 years, 4 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) 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
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 packet_data->payload.SetData(packet_->payload(), 53 packet_data->payload.SetData(packet_->payload(),
54 packet_->payload_length_bytes()); 54 packet_->payload_length_bytes());
55 } 55 }
56 packet_data->time_ms = packet_->time_ms(); 56 packet_data->time_ms = packet_->time_ms();
57 57
58 LoadNextPacket(); 58 LoadNextPacket();
59 59
60 return packet_data; 60 return packet_data;
61 } 61 }
62 62
63 NetEqRtpDumpInput::NetEqRtpDumpInput(const std::string& file_name) 63 NetEqRtpDumpInput::NetEqRtpDumpInput(const std::string& file_name,
64 const RtpHeaderExtensionMap& hdr_ext_map)
64 : source_(RtpFileSource::Create(file_name)) { 65 : source_(RtpFileSource::Create(file_name)) {
66 for (const auto& ext_pair : hdr_ext_map) {
67 source_->RegisterRtpHeaderExtension(ext_pair.second, ext_pair.first);
68 }
65 LoadNextPacket(); 69 LoadNextPacket();
66 } 70 }
67 71
68 rtc::Optional<int64_t> NetEqRtpDumpInput::NextOutputEventTime() const { 72 rtc::Optional<int64_t> NetEqRtpDumpInput::NextOutputEventTime() const {
69 return next_output_event_ms_; 73 return next_output_event_ms_;
70 } 74 }
71 75
72 void NetEqRtpDumpInput::AdvanceOutputEvent() { 76 void NetEqRtpDumpInput::AdvanceOutputEvent() {
73 if (next_output_event_ms_) { 77 if (next_output_event_ms_) {
74 *next_output_event_ms_ += kOutputPeriodMs; 78 *next_output_event_ms_ += kOutputPeriodMs;
75 } 79 }
76 if (!NextPacketTime()) { 80 if (!NextPacketTime()) {
77 next_output_event_ms_ = rtc::Optional<int64_t>(); 81 next_output_event_ms_ = rtc::Optional<int64_t>();
78 } 82 }
79 } 83 }
80 84
81 PacketSource* NetEqRtpDumpInput::source() { 85 PacketSource* NetEqRtpDumpInput::source() {
82 return source_.get(); 86 return source_.get();
83 } 87 }
84 88
85 NetEqEventLogInput::NetEqEventLogInput(const std::string& file_name) 89 NetEqEventLogInput::NetEqEventLogInput(const std::string& file_name,
90 const RtpHeaderExtensionMap& hdr_ext_map)
86 : source_(RtcEventLogSource::Create(file_name)) { 91 : source_(RtcEventLogSource::Create(file_name)) {
92 for (const auto& ext_pair : hdr_ext_map) {
93 source_->RegisterRtpHeaderExtension(ext_pair.second, ext_pair.first);
94 }
87 LoadNextPacket(); 95 LoadNextPacket();
88 AdvanceOutputEvent(); 96 AdvanceOutputEvent();
89 } 97 }
90 98
91 rtc::Optional<int64_t> NetEqEventLogInput::NextOutputEventTime() const { 99 rtc::Optional<int64_t> NetEqEventLogInput::NextOutputEventTime() const {
92 return rtc::Optional<int64_t>(next_output_event_ms_); 100 return rtc::Optional<int64_t>(next_output_event_ms_);
93 } 101 }
94 102
95 void NetEqEventLogInput::AdvanceOutputEvent() { 103 void NetEqEventLogInput::AdvanceOutputEvent() {
96 next_output_event_ms_ = 104 next_output_event_ms_ =
97 rtc::Optional<int64_t>(source_->NextAudioOutputEventMs()); 105 rtc::Optional<int64_t>(source_->NextAudioOutputEventMs());
98 if (*next_output_event_ms_ == std::numeric_limits<int64_t>::max()) { 106 if (*next_output_event_ms_ == std::numeric_limits<int64_t>::max()) {
99 next_output_event_ms_ = rtc::Optional<int64_t>(); 107 next_output_event_ms_ = rtc::Optional<int64_t>();
100 } 108 }
101 } 109 }
102 110
103 PacketSource* NetEqEventLogInput::source() { 111 PacketSource* NetEqEventLogInput::source() {
104 return source_.get(); 112 return source_.get();
105 } 113 }
106 114
107 } // namespace test 115 } // namespace test
108 } // namespace webrtc 116 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698