OLD | NEW |
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // Check if this packet is comfort noise. | 77 // Check if this packet is comfort noise. |
78 if (comfort_noise_types_.count(packet_->header.header.payloadType) != 0) { | 78 if (comfort_noise_types_.count(packet_->header.header.payloadType) != 0) { |
79 // If CNG, simply insert a zero-energy one-byte payload. | 79 // If CNG, simply insert a zero-energy one-byte payload. |
80 uint8_t cng_payload[1] = {127}; // Max attenuation of CNG. | 80 uint8_t cng_payload[1] = {127}; // Max attenuation of CNG. |
81 packet_->payload.SetData(cng_payload); | 81 packet_->payload.SetData(cng_payload); |
82 return; | 82 return; |
83 } | 83 } |
84 | 84 |
85 rtc::Optional<RTPHeader> next_hdr = source_->NextHeader(); | 85 rtc::Optional<RTPHeader> next_hdr = source_->NextHeader(); |
86 RTC_DCHECK(next_hdr); | 86 RTC_DCHECK(next_hdr); |
87 uint8_t payload[8]; | 87 uint8_t payload[12]; |
88 uint32_t input_frame_size_timestamps = | 88 uint32_t input_frame_size_timestamps = |
89 next_hdr->timestamp - packet_->header.header.timestamp; | 89 next_hdr->timestamp - packet_->header.header.timestamp; |
| 90 if (next_hdr->sequenceNumber != packet_->header.header.sequenceNumber + 1) { |
| 91 // Gap in packet sequence. Cannot estimate payload length based on timestamp |
| 92 // difference. |
| 93 input_frame_size_timestamps = 0; |
| 94 } |
90 FakeDecodeFromFile::PrepareEncoded(packet_->header.header.timestamp, | 95 FakeDecodeFromFile::PrepareEncoded(packet_->header.header.timestamp, |
91 input_frame_size_timestamps, payload); | 96 input_frame_size_timestamps, |
| 97 packet_->payload.size(), payload); |
92 packet_->payload.SetData(payload); | 98 packet_->payload.SetData(payload); |
93 packet_->header.header.payloadType = replacement_payload_type_; | 99 packet_->header.header.payloadType = replacement_payload_type_; |
94 return; | 100 return; |
95 } | 101 } |
96 | 102 |
97 } // namespace test | 103 } // namespace test |
98 } // namespace webrtc | 104 } // namespace webrtc |
OLD | NEW |