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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 // Set next input time to the maximum value of int64_t to prevent the | 598 // Set next input time to the maximum value of int64_t to prevent the |
599 // time_now_ms from becoming stuck at the final value. | 599 // time_now_ms from becoming stuck at the final value. |
600 next_input_time_ms = std::numeric_limits<int64_t>::max(); | 600 next_input_time_ms = std::numeric_limits<int64_t>::max(); |
601 packet_available = false; | 601 packet_available = false; |
602 } | 602 } |
603 } | 603 } |
604 | 604 |
605 // Check if it is time to get output audio. | 605 // Check if it is time to get output audio. |
606 while (time_now_ms >= next_output_time_ms && output_event_available) { | 606 while (time_now_ms >= next_output_time_ms && output_event_available) { |
607 webrtc::AudioFrame out_frame; | 607 webrtc::AudioFrame out_frame; |
608 int error = neteq->GetAudio(&out_frame, NULL); | 608 int error = neteq->GetAudio(&out_frame); |
609 if (error != NetEq::kOK) { | 609 if (error != NetEq::kOK) { |
610 std::cerr << "GetAudio returned error code " << | 610 std::cerr << "GetAudio returned error code " << |
611 neteq->LastError() << std::endl; | 611 neteq->LastError() << std::endl; |
612 } else { | 612 } else { |
613 sample_rate_hz = out_frame.sample_rate_hz_; | 613 sample_rate_hz = out_frame.sample_rate_hz_; |
614 } | 614 } |
615 | 615 |
616 // Write to file. | 616 // Write to file. |
617 // TODO(hlundin): Make writing to file optional. | 617 // TODO(hlundin): Make writing to file optional. |
618 if (!output->WriteArray(out_frame.data_, out_frame.samples_per_channel_ * | 618 if (!output->WriteArray(out_frame.data_, out_frame.samples_per_channel_ * |
(...skipping 14 matching lines...) Expand all Loading... |
633 } | 633 } |
634 } | 634 } |
635 printf("Simulation done\n"); | 635 printf("Simulation done\n"); |
636 printf("Produced %i ms of audio\n", | 636 printf("Produced %i ms of audio\n", |
637 static_cast<int>(time_now_ms - start_time_ms)); | 637 static_cast<int>(time_now_ms - start_time_ms)); |
638 | 638 |
639 delete neteq; | 639 delete neteq; |
640 webrtc::Trace::ReturnTrace(); | 640 webrtc::Trace::ReturnTrace(); |
641 return 0; | 641 return 0; |
642 } | 642 } |
OLD | NEW |