| 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 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 // Timing files | 36 // Timing files |
| 37 DEFINE_string(seq_num, "seq_num", "Sequence number file."); | 37 DEFINE_string(seq_num, "seq_num", "Sequence number file."); |
| 38 DEFINE_string(send_ts, "send_timestamp", "Send timestamp file."); | 38 DEFINE_string(send_ts, "send_timestamp", "Send timestamp file."); |
| 39 DEFINE_string(receive_ts, "last_rec_timestamp", "Receive timestamp file"); | 39 DEFINE_string(receive_ts, "last_rec_timestamp", "Receive timestamp file"); |
| 40 | 40 |
| 41 // Delay logging | 41 // Delay logging |
| 42 DEFINE_string(delay, "", "Log for delay."); | 42 DEFINE_string(delay, "", "Log for delay."); |
| 43 | 43 |
| 44 // Other setups | 44 // Other setups |
| 45 DEFINE_int32(init_delay, 0, "Initial delay."); | |
| 46 DEFINE_bool(verbose, false, "Verbosity."); | 45 DEFINE_bool(verbose, false, "Verbosity."); |
| 47 DEFINE_double(loss_rate, 0, "Rate of packet loss < 1"); | 46 DEFINE_double(loss_rate, 0, "Rate of packet loss < 1"); |
| 48 | 47 |
| 49 const int32_t kAudioPlayedOut = 0x00000001; | 48 const int32_t kAudioPlayedOut = 0x00000001; |
| 50 const int32_t kPacketPushedIn = 0x00000001 << 1; | 49 const int32_t kPacketPushedIn = 0x00000001 << 1; |
| 51 const int kPlayoutPeriodMs = 10; | 50 const int kPlayoutPeriodMs = 10; |
| 52 | 51 |
| 53 namespace webrtc { | 52 namespace webrtc { |
| 54 | 53 |
| 55 class InsertPacketWithTiming { | 54 class InsertPacketWithTiming { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 << " Hz in " << ((FLAGS_input_stereo) ? "stereo." : "mono.") | 114 << " Hz in " << ((FLAGS_input_stereo) ? "stereo." : "mono.") |
| 116 << std::endl; | 115 << std::endl; |
| 117 pcm_in_fid_.ReadStereo(FLAGS_input_stereo); | 116 pcm_in_fid_.ReadStereo(FLAGS_input_stereo); |
| 118 } | 117 } |
| 119 | 118 |
| 120 ASSERT_TRUE(pcm_out_fid_ != NULL); | 119 ASSERT_TRUE(pcm_out_fid_ != NULL); |
| 121 std::cout << "Output file " << FLAGS_output << " at " << FLAGS_output_fs_hz | 120 std::cout << "Output file " << FLAGS_output << " at " << FLAGS_output_fs_hz |
| 122 << " Hz." << std::endl; | 121 << " Hz." << std::endl; |
| 123 | 122 |
| 124 // Other setups | 123 // Other setups |
| 125 if (FLAGS_init_delay > 0) | |
| 126 EXPECT_EQ(0, receive_acm_->SetInitialPlayoutDelay(FLAGS_init_delay)); | |
| 127 | |
| 128 if (FLAGS_loss_rate > 0) | 124 if (FLAGS_loss_rate > 0) |
| 129 loss_threshold_ = RAND_MAX * FLAGS_loss_rate; | 125 loss_threshold_ = RAND_MAX * FLAGS_loss_rate; |
| 130 else | 126 else |
| 131 loss_threshold_ = 0; | 127 loss_threshold_ = 0; |
| 132 } | 128 } |
| 133 | 129 |
| 134 void TickOneMillisecond(uint32_t* action) { | 130 void TickOneMillisecond(uint32_t* action) { |
| 135 // One millisecond passed. | 131 // One millisecond passed. |
| 136 time_to_insert_packet_ms_--; | 132 time_to_insert_packet_ms_--; |
| 137 time_to_playout_audio_ms_--; | 133 time_to_playout_audio_ms_--; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 if (delay_log != NULL) { | 298 if (delay_log != NULL) { |
| 303 fprintf(delay_log, "%3d %3d\n", optimal_delay_ms, current_delay_ms); | 299 fprintf(delay_log, "%3d %3d\n", optimal_delay_ms, current_delay_ms); |
| 304 } | 300 } |
| 305 } | 301 } |
| 306 } | 302 } |
| 307 std::cout << std::endl; | 303 std::cout << std::endl; |
| 308 test.TearDown(); | 304 test.TearDown(); |
| 309 if (delay_log != NULL) | 305 if (delay_log != NULL) |
| 310 fclose(delay_log); | 306 fclose(delay_log); |
| 311 } | 307 } |
| OLD | NEW |