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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 if (packet_available != next_packet_available) { | 545 if (packet_available != next_packet_available) { |
546 packet_available = !packet_available; | 546 packet_available = !packet_available; |
547 next_packet_available = !next_packet_available; | 547 next_packet_available = !next_packet_available; |
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 int kOutDataLen = kOutputBlockSizeMs * kMaxSamplesPerMs * | 555 static const int kOutDataLen = |
556 kMaxChannels; | 556 kOutputBlockSizeMs * kMaxSamplesPerMs * kMaxChannels; |
557 int16_t out_data[kOutDataLen]; | 557 int16_t out_data[kOutDataLen]; |
558 int num_channels; | 558 int num_channels; |
559 int samples_per_channel; | 559 int 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. |
(...skipping 14 matching lines...) Expand all Loading... |
581 time_now_ms = std::min(next_input_time_ms, next_output_time_ms); | 581 time_now_ms = std::min(next_input_time_ms, next_output_time_ms); |
582 } | 582 } |
583 | 583 |
584 printf("Simulation done\n"); | 584 printf("Simulation done\n"); |
585 printf("Produced %i ms of audio\n", time_now_ms - start_time_ms); | 585 printf("Produced %i ms of audio\n", time_now_ms - start_time_ms); |
586 | 586 |
587 delete neteq; | 587 delete neteq; |
588 webrtc::Trace::ReturnTrace(); | 588 webrtc::Trace::ReturnTrace(); |
589 return 0; | 589 return 0; |
590 } | 590 } |
OLD | NEW |