| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 printf("\n1. Send, listen and playout \n"); | 371 printf("\n1. Send, listen and playout \n"); |
| 372 printf("2. Send only \n"); | 372 printf("2. Send only \n"); |
| 373 printf("3. Listen and playout only \n"); | 373 printf("3. Listen and playout only \n"); |
| 374 printf("Select transfer mode: "); | 374 printf("Select transfer mode: "); |
| 375 int call_selection; | 375 int call_selection; |
| 376 ASSERT_EQ(1, scanf("%i", &call_selection)); | 376 ASSERT_EQ(1, scanf("%i", &call_selection)); |
| 377 const bool send = !(call_selection == 3); | 377 const bool send = !(call_selection == 3); |
| 378 const bool receive = !(call_selection == 2); | 378 const bool receive = !(call_selection == 2); |
| 379 | 379 |
| 380 if (receive) { | 380 if (receive) { |
| 381 #ifndef EXTERNAL_TRANSPORT | |
| 382 printf("Start Listen \n"); | |
| 383 res = base1->StartReceive(chan); | |
| 384 VALIDATE; | |
| 385 #endif | |
| 386 | |
| 387 printf("Start Playout \n"); | 381 printf("Start Playout \n"); |
| 388 res = base1->StartPlayout(chan); | 382 res = base1->StartPlayout(chan); |
| 389 VALIDATE; | 383 VALIDATE; |
| 390 } | 384 } |
| 391 | 385 |
| 392 if (send) { | 386 if (send) { |
| 393 printf("Start Send \n"); | 387 printf("Start Send \n"); |
| 394 res = base1->StartSend(chan); | 388 res = base1->StartSend(chan); |
| 395 VALIDATE; | 389 VALIDATE; |
| 396 } | 390 } |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 VALIDATE; | 687 VALIDATE; |
| 694 } | 688 } |
| 695 while (stop_play != 0) { | 689 while (stop_play != 0) { |
| 696 printf("\n Type 0 to stop playing file\n"); | 690 printf("\n Type 0 to stop playing file\n"); |
| 697 ASSERT_EQ(1, scanf("%i", &stop_play)); | 691 ASSERT_EQ(1, scanf("%i", &stop_play)); |
| 698 } | 692 } |
| 699 res = file->StopPlayingFileAsMicrophone(chan); | 693 res = file->StopPlayingFileAsMicrophone(chan); |
| 700 VALIDATE; | 694 VALIDATE; |
| 701 } else if (option_selection == option_index++) { | 695 } else if (option_selection == option_index++) { |
| 702 if (channel_index < kMaxNumChannels) { | 696 if (channel_index < kMaxNumChannels) { |
| 703 res = base1->StartReceive(channels[channel_index]); | |
| 704 VALIDATE; | |
| 705 res = base1->StartPlayout(channels[channel_index]); | 697 res = base1->StartPlayout(channels[channel_index]); |
| 706 VALIDATE; | 698 VALIDATE; |
| 707 res = base1->StartSend(channels[channel_index]); | 699 res = base1->StartSend(channels[channel_index]); |
| 708 VALIDATE; | 700 VALIDATE; |
| 709 res = file->StartPlayingFileAsMicrophone(channels[channel_index], | 701 res = file->StartPlayingFileAsMicrophone(channels[channel_index], |
| 710 audio_filename.c_str(), | 702 audio_filename.c_str(), |
| 711 true, | 703 true, |
| 712 false); | 704 false); |
| 713 VALIDATE; | 705 VALIDATE; |
| 714 channel_index++; | 706 channel_index++; |
| 715 printf("Using %d additional channels\n", channel_index); | 707 printf("Using %d additional channels\n", channel_index); |
| 716 } else { | 708 } else { |
| 717 printf("Max number of channels reached\n"); | 709 printf("Max number of channels reached\n"); |
| 718 } | 710 } |
| 719 } else if (option_selection == option_index++) { | 711 } else if (option_selection == option_index++) { |
| 720 if (channel_index > 0) { | 712 if (channel_index > 0) { |
| 721 channel_index--; | 713 channel_index--; |
| 722 res = file->StopPlayingFileAsMicrophone(channels[channel_index]); | 714 res = file->StopPlayingFileAsMicrophone(channels[channel_index]); |
| 723 VALIDATE; | 715 VALIDATE; |
| 724 res = base1->StopSend(channels[channel_index]); | 716 res = base1->StopSend(channels[channel_index]); |
| 725 VALIDATE; | 717 VALIDATE; |
| 726 res = base1->StopPlayout(channels[channel_index]); | 718 res = base1->StopPlayout(channels[channel_index]); |
| 727 VALIDATE; | 719 VALIDATE; |
| 728 res = base1->StopReceive(channels[channel_index]); | |
| 729 VALIDATE; | |
| 730 printf("Using %d additional channels\n", channel_index); | 720 printf("Using %d additional channels\n", channel_index); |
| 731 } else { | 721 } else { |
| 732 printf("All additional channels stopped\n"); | 722 printf("All additional channels stopped\n"); |
| 733 } | 723 } |
| 734 } else if (option_selection == option_index++) { | 724 } else if (option_selection == option_index++) { |
| 735 opus_stereo = !opus_stereo; | 725 opus_stereo = !opus_stereo; |
| 736 if (opus_stereo) | 726 if (opus_stereo) |
| 737 printf("\n Opus stereo enabled (select Opus again to apply the " | 727 printf("\n Opus stereo enabled (select Opus again to apply the " |
| 738 "setting). \n"); | 728 "setting). \n"); |
| 739 else | 729 else |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 if (send) { | 770 if (send) { |
| 781 printf("Stop Send \n"); | 771 printf("Stop Send \n"); |
| 782 res = base1->StopSend(chan); | 772 res = base1->StopSend(chan); |
| 783 VALIDATE; | 773 VALIDATE; |
| 784 } | 774 } |
| 785 | 775 |
| 786 if (receive) { | 776 if (receive) { |
| 787 printf("Stop Playout \n"); | 777 printf("Stop Playout \n"); |
| 788 res = base1->StopPlayout(chan); | 778 res = base1->StopPlayout(chan); |
| 789 VALIDATE; | 779 VALIDATE; |
| 790 | |
| 791 #ifndef EXTERNAL_TRANSPORT | |
| 792 printf("Stop Listen \n"); | |
| 793 res = base1->StopReceive(chan); | |
| 794 VALIDATE; | |
| 795 #endif | |
| 796 } | 780 } |
| 797 | 781 |
| 798 while (channel_index > 0) { | 782 while (channel_index > 0) { |
| 799 --channel_index; | 783 --channel_index; |
| 800 res = file->StopPlayingFileAsMicrophone(channels[channel_index]); | 784 res = file->StopPlayingFileAsMicrophone(channels[channel_index]); |
| 801 VALIDATE; | 785 VALIDATE; |
| 802 res = base1->StopSend(channels[channel_index]); | 786 res = base1->StopSend(channels[channel_index]); |
| 803 VALIDATE; | 787 VALIDATE; |
| 804 res = base1->StopPlayout(channels[channel_index]); | 788 res = base1->StopPlayout(channels[channel_index]); |
| 805 VALIDATE; | 789 VALIDATE; |
| 806 res = base1->StopReceive(channels[channel_index]); | |
| 807 VALIDATE; | |
| 808 } | 790 } |
| 809 | 791 |
| 810 printf("\n1. New call \n"); | 792 printf("\n1. New call \n"); |
| 811 printf("2. Quit \n"); | 793 printf("2. Quit \n"); |
| 812 printf("Select action: "); | 794 printf("Select action: "); |
| 813 int end_option; | 795 int end_option; |
| 814 ASSERT_EQ(1, scanf("%i", &end_option)); | 796 ASSERT_EQ(1, scanf("%i", &end_option)); |
| 815 newcall = (end_option == 1); | 797 newcall = (end_option == 1); |
| 816 // Call loop | 798 // Call loop |
| 817 } | 799 } |
| 818 | 800 |
| 819 // Transports should be deleted before channel deletion. | 801 // Transports should be deleted before channel deletion. |
| 820 delete voice_channel_transport; | 802 delete voice_channel_transport; |
| 821 for (int i = 0; i < kMaxNumChannels; ++i) { | 803 for (int i = 0; i < kMaxNumChannels; ++i) { |
| 822 delete voice_channel_transports[i]; | 804 delete voice_channel_transports[i]; |
| 823 voice_channel_transports[i] = NULL; | 805 voice_channel_transports[i] = NULL; |
| 824 } | 806 } |
| 825 | 807 |
| 826 printf("Delete channels \n"); | 808 printf("Delete channels \n"); |
| 827 res = base1->DeleteChannel(chan); | 809 res = base1->DeleteChannel(chan); |
| 828 VALIDATE; | 810 VALIDATE; |
| 829 | 811 |
| 830 for (int i = 0; i < kMaxNumChannels; ++i) { | 812 for (int i = 0; i < kMaxNumChannels; ++i) { |
| 831 res = base1->DeleteChannel(channels[i]); | 813 res = base1->DeleteChannel(channels[i]); |
| 832 VALIDATE; | 814 VALIDATE; |
| 833 } | 815 } |
| 834 } | 816 } |
| OLD | NEW |