| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 AudioEncoder::EncodedInfo info; | 65 AudioEncoder::EncodedInfo info; |
| 66 RTC_DCHECK(!info.send_even_if_empty); | 66 RTC_DCHECK(!info.send_even_if_empty); |
| 67 int num_blocks = 0; | 67 int num_blocks = 0; |
| 68 while (packet_data_->payload.size() == 0 && !info.send_even_if_empty) { | 68 while (packet_data_->payload.size() == 0 && !info.send_even_if_empty) { |
| 69 const size_t num_samples = rtc::CheckedDivExact( | 69 const size_t num_samples = rtc::CheckedDivExact( |
| 70 static_cast<int>(encoder_->SampleRateHz() * kOutputPeriodMs), 1000); | 70 static_cast<int>(encoder_->SampleRateHz() * kOutputPeriodMs), 1000); |
| 71 | 71 |
| 72 info = encoder_->Encode(rtp_timestamp_, generator_->Generate(num_samples), | 72 info = encoder_->Encode(rtp_timestamp_, generator_->Generate(num_samples), |
| 73 &packet_data_->payload); | 73 &packet_data_->payload); |
| 74 | 74 |
| 75 rtp_timestamp_ += rtc::checked_cast<uint32_t>( | 75 rtp_timestamp_ += rtc::dchecked_cast<uint32_t>( |
| 76 num_samples * encoder_->RtpTimestampRateHz() / | 76 num_samples * encoder_->RtpTimestampRateHz() / |
| 77 encoder_->SampleRateHz()); | 77 encoder_->SampleRateHz()); |
| 78 ++num_blocks; | 78 ++num_blocks; |
| 79 } | 79 } |
| 80 packet_data_->header.header.timestamp = info.encoded_timestamp; | 80 packet_data_->header.header.timestamp = info.encoded_timestamp; |
| 81 packet_data_->header.header.payloadType = info.payload_type; | 81 packet_data_->header.header.payloadType = info.payload_type; |
| 82 packet_data_->header.header.sequenceNumber = sequence_number_++; | 82 packet_data_->header.header.sequenceNumber = sequence_number_++; |
| 83 packet_data_->time_ms = next_packet_time_ms_; | 83 packet_data_->time_ms = next_packet_time_ms_; |
| 84 next_packet_time_ms_ += num_blocks * kOutputPeriodMs; | 84 next_packet_time_ms_ += num_blocks * kOutputPeriodMs; |
| 85 } | 85 } |
| 86 | 86 |
| 87 } // namespace test | 87 } // namespace test |
| 88 } // namespace webrtc | 88 } // namespace webrtc |
| OLD | NEW |