| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <algorithm> | 5 #include <algorithm> |
| 6 #include <climits> | 6 #include <climits> |
| 7 #include <cstdarg> | 7 #include <cstdarg> |
| 8 #include <cstdio> | 8 #include <cstdio> |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 #define DEFAULT_AUDIO_PAYLOAD_TYPE "127" | 58 #define DEFAULT_AUDIO_PAYLOAD_TYPE "127" |
| 59 #define DEFAULT_VIDEO_FEEDBACK_SSRC "12" | 59 #define DEFAULT_VIDEO_FEEDBACK_SSRC "12" |
| 60 #define DEFAULT_VIDEO_INCOMING_SSRC "11" | 60 #define DEFAULT_VIDEO_INCOMING_SSRC "11" |
| 61 #define DEFAULT_VIDEO_PAYLOAD_TYPE "96" | 61 #define DEFAULT_VIDEO_PAYLOAD_TYPE "96" |
| 62 | 62 |
| 63 #if defined(USE_X11) | 63 #if defined(USE_X11) |
| 64 const char* kVideoWindowWidth = "1280"; | 64 const char* kVideoWindowWidth = "1280"; |
| 65 const char* kVideoWindowHeight = "720"; | 65 const char* kVideoWindowHeight = "720"; |
| 66 #endif // defined(USE_X11) | 66 #endif // defined(USE_X11) |
| 67 | 67 |
| 68 void GetPorts(int* tx_port, int* rx_port) { | 68 void GetPorts(uint16* tx_port, uint16* rx_port) { |
| 69 test::InputBuilder tx_input( | 69 test::InputBuilder tx_input( |
| 70 "Enter send port.", DEFAULT_SEND_PORT, 1, INT_MAX); | 70 "Enter send port.", DEFAULT_SEND_PORT, 1, 65535); |
| 71 *tx_port = tx_input.GetIntInput(); | 71 *tx_port = static_cast<uint16>(tx_input.GetIntInput()); |
| 72 | 72 |
| 73 test::InputBuilder rx_input( | 73 test::InputBuilder rx_input( |
| 74 "Enter receive port.", DEFAULT_RECEIVE_PORT, 1, INT_MAX); | 74 "Enter receive port.", DEFAULT_RECEIVE_PORT, 1, 65535); |
| 75 *rx_port = rx_input.GetIntInput(); | 75 *rx_port = static_cast<uint16>(rx_input.GetIntInput()); |
| 76 } | 76 } |
| 77 | 77 |
| 78 std::string GetIpAddress(const std::string display_text) { | 78 std::string GetIpAddress(const std::string display_text) { |
| 79 test::InputBuilder input(display_text, DEFAULT_SEND_IP, INT_MIN, INT_MAX); | 79 test::InputBuilder input(display_text, DEFAULT_SEND_IP, INT_MIN, INT_MAX); |
| 80 std::string ip_address = input.GetStringInput(); | 80 std::string ip_address = input.GetStringInput(); |
| 81 // Ensure IP address is either the default value or in correct form. | 81 // Ensure IP address is either the default value or in correct form. |
| 82 while (ip_address != DEFAULT_SEND_IP && | 82 while (ip_address != DEFAULT_SEND_IP && |
| 83 std::count(ip_address.begin(), ip_address.end(), '.') != 3) { | 83 std::count(ip_address.begin(), ip_address.end(), '.') != 3) { |
| 84 ip_address = input.GetStringInput(); | 84 ip_address = input.GetStringInput(); |
| 85 } | 85 } |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 const scoped_ptr<media::AudioManager> audio_manager( | 551 const scoped_ptr<media::AudioManager> audio_manager( |
| 552 media::AudioManager::Create(&fake_audio_log_factory_)); | 552 media::AudioManager::Create(&fake_audio_log_factory_)); |
| 553 CHECK(media::AudioManager::Get()); | 553 CHECK(media::AudioManager::Get()); |
| 554 | 554 |
| 555 media::cast::FrameReceiverConfig audio_config = | 555 media::cast::FrameReceiverConfig audio_config = |
| 556 media::cast::GetAudioReceiverConfig(); | 556 media::cast::GetAudioReceiverConfig(); |
| 557 media::cast::FrameReceiverConfig video_config = | 557 media::cast::FrameReceiverConfig video_config = |
| 558 media::cast::GetVideoReceiverConfig(); | 558 media::cast::GetVideoReceiverConfig(); |
| 559 | 559 |
| 560 // Determine local and remote endpoints. | 560 // Determine local and remote endpoints. |
| 561 int remote_port, local_port; | 561 uint16 remote_port, local_port; |
| 562 media::cast::GetPorts(&remote_port, &local_port); | 562 media::cast::GetPorts(&remote_port, &local_port); |
| 563 if (!local_port) { | 563 if (!local_port) { |
| 564 LOG(ERROR) << "Invalid local port."; | 564 LOG(ERROR) << "Invalid local port."; |
| 565 return 1; | 565 return 1; |
| 566 } | 566 } |
| 567 std::string remote_ip_address = media::cast::GetIpAddress("Enter remote IP."); | 567 std::string remote_ip_address = media::cast::GetIpAddress("Enter remote IP."); |
| 568 std::string local_ip_address = media::cast::GetIpAddress("Enter local IP."); | 568 std::string local_ip_address = media::cast::GetIpAddress("Enter local IP."); |
| 569 net::IPAddressNumber remote_ip_number; | 569 net::IPAddressNumber remote_ip_number; |
| 570 net::IPAddressNumber local_ip_number; | 570 net::IPAddressNumber local_ip_number; |
| 571 if (!net::ParseIPLiteralToNumber(remote_ip_address, &remote_ip_number)) { | 571 if (!net::ParseIPLiteralToNumber(remote_ip_address, &remote_ip_number)) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 591 audio_config, | 591 audio_config, |
| 592 video_config, | 592 video_config, |
| 593 window_width, | 593 window_width, |
| 594 window_height); | 594 window_height); |
| 595 player.Start(); | 595 player.Start(); |
| 596 | 596 |
| 597 base::MessageLoop().Run(); // Run forever (i.e., until SIGTERM). | 597 base::MessageLoop().Run(); // Run forever (i.e., until SIGTERM). |
| 598 NOTREACHED(); | 598 NOTREACHED(); |
| 599 return 0; | 599 return 0; |
| 600 } | 600 } |
| OLD | NEW |