OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 next_input_time_ms = std::numeric_limits<int64_t>::max(); | 602 next_input_time_ms = std::numeric_limits<int64_t>::max(); |
603 packet_available = false; | 603 packet_available = false; |
604 } | 604 } |
605 } | 605 } |
606 | 606 |
607 // Check if it is time to get output audio. | 607 // Check if it is time to get output audio. |
608 while (time_now_ms >= next_output_time_ms && output_event_available) { | 608 while (time_now_ms >= next_output_time_ms && output_event_available) { |
609 static const size_t kOutDataLen = | 609 static const size_t kOutDataLen = |
610 kOutputBlockSizeMs * kMaxSamplesPerMs * kMaxChannels; | 610 kOutputBlockSizeMs * kMaxSamplesPerMs * kMaxChannels; |
611 int16_t out_data[kOutDataLen]; | 611 int16_t out_data[kOutDataLen]; |
612 int num_channels; | 612 size_t num_channels; |
613 size_t samples_per_channel; | 613 size_t samples_per_channel; |
614 int error = neteq->GetAudio(kOutDataLen, out_data, &samples_per_channel, | 614 int error = neteq->GetAudio(kOutDataLen, out_data, &samples_per_channel, |
615 &num_channels, NULL); | 615 &num_channels, NULL); |
616 if (error != NetEq::kOK) { | 616 if (error != NetEq::kOK) { |
617 std::cerr << "GetAudio returned error code " << | 617 std::cerr << "GetAudio returned error code " << |
618 neteq->LastError() << std::endl; | 618 neteq->LastError() << std::endl; |
619 } else { | 619 } else { |
620 // Calculate sample rate from output size. | 620 // Calculate sample rate from output size. |
621 sample_rate_hz = rtc::checked_cast<int>( | 621 sample_rate_hz = rtc::checked_cast<int>( |
622 1000 * samples_per_channel / kOutputBlockSizeMs); | 622 1000 * samples_per_channel / kOutputBlockSizeMs); |
(...skipping 19 matching lines...) Expand all Loading... |
642 } | 642 } |
643 } | 643 } |
644 printf("Simulation done\n"); | 644 printf("Simulation done\n"); |
645 printf("Produced %i ms of audio\n", | 645 printf("Produced %i ms of audio\n", |
646 static_cast<int>(time_now_ms - start_time_ms)); | 646 static_cast<int>(time_now_ms - start_time_ms)); |
647 | 647 |
648 delete neteq; | 648 delete neteq; |
649 webrtc::Trace::ReturnTrace(); | 649 webrtc::Trace::ReturnTrace(); |
650 return 0; | 650 return 0; |
651 } | 651 } |
OLD | NEW |