winlin

fix #87: add source id for full trackable log. 0.9.120

... ... @@ -228,8 +228,9 @@ Supported operating systems and hardware:
* 2013-10-17, Created.<br/>
## History
* v1.0, 2014-05-25, fix [#84](https://github.com/winlinvip/simple-rtmp-server/issues/84), unpublish when edge disconnect. 0.9.119
* v1.0, 2014-05-25, fix [#89](https://github.com/winlinvip/simple-rtmp-server/issues/89), config to /dev/null to disable ffmpeg log. 0.9.117
* v1.0, 2014-05-27, fix [#87](https://github.com/winlinvip/simple-rtmp-server/issues/87), add source id for full trackable log. 0.9.120
* v1.0, 2014-05-27, fix [#84](https://github.com/winlinvip/simple-rtmp-server/issues/84), unpublish when edge disconnect. 0.9.119
* v1.0, 2014-05-27, fix [#89](https://github.com/winlinvip/simple-rtmp-server/issues/89), config to /dev/null to disable ffmpeg log. 0.9.117
* v1.0, 2014-05-25, fix [#76](https://github.com/winlinvip/simple-rtmp-server/issues/76), allow edge vhost to add or remove. 0.9.114
* v1.0, 2014-05-24, Johnny contribute [ossrs.net](http://ossrs.net). karthikeyan start to translate wiki to English.
* v1.0, 2014-05-22, fix [#78](https://github.com/winlinvip/simple-rtmp-server/issues/78), st joinable thread must be stop by other threads, 0.9.113
... ...
... ... @@ -571,7 +571,7 @@ int SrsRtmpConn::fmle_publish(SrsSource* source)
bool vhost_is_edge = _srs_config->get_vhost_is_edge(req->vhost);
// when edge, ignore the publish event, directly proxy it.
if (vhost_is_edge) {
if (!vhost_is_edge) {
// notify the hls to prepare when publish start.
if ((ret = source->on_publish()) != ERROR_SUCCESS) {
srs_error("fmle hls on_publish failed. ret=%d", ret);
... ... @@ -650,7 +650,7 @@ int SrsRtmpConn::flash_publish(SrsSource* source)
bool vhost_is_edge = _srs_config->get_vhost_is_edge(req->vhost);
// when edge, ignore the publish event, directly proxy it.
if (vhost_is_edge) {
if (!vhost_is_edge) {
// notify the hls to prepare when publish start.
if ((ret = source->on_publish()) != ERROR_SUCCESS) {
srs_error("flash hls on_publish failed. ret=%d", ret);
... ...
... ... @@ -176,7 +176,7 @@ int SrsListener::cycle()
if(client_stfd == NULL){
// ignore error.
srs_warn("ignore accept thread stoppped for accept client error");
srs_error("ignore accept thread stoppped for accept client error");
return ret;
}
srs_verbose("get a client. fd=%d", st_netfd_fileno(client_stfd));
... ...
... ... @@ -248,6 +248,7 @@ SrsConsumer::SrsConsumer(SrsSource* _source)
paused = false;
jitter = new SrsRtmpJitter();
queue = new SrsMessageQueue();
should_update_source_id = false;
}
SrsConsumer::~SrsConsumer()
... ... @@ -262,6 +263,11 @@ void SrsConsumer::set_queue_size(double queue_size)
queue->set_queue_size(queue_size);
}
void SrsConsumer::update_source_id()
{
should_update_source_id = true;
}
int SrsConsumer::get_time()
{
return jitter->get_time();
... ... @@ -287,6 +293,11 @@ int SrsConsumer::enqueue(SrsSharedPtrMessage* msg, int tba, int tbv)
int SrsConsumer::get_packets(int max_count, SrsSharedPtrMessage**& pmsgs, int& count)
{
if (should_update_source_id) {
srs_trace("update source_id=%d", source->source_id());
should_update_source_id = false;
}
// paused, return nothing.
if (paused) {
return ERROR_SUCCESS;
... ... @@ -802,6 +813,13 @@ int SrsSource::on_source_id_changed(int id)
_source_id = id;
// notice all consumer
std::vector<SrsConsumer*>::iterator it;
for (it = consumers.begin(); it != consumers.end(); ++it) {
SrsConsumer* consumer = *it;
consumer->update_source_id();
}
return ret;
}
... ...
... ... @@ -134,11 +134,20 @@ private:
SrsSource* source;
SrsMessageQueue* queue;
bool paused;
// when source id changed, notice all consumers
bool should_update_source_id;
public:
SrsConsumer(SrsSource* _source);
virtual ~SrsConsumer();
public:
/**
* set the size of queue.
*/
virtual void set_queue_size(double queue_size);
/**
* when source id changed, notice client to print.
*/
virtual void update_source_id();
public:
/**
* get current client time, the last packet time.
... ...
... ... @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR "0"
#define VERSION_MINOR "9"
#define VERSION_REVISION "119"
#define VERSION_REVISION "120"
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
... ...