OLD | NEW |
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/payload_splitter.h" | 11 #include "webrtc/modules/audio_coding/neteq/payload_splitter.h" |
12 | 12 |
13 #include <assert.h> | 13 #include <assert.h> |
14 | 14 |
| 15 #include "webrtc/base/checks.h" |
15 #include "webrtc/base/logging.h" | 16 #include "webrtc/base/logging.h" |
16 #include "webrtc/modules/audio_coding/neteq/decoder_database.h" | 17 #include "webrtc/modules/audio_coding/neteq/decoder_database.h" |
17 | 18 |
18 namespace webrtc { | 19 namespace webrtc { |
19 | 20 |
20 // The method loops through a list of packets {A, B, C, ...}. Each packet is | 21 // The method loops through a list of packets {A, B, C, ...}. Each packet is |
21 // split into its corresponding RED payloads, {A1, A2, ...}, which is | 22 // split into its corresponding RED payloads, {A1, A2, ...}, which is |
22 // temporarily held in the list |new_packets|. | 23 // temporarily held in the list |new_packets|. |
23 // When the first packet in |packet_list| has been processed, the orignal packet | 24 // When the first packet in |packet_list| has been processed, the orignal packet |
24 // is replaced by the new ones in |new_packets|, so that |packet_list| becomes: | 25 // is replaced by the new ones in |new_packets|, so that |packet_list| becomes: |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 162 |
162 Packet* new_packet = new Packet; | 163 Packet* new_packet = new Packet; |
163 new_packet->header = packet->header; | 164 new_packet->header = packet->header; |
164 int duration = decoder-> | 165 int duration = decoder-> |
165 PacketDurationRedundant(packet->payload, packet->payload_length); | 166 PacketDurationRedundant(packet->payload, packet->payload_length); |
166 new_packet->header.timestamp -= duration; | 167 new_packet->header.timestamp -= duration; |
167 new_packet->payload = new uint8_t[packet->payload_length]; | 168 new_packet->payload = new uint8_t[packet->payload_length]; |
168 memcpy(new_packet->payload, packet->payload, packet->payload_length); | 169 memcpy(new_packet->payload, packet->payload, packet->payload_length); |
169 new_packet->payload_length = packet->payload_length; | 170 new_packet->payload_length = packet->payload_length; |
170 new_packet->primary = false; | 171 new_packet->primary = false; |
171 new_packet->waiting_time = packet->waiting_time; | |
172 new_packet->sync_packet = packet->sync_packet; | 172 new_packet->sync_packet = packet->sync_packet; |
| 173 // Waiting time should not be set here. |
| 174 RTC_DCHECK(!packet->waiting_time); |
173 | 175 |
174 packet_list->insert(it, new_packet); | 176 packet_list->insert(it, new_packet); |
175 break; | 177 break; |
176 } | 178 } |
177 default: { | 179 default: { |
178 LOG(LS_WARNING) << "SplitFec wrong payload type"; | 180 LOG(LS_WARNING) << "SplitFec wrong payload type"; |
179 return kFecSplitError; | 181 return kFecSplitError; |
180 } | 182 } |
181 } | 183 } |
182 | 184 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 new_packet->payload = new uint8_t[bytes_per_frame]; | 435 new_packet->payload = new uint8_t[bytes_per_frame]; |
434 memcpy(new_packet->payload, payload_ptr, bytes_per_frame); | 436 memcpy(new_packet->payload, payload_ptr, bytes_per_frame); |
435 payload_ptr += bytes_per_frame; | 437 payload_ptr += bytes_per_frame; |
436 new_packets->push_back(new_packet); | 438 new_packets->push_back(new_packet); |
437 len -= bytes_per_frame; | 439 len -= bytes_per_frame; |
438 } | 440 } |
439 return kOK; | 441 return kOK; |
440 } | 442 } |
441 | 443 |
442 } // namespace webrtc | 444 } // namespace webrtc |
OLD | NEW |