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

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

Issue 2275903002: Make FakeDecodeFromFile handle codec-internal CNG (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing compile errors Created 4 years, 3 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 25 matching lines...) Expand all
36 void NetEqPacketSourceInput::LoadNextPacket() { 36 void NetEqPacketSourceInput::LoadNextPacket() {
37 packet_ = source()->NextPacket(); 37 packet_ = source()->NextPacket();
38 } 38 }
39 39
40 std::unique_ptr<NetEqInput::PacketData> NetEqPacketSourceInput::PopPacket() { 40 std::unique_ptr<NetEqInput::PacketData> NetEqPacketSourceInput::PopPacket() {
41 if (!packet_) { 41 if (!packet_) {
42 return std::unique_ptr<PacketData>(); 42 return std::unique_ptr<PacketData>();
43 } 43 }
44 std::unique_ptr<PacketData> packet_data(new PacketData); 44 std::unique_ptr<PacketData> packet_data(new PacketData);
45 packet_->ConvertHeader(&packet_data->header); 45 packet_->ConvertHeader(&packet_data->header);
46 packet_data->payload.SetData(packet_->payload(), 46 if (packet_->payload_length_bytes() == 0 &&
47 packet_->payload_length_bytes()); 47 packet_->virtual_payload_length_bytes() > 0) {
48 // This is a header-only "dummy" packet. Set the payload to all zeros, with
49 // length according to the virtual length.
50 packet_data->payload.SetSize(packet_->virtual_payload_length_bytes());
51 std::fill_n(packet_data->payload.data(), packet_data->payload.size(), 0);
52 } else {
53 packet_data->payload.SetData(packet_->payload(),
54 packet_->payload_length_bytes());
55 }
48 packet_data->time_ms = packet_->time_ms(); 56 packet_data->time_ms = packet_->time_ms();
49 57
50 LoadNextPacket(); 58 LoadNextPacket();
51 59
52 return packet_data; 60 return packet_data;
53 } 61 }
54 62
55 NetEqRtpDumpInput::NetEqRtpDumpInput(const std::string& file_name) 63 NetEqRtpDumpInput::NetEqRtpDumpInput(const std::string& file_name)
56 : source_(RtpFileSource::Create(file_name)) { 64 : source_(RtpFileSource::Create(file_name)) {
57 LoadNextPacket(); 65 LoadNextPacket();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 next_output_event_ms_ = rtc::Optional<int64_t>(); 99 next_output_event_ms_ = rtc::Optional<int64_t>();
92 } 100 }
93 } 101 }
94 102
95 PacketSource* NetEqEventLogInput::source() { 103 PacketSource* NetEqEventLogInput::source() {
96 return source_.get(); 104 return source_.get();
97 } 105 }
98 106
99 } // namespace test 107 } // namespace test
100 } // namespace webrtc 108 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698