Skip to content

Commit

Permalink
Add resolution in CMD parameter (#14)
Browse files Browse the repository at this point in the history
* Polish code

Signed-off-by: Ze Gan <[email protected]>

* Polish code

Signed-off-by: Ze Gan <[email protected]>

* Add resolution

Signed-off-by: Ze Gan <[email protected]>
  • Loading branch information
Pterosaur authored Apr 11, 2021
1 parent b239070 commit 72dd6d9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 30 deletions.
22 changes: 8 additions & 14 deletions ns-app/scratch/webrtc_test/webrtc-static.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,42 +101,37 @@ int main(int argc, char *argv[]){
uint32_t msDelay = TOPO_DEFAULT_PDELAY;
uint32_t msQDelay = TOPO_DEFAULT_QDELAY;

std::string instance=std::string("3");
std::string loss_str("0");
double loss_rate = 0;

std::string gym_id("gym");
std::string trace_path;
std::uint64_t report_interval_ms = 60;
std::uint64_t duration_time_ms = 0;
std::uint32_t video_height = 1080;
std::uint32_t video_width = 1920;
bool standalone_test_only = true;

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

cmd.Parse (argc, argv);

int loss_integer=std::stoi(loss_str);
double loss_rate=loss_integer*1.0/1000;

bool enable_random_loss=false;
if(loss_integer>0){
if(loss_rate>0){
Config::SetDefault ("ns3::RateErrorModel::ErrorRate", DoubleValue (loss_rate));
Config::SetDefault ("ns3::RateErrorModel::ErrorUnit", StringValue ("ERROR_UNIT_PACKET"));
Config::SetDefault ("ns3::BurstErrorModel::ErrorRate", DoubleValue (loss_rate));
Config::SetDefault ("ns3::BurstErrorModel::BurstSize", StringValue ("ns3::UniformRandomVariable[Min=1|Max=3]"));
enable_random_loss=true;
}

uint32_t min_rate=0;
uint32_t start_rate=500;
uint32_t max_rate=linkBw/1000;

NodeContainer nodes = BuildExampleTopo(linkBw, msDelay, msQDelay,enable_random_loss);

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

uint16_t sendPort=5432;
Expand Down
13 changes: 0 additions & 13 deletions ns-app/src/ex-webrtc/model/webrtc-config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,4 @@ void WebrtcSessionManager::SetFrameHxW(uint32_t height,uint32_t width) {
video_stream_config_.source.generator.height = height;
}

void WebrtcSessionManager::SetRate(uint32_t min_rate,uint32_t start_rate,uint32_t max_rate) {
}

void test_match_active() {
webrtc::test::VideoStreamConfig config = webrtc::test::VideoStreamConfig();
config.source.generator.width = 1280;
config.source.generator.height = 720;
webrtc::test::VideoFrameMatcher matcher(config.hooks.frame_pair_handlers);
if (!matcher.Active()) {
std::cout<<"in active"<<std::endl;
}
}

}
3 changes: 0 additions & 3 deletions ns-app/src/ex-webrtc/model/webrtc-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class WebrtcSessionManager{
std::shared_ptr<webrtc::NetworkStateEstimatorFactory> se_factory = nullptr);
~WebrtcSessionManager();
void SetFrameHxW(uint32_t height,uint32_t width);
void SetRate(uint32_t min_rate,uint32_t start_rate,uint32_t max_rate);
void CreateClients();

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

void test_match_active();

}

0 comments on commit 72dd6d9

Please sign in to comment.