本文整理汇总了C++中Stats::autoSummary方法的典型用法代码示例。如果您正苦于以下问题:C++ Stats::autoSummary方法的具体用法?C++ Stats::autoSummary怎么用?C++ Stats::autoSummary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stats
的用法示例。
在下文中一共展示了Stats::autoSummary方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onDidConnect
void onDidConnect(RTSPCubemapSourceClient* client, CubemapSource* cubemapSource)
{
if (typeid(cubemapSource) == typeid(H264CubemapSource))
{
H264CubemapSource* h264CubemapSource = (H264CubemapSource*)cubemapSource;
h264CubemapSource->setOnReceivedNALU (boost::bind(&onReceivedNALU, _1, _2, _3, _4));
h264CubemapSource->setOnReceivedFrame (boost::bind(&onReceivedFrame, _1, _2, _3, _4));
h264CubemapSource->setOnDecodedFrame (boost::bind(&onDecodedFrame, _1, _2, _3, _4));
h264CubemapSource->setOnColorConvertedFrame(boost::bind(&onColorConvertedFrame, _1, _2, _3, _4));
}
stats.autoSummary(boost::chrono::seconds(10),
AlloReceiver::statValsMaker,
AlloReceiver::postProcessorMaker,
AlloReceiver::formatStringMaker);
::cubemapSource = cubemapSource;
barrier.wait();
}
示例2: main
int main(int argc, char* argv[])
{
try
{
if (argc < 5)
{
std::cerr << "Usage: receiver <listen_address> <multicast_address> <stats interval> <port>+" << std::endl;
return 1;
}
std::vector<short> ports;
for (int i = 4; i < argc; i++)
{
ports.push_back(atoi(argv[i]));
}
boost::asio::ip::address listen_address = boost::asio::ip::address::from_string(argv[1]);
boost::asio::ip::address multicast_address = boost::asio::ip::address::from_string(argv[2]);
size_t statsInterval = atoi(argv[3]);
std::stringstream ss;
std::copy(ports.begin(), ports.end(), std::ostream_iterator<short>(ss, ", "));
std::cout << "Monitoring packets from " << multicast_address.to_string() <<
" with port(s) " << ss.str().substr(0, ss.str().length() - 2) <<
" on interface address " << listen_address.to_string() << std::endl;
std::vector<receiver*> receivers;
std::vector<boost::asio::io_service*> io_services;
for (int i = 0; i < ports.size(); i++)
{
io_services.push_back(new boost::asio::io_service());
receivers.push_back(new receiver(*io_services[i],
boost::asio::ip::address::from_string(argv[1]),
boost::asio::ip::address::from_string(argv[2]),
ports[i],
i));
}
stats.autoSummary(boost::chrono::seconds(statsInterval),
AlloReceiver::statValsMaker,
AlloReceiver::postProcessorMaker,
AlloReceiver::formatStringMaker);
std::vector<boost::thread> io_threads;
for (boost::asio::io_service* io_service : io_services)
{
io_threads.push_back(boost::thread(boost::bind(&boost::asio::io_service::run, io_service)));
}
for (boost::thread& io_thread : io_threads)
{
io_thread.join();
}
}
catch (std::exception& e)
{
std::cerr << "Exception: " << e.what() << "\n";
}
return 0;
}
示例3: main
//.........这里部分代码省略.........
boost::program_options::variables_map vm;
boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), vm);
boost::program_options::notify(vm);
if (vm.count("interface"))
{
std::string interfaceAddress = vm["interface"].as<std::string>();
NetAddressList addresses(interfaceAddress.c_str());
if (addresses.numAddresses() == 0)
{
std::cout << "Failed to find network address for \"" << interfaceAddress << "\"" << std::endl;
return -1;
}
ReceivingInterfaceAddr = *(unsigned*)(addresses.firstAddress()->data());
}
char sourceAddressStr[INET_ADDRSTRLEN];
inet_ntop(AF_INET, &(ReceivingInterfaceAddr), sourceAddressStr, sizeof(sourceAddressStr));
std::cout << "Using source address " << sourceAddressStr << std::endl;
if (vm.count("rtsp-port"))
{
rtspPort = vm["rtsp-port"].as<boost::uint16_t>();
}
else
{
rtspPort = 8555;
}
std::cout << "Using RTSP port " << rtspPort << std::endl;
// Create 'groupsocks' for RTP and RTCP:
if(vm.count("multicast-address"))
{
inet_pton(AF_INET, vm["multicast-address"].as<std::string>().c_str(), &(destinationAddress.s_addr));
}
else
{
inet_pton(AF_INET, "224.0.67.67", &(destinationAddress.s_addr));
}
if (vm.count("avg-bit-rate"))
{
avgBitRate = vm["avg-bit-rate"].as<int>();
}
else
{
avgBitRate = DEFAULT_AVG_BIT_RATE;
}
std::string bitRateString = to_human_readable_byte_count(avgBitRate, true, false);
std::cout << "Using an average encoding bit rate of " << bitRateString << "/s per face" << std::endl;
if (vm.count("buffer-size"))
{
bufferSize = vm["buffer-size"].as<size_t>();
}
else
{
bufferSize = DEFAULT_BUFFER_SIZE;
}
std::string bufferSizeString = to_human_readable_byte_count(bufferSize, false, false);
std::cout << "Using a buffer size of " << bufferSizeString << std::endl;
size_t statsInterval;
if (vm.count("stats-interval"))
{
statsInterval = vm["stats-interval"].as<size_t>();
}
else
{
statsInterval = DEFAULT_STATS_INTERVAL;
}
av_log_set_level(AV_LOG_WARNING);
avcodec_register_all();
setupRTSP();
boost::thread networkThread = boost::thread(&networkLoop);
Process unityProcess(CUBEMAPEXTRACTIONPLUGIN_ID, false);
Process thisProcess(ALLOSERVER_ID, true);
while (true)
{
std::cout << "Waiting for Unity ..." << std::endl;
unityProcess.waitForBirth();
std::cout << "Connected to Unity :)" << std::endl;
startStreaming();
stats.autoSummary(boost::chrono::seconds(statsInterval),
AlloReceiver::statValsMaker,
AlloReceiver::postProcessorMaker,
AlloReceiver::formatStringMaker);
unityProcess.join();
std::cout << "Lost connection to Unity :(" << std::endl;
stopStreaming();
stats.stopAutoSummary();
}
return 0;
}