Skip to content

Commit 72dd6d9

Browse files
authored
Add resolution in CMD parameter (#14)
* Polish code Signed-off-by: Ze Gan <ganze718@gmail.com> * Polish code Signed-off-by: Ze Gan <ganze718@gmail.com> * Add resolution Signed-off-by: Ze Gan <ganze718@gmail.com>
1 parent b239070 commit 72dd6d9

3 files changed

Lines changed: 8 additions & 30 deletions

File tree

ns-app/scratch/webrtc_test/webrtc-static.cc

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,42 +101,37 @@ int main(int argc, char *argv[]){
101101
uint32_t msDelay = TOPO_DEFAULT_PDELAY;
102102
uint32_t msQDelay = TOPO_DEFAULT_QDELAY;
103103

104-
std::string instance=std::string("3");
105-
std::string loss_str("0");
104+
double loss_rate = 0;
106105

107106
std::string gym_id("gym");
108107
std::string trace_path;
109108
std::uint64_t report_interval_ms = 60;
110109
std::uint64_t duration_time_ms = 0;
110+
std::uint32_t video_height = 1080;
111+
std::uint32_t video_width = 1920;
111112
bool standalone_test_only = true;
112113

113114
CommandLine cmd;
114-
cmd.AddValue("it", "instacne", instance);
115-
cmd.AddValue("lo", "loss",loss_str);
115+
cmd.AddValue("lo", "loss",loss_rate);
116116
cmd.AddValue("gym_id", "gym id should be unique in global system, the default is gym", gym_id);
117117
cmd.AddValue("trace_path", "trace file path", trace_path);
118118
cmd.AddValue("report_interval_ms", "report interval (ms)", report_interval_ms);
119119
cmd.AddValue("duration_time_ms", "duration time (ms), the default is trace log duration", duration_time_ms);
120+
cmd.AddValue("video_height", "video height", video_height);
121+
cmd.AddValue("video_width", "video width", video_width);
120122
cmd.AddValue("standalone_test_only", "standalone test only mode that don't need gym connect", standalone_test_only);
121123

122124
cmd.Parse (argc, argv);
123125

124-
int loss_integer=std::stoi(loss_str);
125-
double loss_rate=loss_integer*1.0/1000;
126-
127126
bool enable_random_loss=false;
128-
if(loss_integer>0){
127+
if(loss_rate>0){
129128
Config::SetDefault ("ns3::RateErrorModel::ErrorRate", DoubleValue (loss_rate));
130129
Config::SetDefault ("ns3::RateErrorModel::ErrorUnit", StringValue ("ERROR_UNIT_PACKET"));
131130
Config::SetDefault ("ns3::BurstErrorModel::ErrorRate", DoubleValue (loss_rate));
132131
Config::SetDefault ("ns3::BurstErrorModel::BurstSize", StringValue ("ns3::UniformRandomVariable[Min=1|Max=3]"));
133132
enable_random_loss=true;
134133
}
135134

136-
uint32_t min_rate=0;
137-
uint32_t start_rate=500;
138-
uint32_t max_rate=linkBw/1000;
139-
140135
NodeContainer nodes = BuildExampleTopo(linkBw, msDelay, msQDelay,enable_random_loss);
141136

142137
std::unique_ptr<TracePlayer> trace_player;
@@ -160,8 +155,7 @@ int main(int argc, char *argv[]){
160155
auto cc_factory = std::make_shared<NetworkControllerProxyFactory>(gym_conn);
161156
auto se_factory = std::make_shared<NetworkStateEstimatorProxyFactory>(gym_conn);
162157
auto webrtc_manager = std::make_unique<WebrtcSessionManager>(0, duration_time_ms, cc_factory, se_factory);
163-
webrtc_manager->SetFrameHxW(720,1280);
164-
webrtc_manager->SetRate(min_rate,start_rate,max_rate);
158+
webrtc_manager->SetFrameHxW(video_height,video_width);
165159
webrtc_manager->CreateClients();
166160

167161
uint16_t sendPort=5432;

ns-app/src/ex-webrtc/model/webrtc-config.cc

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,4 @@ void WebrtcSessionManager::SetFrameHxW(uint32_t height,uint32_t width) {
106106
video_stream_config_.source.generator.height = height;
107107
}
108108

109-
void WebrtcSessionManager::SetRate(uint32_t min_rate,uint32_t start_rate,uint32_t max_rate) {
110-
}
111-
112-
void test_match_active() {
113-
webrtc::test::VideoStreamConfig config = webrtc::test::VideoStreamConfig();
114-
config.source.generator.width = 1280;
115-
config.source.generator.height = 720;
116-
webrtc::test::VideoFrameMatcher matcher(config.hooks.frame_pair_handlers);
117-
if (!matcher.Active()) {
118-
std::cout<<"in active"<<std::endl;
119-
}
120-
}
121-
122109
}

ns-app/src/ex-webrtc/model/webrtc-config.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class WebrtcSessionManager{
2222
std::shared_ptr<webrtc::NetworkStateEstimatorFactory> se_factory = nullptr);
2323
~WebrtcSessionManager();
2424
void SetFrameHxW(uint32_t height,uint32_t width);
25-
void SetRate(uint32_t min_rate,uint32_t start_rate,uint32_t max_rate);
2625
void CreateClients();
2726

2827
webrtc::test::VideoStreamConfig video_stream_config_;
@@ -44,7 +43,5 @@ class WebrtcSessionManager{
4443
std::vector<std::unique_ptr<webrtc::test::VideoStreamPair>> video_streams_;
4544
};
4645

47-
void test_match_active();
48-
4946
}
5047

0 commit comments

Comments
 (0)