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

Side by Side Diff: webrtc/modules/audio_coding/neteq/tools/packet.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
« no previous file with comments | « webrtc/modules/audio_coding/neteq/tools/neteq_replacement_input.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/audio_coding/neteq/tools/packet.h" 11 #include "webrtc/modules/audio_coding/neteq/tools/packet.h"
12 12
13 #include <string.h> 13 #include <string.h>
14 14
15 #include <memory> 15 #include <memory>
16 16
17 #include "webrtc/base/checks.h"
17 #include "webrtc/modules/include/module_common_types.h" 18 #include "webrtc/modules/include/module_common_types.h"
18 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" 19 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
19 20
20 namespace webrtc { 21 namespace webrtc {
21 namespace test { 22 namespace test {
22 23
23 Packet::Packet(uint8_t* packet_memory, 24 Packet::Packet(uint8_t* packet_memory,
24 size_t allocated_bytes, 25 size_t allocated_bytes,
25 double time_ms, 26 double time_ms,
26 const RtpHeaderParser& parser) 27 const RtpHeaderParser& parser)
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 bool valid_header = parser.Parse( 136 bool valid_header = parser.Parse(
136 payload_memory_.get(), static_cast<int>(packet_length_bytes_), &header_); 137 payload_memory_.get(), static_cast<int>(packet_length_bytes_), &header_);
137 assert(valid_header); 138 assert(valid_header);
138 if (!valid_header) { 139 if (!valid_header) {
139 return false; 140 return false;
140 } 141 }
141 assert(header_.headerLength <= packet_length_bytes_); 142 assert(header_.headerLength <= packet_length_bytes_);
142 payload_ = &payload_memory_[header_.headerLength]; 143 payload_ = &payload_memory_[header_.headerLength];
143 assert(packet_length_bytes_ >= header_.headerLength); 144 assert(packet_length_bytes_ >= header_.headerLength);
144 payload_length_bytes_ = packet_length_bytes_ - header_.headerLength; 145 payload_length_bytes_ = packet_length_bytes_ - header_.headerLength;
146 RTC_CHECK_GE(virtual_packet_length_bytes_, packet_length_bytes_);
145 assert(virtual_packet_length_bytes_ >= header_.headerLength); 147 assert(virtual_packet_length_bytes_ >= header_.headerLength);
146 virtual_payload_length_bytes_ = 148 virtual_payload_length_bytes_ =
147 virtual_packet_length_bytes_ - header_.headerLength; 149 virtual_packet_length_bytes_ - header_.headerLength;
148 return true; 150 return true;
149 } 151 }
150 152
151 void Packet::CopyToHeader(RTPHeader* destination) const { 153 void Packet::CopyToHeader(RTPHeader* destination) const {
152 destination->markerBit = header_.markerBit; 154 destination->markerBit = header_.markerBit;
153 destination->payloadType = header_.payloadType; 155 destination->payloadType = header_.payloadType;
154 destination->sequenceNumber = header_.sequenceNumber; 156 destination->sequenceNumber = header_.sequenceNumber;
155 destination->timestamp = header_.timestamp; 157 destination->timestamp = header_.timestamp;
156 destination->ssrc = header_.ssrc; 158 destination->ssrc = header_.ssrc;
157 destination->numCSRCs = header_.numCSRCs; 159 destination->numCSRCs = header_.numCSRCs;
158 destination->paddingLength = header_.paddingLength; 160 destination->paddingLength = header_.paddingLength;
159 destination->headerLength = header_.headerLength; 161 destination->headerLength = header_.headerLength;
160 destination->payload_type_frequency = header_.payload_type_frequency; 162 destination->payload_type_frequency = header_.payload_type_frequency;
161 memcpy(&destination->arrOfCSRCs, 163 memcpy(&destination->arrOfCSRCs,
162 &header_.arrOfCSRCs, 164 &header_.arrOfCSRCs,
163 sizeof(header_.arrOfCSRCs)); 165 sizeof(header_.arrOfCSRCs));
164 memcpy( 166 memcpy(
165 &destination->extension, &header_.extension, sizeof(header_.extension)); 167 &destination->extension, &header_.extension, sizeof(header_.extension));
166 } 168 }
167 169
168 } // namespace test 170 } // namespace test
169 } // namespace webrtc 171 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/tools/neteq_replacement_input.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698