| 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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 } | 548 } |
| 549 } | 549 } |
| 550 next_input_time_ms = packet->time_ms(); | 550 next_input_time_ms = packet->time_ms(); |
| 551 } | 551 } |
| 552 | 552 |
| 553 // Check if it is time to get output audio. | 553 // Check if it is time to get output audio. |
| 554 if (time_now_ms >= next_output_time_ms) { | 554 if (time_now_ms >= next_output_time_ms) { |
| 555 static const size_t kOutDataLen = | 555 static const size_t kOutDataLen = |
| 556 kOutputBlockSizeMs * kMaxSamplesPerMs * kMaxChannels; | 556 kOutputBlockSizeMs * kMaxSamplesPerMs * kMaxChannels; |
| 557 int16_t out_data[kOutDataLen]; | 557 int16_t out_data[kOutDataLen]; |
| 558 int num_channels; | 558 size_t num_channels; |
| 559 size_t samples_per_channel; | 559 size_t samples_per_channel; |
| 560 int error = neteq->GetAudio(kOutDataLen, out_data, &samples_per_channel, | 560 int error = neteq->GetAudio(kOutDataLen, out_data, &samples_per_channel, |
| 561 &num_channels, NULL); | 561 &num_channels, NULL); |
| 562 if (error != NetEq::kOK) { | 562 if (error != NetEq::kOK) { |
| 563 std::cerr << "GetAudio returned error code " << | 563 std::cerr << "GetAudio returned error code " << |
| 564 neteq->LastError() << std::endl; | 564 neteq->LastError() << std::endl; |
| 565 } else { | 565 } else { |
| 566 // Calculate sample rate from output size. | 566 // Calculate sample rate from output size. |
| 567 sample_rate_hz = | 567 sample_rate_hz = |
| 568 static_cast<int>(1000 * samples_per_channel / kOutputBlockSizeMs); | 568 static_cast<int>(1000 * samples_per_channel / kOutputBlockSizeMs); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 582 time_now_ms = std::min(next_input_time_ms, next_output_time_ms); | 582 time_now_ms = std::min(next_input_time_ms, next_output_time_ms); |
| 583 } | 583 } |
| 584 | 584 |
| 585 printf("Simulation done\n"); | 585 printf("Simulation done\n"); |
| 586 printf("Produced %i ms of audio\n", time_now_ms - start_time_ms); | 586 printf("Produced %i ms of audio\n", time_now_ms - start_time_ms); |
| 587 | 587 |
| 588 delete neteq; | 588 delete neteq; |
| 589 webrtc::Trace::ReturnTrace(); | 589 webrtc::Trace::ReturnTrace(); |
| 590 return 0; | 590 return 0; |
| 591 } | 591 } |
| OLD | NEW |