当前位置: 首页>>代码示例>>C++>>正文


C++ SrsForwarder::on_publish方法代码示例

本文整理汇总了C++中SrsForwarder::on_publish方法的典型用法代码示例。如果您正苦于以下问题:C++ SrsForwarder::on_publish方法的具体用法?C++ SrsForwarder::on_publish怎么用?C++ SrsForwarder::on_publish使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SrsForwarder的用法示例。


在下文中一共展示了SrsForwarder::on_publish方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: create_forwarders

int SrsSource::create_forwarders()
{
	int ret = ERROR_SUCCESS;
	
	SrsConfDirective* conf = config->get_forward(req->vhost);
	for (int i = 0; conf && i < (int)conf->args.size(); i++) {
		std::string forward_server = conf->args.at(i);
		
		SrsForwarder* forwarder = new SrsForwarder(this);
		forwarders.push_back(forwarder);
	
		double queue_size = config->get_queue_length(req->vhost);
		forwarder->set_queue_size(queue_size);
		
		if ((ret = forwarder->on_publish(req, forward_server)) != ERROR_SUCCESS) {
			srs_error("start forwarder failed. "
				"vhost=%s, app=%s, stream=%s, forward-to=%s",
				req->vhost.c_str(), req->app.c_str(), req->stream.c_str(),
				forward_server.c_str());
			return ret;
		}
	}

	return ret;
}
开发者ID:AlexSnet,项目名称:simple-rtmp-server,代码行数:25,代码来源:srs_core_source.cpp

示例2: on_publish

int SrsSource::on_publish(std::string vhost, std::string port, std::string app, std::string stream)
{
	int ret = ERROR_SUCCESS;
	
	_can_publish = false;
	
#ifdef SRS_HLS
	if ((ret = hls->on_publish(vhost, app, stream)) != ERROR_SUCCESS) {
		return ret;
	}
#endif

#ifdef SRS_FFMPEG
	if ((ret = encoder->on_publish(vhost, port, app, stream)) != ERROR_SUCCESS) {
		return ret;
	}
#endif

	// TODO: support reload.
	
	// create forwarders
	SrsConfDirective* conf = config->get_forward(vhost);
	for (int i = 0; conf && i < (int)conf->args.size(); i++) {
		std::string forward_server = conf->args.at(i);
		
		SrsForwarder* forwarder = new SrsForwarder();
		forwarders.push_back(forwarder);
		
		if ((ret = forwarder->on_publish(vhost, app, stream, forward_server)) != ERROR_SUCCESS) {
			srs_error("start forwarder failed. "
				"vhost=%s, app=%s, stream=%s, forward-to=%s",
				vhost.c_str(), app.c_str(), stream.c_str(),
				forward_server.c_str());
			return ret;
		}
	}

	return ret;
}
开发者ID:benbearchen,项目名称:simple-rtmp-server,代码行数:39,代码来源:srs_core_source.cpp


注:本文中的SrsForwarder::on_publish方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。