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

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

Issue 2309303002: Removed sync packet support from NetEq. (Closed)
Patch Set: 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/packet_buffer.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) 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
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 while (it != packet_list->end()) { 130 while (it != packet_list->end()) {
131 Packet* packet = (*it); // Just to make the notation more intuitive. 131 Packet* packet = (*it); // Just to make the notation more intuitive.
132 // Get codec type for this payload. 132 // Get codec type for this payload.
133 uint8_t payload_type = packet->header.payloadType; 133 uint8_t payload_type = packet->header.payloadType;
134 const DecoderDatabase::DecoderInfo* info = 134 const DecoderDatabase::DecoderInfo* info =
135 decoder_database->GetDecoderInfo(payload_type); 135 decoder_database->GetDecoderInfo(payload_type);
136 if (!info) { 136 if (!info) {
137 LOG(LS_WARNING) << "SplitFec unknown payload type"; 137 LOG(LS_WARNING) << "SplitFec unknown payload type";
138 return kUnknownPayloadType; 138 return kUnknownPayloadType;
139 } 139 }
140 // No splitting for a sync-packet.
141 if (packet->sync_packet) {
142 ++it;
143 continue;
144 }
145 140
146 // Not an FEC packet. 141 // Not an FEC packet.
147 AudioDecoder* decoder = decoder_database->GetDecoder(payload_type); 142 AudioDecoder* decoder = decoder_database->GetDecoder(payload_type);
148 // decoder should not return NULL, except for comfort noise payloads which 143 // decoder should not return NULL, except for comfort noise payloads which
149 // are handled separately. 144 // are handled separately.
150 assert(decoder != NULL || decoder_database->IsComfortNoise(payload_type)); 145 assert(decoder != NULL || decoder_database->IsComfortNoise(payload_type));
151 if (!decoder || 146 if (!decoder ||
152 !decoder->PacketHasFec(packet->payload.data(), 147 !decoder->PacketHasFec(packet->payload.data(),
153 packet->payload.size())) { 148 packet->payload.size())) {
154 ++it; 149 ++it;
155 continue; 150 continue;
156 } 151 }
157 152
158 switch (info->codec_type) { 153 switch (info->codec_type) {
159 case NetEqDecoder::kDecoderOpus: 154 case NetEqDecoder::kDecoderOpus:
160 case NetEqDecoder::kDecoderOpus_2ch: { 155 case NetEqDecoder::kDecoderOpus_2ch: {
161 // The main payload of this packet should be decoded as a primary 156 // The main payload of this packet should be decoded as a primary
162 // payload, even if it comes as a secondary payload in a RED packet. 157 // payload, even if it comes as a secondary payload in a RED packet.
163 packet->primary = true; 158 packet->primary = true;
164 159
165 Packet* new_packet = new Packet; 160 Packet* new_packet = new Packet;
166 new_packet->header = packet->header; 161 new_packet->header = packet->header;
167 int duration = decoder->PacketDurationRedundant(packet->payload.data(), 162 int duration = decoder->PacketDurationRedundant(packet->payload.data(),
168 packet->payload.size()); 163 packet->payload.size());
169 new_packet->header.timestamp -= duration; 164 new_packet->header.timestamp -= duration;
170 new_packet->payload.SetData(packet->payload); 165 new_packet->payload.SetData(packet->payload);
171 new_packet->primary = false; 166 new_packet->primary = false;
172 new_packet->sync_packet = packet->sync_packet;
173 // Waiting time should not be set here. 167 // Waiting time should not be set here.
174 RTC_DCHECK(!packet->waiting_time); 168 RTC_DCHECK(!packet->waiting_time);
175 169
176 packet_list->insert(it, new_packet); 170 packet_list->insert(it, new_packet);
177 break; 171 break;
178 } 172 }
179 default: { 173 default: {
180 LOG(LS_WARNING) << "SplitFec wrong payload type"; 174 LOG(LS_WARNING) << "SplitFec wrong payload type";
181 return kFecSplitError; 175 return kFecSplitError;
182 } 176 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // Iterate through all packets in |packet_list|. 218 // Iterate through all packets in |packet_list|.
225 while (it != packet_list->end()) { 219 while (it != packet_list->end()) {
226 Packet* packet = (*it); // Just to make the notation more intuitive. 220 Packet* packet = (*it); // Just to make the notation more intuitive.
227 // Get codec type for this payload. 221 // Get codec type for this payload.
228 const DecoderDatabase::DecoderInfo* info = 222 const DecoderDatabase::DecoderInfo* info =
229 decoder_database.GetDecoderInfo(packet->header.payloadType); 223 decoder_database.GetDecoderInfo(packet->header.payloadType);
230 if (!info) { 224 if (!info) {
231 LOG(LS_WARNING) << "SplitAudio unknown payload type"; 225 LOG(LS_WARNING) << "SplitAudio unknown payload type";
232 return kUnknownPayloadType; 226 return kUnknownPayloadType;
233 } 227 }
234 // No splitting for a sync-packet.
235 if (packet->sync_packet) {
236 ++it;
237 continue;
238 }
239 PacketList new_packets; 228 PacketList new_packets;
240 switch (info->codec_type) { 229 switch (info->codec_type) {
241 case NetEqDecoder::kDecoderPCMu: 230 case NetEqDecoder::kDecoderPCMu:
242 case NetEqDecoder::kDecoderPCMa: { 231 case NetEqDecoder::kDecoderPCMa: {
243 // 8 bytes per ms; 8 timestamps per ms. 232 // 8 bytes per ms; 8 timestamps per ms.
244 SplitBySamples(packet, 8, 8, &new_packets); 233 SplitBySamples(packet, 8, 8, &new_packets);
245 break; 234 break;
246 } 235 }
247 case NetEqDecoder::kDecoderPCMu_2ch: 236 case NetEqDecoder::kDecoderPCMu_2ch:
248 case NetEqDecoder::kDecoderPCMa_2ch: { 237 case NetEqDecoder::kDecoderPCMa_2ch: {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 new_packet->primary = packet->primary; 416 new_packet->primary = packet->primary;
428 new_packet->payload.SetData(payload_ptr, bytes_per_frame); 417 new_packet->payload.SetData(payload_ptr, bytes_per_frame);
429 payload_ptr += bytes_per_frame; 418 payload_ptr += bytes_per_frame;
430 new_packets->push_back(new_packet); 419 new_packets->push_back(new_packet);
431 len -= bytes_per_frame; 420 len -= bytes_per_frame;
432 } 421 }
433 return kOK; 422 return kOK;
434 } 423 }
435 424
436 } // namespace webrtc 425 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/packet_buffer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698