Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1725)

Side by Side Diff: media/cast/test/receiver.cc

Issue 2113783002: Refactoring: Merge VideoSenderConfig and AudioSenderConfig. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <limits.h> 5 #include <limits.h>
6 #include <stddef.h> 6 #include <stddef.h>
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <climits> 10 #include <climits>
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 namespace media { 53 namespace media {
54 namespace cast { 54 namespace cast {
55 55
56 // Settings chosen to match default sender settings. 56 // Settings chosen to match default sender settings.
57 #define DEFAULT_SEND_PORT "0" 57 #define DEFAULT_SEND_PORT "0"
58 #define DEFAULT_RECEIVE_PORT "2344" 58 #define DEFAULT_RECEIVE_PORT "2344"
59 #define DEFAULT_SEND_IP "0.0.0.0" 59 #define DEFAULT_SEND_IP "0.0.0.0"
60 #define DEFAULT_AUDIO_FEEDBACK_SSRC "2" 60 #define DEFAULT_AUDIO_FEEDBACK_SSRC "2"
61 #define DEFAULT_AUDIO_INCOMING_SSRC "1" 61 #define DEFAULT_AUDIO_INCOMING_SSRC "1"
62 #define DEFAULT_AUDIO_PAYLOAD_TYPE "127"
63 #define DEFAULT_VIDEO_FEEDBACK_SSRC "12" 62 #define DEFAULT_VIDEO_FEEDBACK_SSRC "12"
64 #define DEFAULT_VIDEO_INCOMING_SSRC "11" 63 #define DEFAULT_VIDEO_INCOMING_SSRC "11"
65 #define DEFAULT_VIDEO_PAYLOAD_TYPE "96"
66 64
67 #if defined(USE_X11) 65 #if defined(USE_X11)
68 const char* kVideoWindowWidth = "1280"; 66 const char* kVideoWindowWidth = "1280";
69 const char* kVideoWindowHeight = "720"; 67 const char* kVideoWindowHeight = "720";
70 #endif // defined(USE_X11) 68 #endif // defined(USE_X11)
71 69
72 void GetPorts(uint16_t* tx_port, uint16_t* rx_port) { 70 void GetPorts(uint16_t* tx_port, uint16_t* rx_port) {
73 test::InputBuilder tx_input( 71 test::InputBuilder tx_input(
74 "Enter send port.", DEFAULT_SEND_PORT, 1, 65535); 72 "Enter send port.", DEFAULT_SEND_PORT, 1, 65535);
75 *tx_port = static_cast<uint16_t>(tx_input.GetIntInput()); 73 *tx_port = static_cast<uint16_t>(tx_input.GetIntInput());
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 "Choose window width.", kVideoWindowWidth, 144, 1920); 115 "Choose window width.", kVideoWindowWidth, 144, 1920);
118 *width = input_w.GetIntInput(); 116 *width = input_w.GetIntInput();
119 117
120 test::InputBuilder input_h( 118 test::InputBuilder input_h(
121 "Choose window height.", kVideoWindowHeight, 176, 1080); 119 "Choose window height.", kVideoWindowHeight, 176, 1080);
122 *height = input_h.GetIntInput(); 120 *height = input_h.GetIntInput();
123 } 121 }
124 #endif // defined(USE_X11) 122 #endif // defined(USE_X11)
125 123
126 void GetAudioPayloadtype(FrameReceiverConfig* audio_config) { 124 void GetAudioPayloadtype(FrameReceiverConfig* audio_config) {
127 test::InputBuilder input("Choose audio receiver payload type.", 125 test::InputBuilder input(
128 DEFAULT_AUDIO_PAYLOAD_TYPE, 126 "Choose audio receiver payload type.",
129 kDefaultRtpVideoPayloadType /* low_range */, 127 std::to_string(static_cast<int>(RtpPayloadType::AUDIO_OPUS)),
130 kDefaultRtpAudioPayloadType /* high_range */); 128 static_cast<int>(RtpPayloadType::AUDIO_OPUS) /* low_range */,
131 audio_config->rtp_payload_type = input.GetIntInput(); 129 static_cast<int>(RtpPayloadType::AUDIO_LAST) /* high_range */);
130 audio_config->rtp_payload_type =
131 static_cast<RtpPayloadType>(input.GetIntInput());
132 } 132 }
133 133
134 FrameReceiverConfig GetAudioReceiverConfig() { 134 FrameReceiverConfig GetAudioReceiverConfig() {
135 FrameReceiverConfig audio_config = GetDefaultAudioReceiverConfig(); 135 FrameReceiverConfig audio_config = GetDefaultAudioReceiverConfig();
136 GetAudioSsrcs(&audio_config); 136 GetAudioSsrcs(&audio_config);
137 GetAudioPayloadtype(&audio_config); 137 GetAudioPayloadtype(&audio_config);
138 audio_config.rtp_max_delay_ms = 300; 138 audio_config.rtp_max_delay_ms = 300;
139 return audio_config; 139 return audio_config;
140 } 140 }
141 141
142 void GetVideoPayloadtype(FrameReceiverConfig* video_config) { 142 void GetVideoPayloadtype(FrameReceiverConfig* video_config) {
143 test::InputBuilder input("Choose video receiver payload type.", 143 test::InputBuilder input(
144 DEFAULT_VIDEO_PAYLOAD_TYPE, 144 "Choose video receiver payload type.",
145 kDefaultRtpVideoPayloadType /* low_range */, 145 std::to_string(static_cast<int>(RtpPayloadType::VIDEO_VP8)),
146 kDefaultRtpAudioPayloadType /* high_range */); 146 static_cast<int>(RtpPayloadType::VIDEO_VP8) /* low_range */,
147 video_config->rtp_payload_type = input.GetIntInput(); 147 static_cast<int>(RtpPayloadType::LAST) /* high_range */);
148 video_config->rtp_payload_type =
149 static_cast<RtpPayloadType>(input.GetIntInput());
148 } 150 }
149 151
150 FrameReceiverConfig GetVideoReceiverConfig() { 152 FrameReceiverConfig GetVideoReceiverConfig() {
151 FrameReceiverConfig video_config = GetDefaultVideoReceiverConfig(); 153 FrameReceiverConfig video_config = GetDefaultVideoReceiverConfig();
152 GetVideoSsrcs(&video_config); 154 GetVideoSsrcs(&video_config);
153 GetVideoPayloadtype(&video_config); 155 GetVideoPayloadtype(&video_config);
154 video_config.rtp_max_delay_ms = 300; 156 video_config.rtp_max_delay_ms = 300;
155 return video_config; 157 return video_config;
156 } 158 }
157 159
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 audio_config, 601 audio_config,
600 video_config, 602 video_config,
601 window_width, 603 window_width,
602 window_height); 604 window_height);
603 player.Start(); 605 player.Start();
604 606
605 message_loop.Run(); // Run forever (i.e., until SIGTERM). 607 message_loop.Run(); // Run forever (i.e., until SIGTERM).
606 NOTREACHED(); 608 NOTREACHED();
607 return 0; 609 return 0;
608 } 610 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698