1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-12 11:21:52 +00:00

Fix #1303, do not dispatch previous meta when not publishing. 3.0.109

This commit is contained in:
winlin 2020-01-27 19:46:08 +08:00
parent 01870cce56
commit 5d365bade8
4 changed files with 28 additions and 17 deletions

View file

@ -146,6 +146,7 @@ For previous versions, please read:
## V3 changes
* v3.0, 2020-01-27, Fix [#1303][bug #1303], do not dispatch previous meta when not publishing. 3.0.109
* v3.0, 2020-01-26, Allow use libst.so for ST is MPL license.
* v3.0, 2020-01-26, Fix [#607][bug #607], set RTMP identifying recursive depth to 3.
* v3.0, 2020-01-25, Fix [#878][bug #878], remove deprecated #EXT-X-ALLOW-CACHE for HLS. 3.0.108
@ -1628,6 +1629,7 @@ Winlin
[bug #703]: https://github.com/ossrs/srs/issues/703
[bug #878]: https://github.com/ossrs/srs/issues/878
[bug #607]: https://github.com/ossrs/srs/issues/607
[bug #1303]: https://github.com/ossrs/srs/issues/1303
[bug #xxxxxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxxxxx
[exo #828]: https://github.com/google/ExoPlayer/pull/828

View file

@ -903,6 +903,11 @@ srs_error_t SrsOriginHub::cycle()
return err;
}
bool SrsOriginHub::active()
{
return is_active;
}
srs_error_t SrsOriginHub::on_meta_data(SrsSharedPtrMessage* shared_metadata, SrsOnMetaDataPacket* packet)
{
srs_error_t err = srs_success;
@ -2458,10 +2463,10 @@ srs_error_t SrsSource::create_consumer(SrsConnection* conn, SrsConsumer*& consum
consumer = new SrsConsumer(this, conn);
consumers.push_back(consumer);
srs_utime_t queue_size = _srs_config->get_queue_length(req->vhost);
consumer->set_queue_size(queue_size);
// if atc, update the sequence header to gop cache time.
if (atc && !gop_cache->empty()) {
if (meta->data()) {
@ -2474,22 +2479,25 @@ srs_error_t SrsSource::create_consumer(SrsConnection* conn, SrsConsumer*& consum
meta->ash()->timestamp = srsu2ms(gop_cache->start_time());
}
}
// Copy metadata and sequence header to consumer.
if ((err = meta->dumps(consumer, atc, jitter_algorithm, dm, ds)) != srs_success) {
return srs_error_wrap(err, "meta dumps");
// If stream is publishing, dumps the sequence header and gop cache.
if (hub->active()) {
// Copy metadata and sequence header to consumer.
if ((err = meta->dumps(consumer, atc, jitter_algorithm, dm, ds)) != srs_success) {
return srs_error_wrap(err, "meta dumps");
}
// copy gop cache to client.
if (dg && (err = gop_cache->dump(consumer, atc, jitter_algorithm)) != srs_success) {
return srs_error_wrap(err, "gop cache dumps");
}
}
// copy gop cache to client.
if (dg && (err = gop_cache->dump(consumer, atc, jitter_algorithm)) != srs_success) {
return srs_error_wrap(err, "gop cache dumps");
}
// print status.
if (dg) {
srs_trace("create consumer, queue_size=%.2f, jitter=%d", queue_size, jitter_algorithm);
srs_trace("create consumer, active=%d, queue_size=%.2f, jitter=%d", hub->active(), queue_size, jitter_algorithm);
} else {
srs_trace("create consumer, ignore gop cache, jitter=%d", jitter_algorithm);
srs_trace("create consumer, active=%d, ignore gop cache, jitter=%d", hub->active(), jitter_algorithm);
}
// for edge, when play edge stream, check the state

View file

@ -330,7 +330,6 @@ class SrsOriginHub : public ISrsReloadHandler
private:
SrsSource* source;
SrsRequest* req;
// Whether the stream hub is active, or stream is publishing.
bool is_active;
private:
// The format, codec information.
@ -364,6 +363,8 @@ public:
// Cycle the hub, process some regular events,
// For example, dispose hls in cycle.
virtual srs_error_t cycle();
// Whether the stream hub is active, or stream is publishing.
virtual bool active();
public:
// When got a parsed metadata.
virtual srs_error_t on_meta_data(SrsSharedPtrMessage* shared_metadata, SrsOnMetaDataPacket* packet);
@ -376,7 +377,7 @@ public:
virtual srs_error_t on_publish();
// When stop publish stream.
virtual void on_unpublish();
// Internal callback.
// Internal callback.
public:
// For the SrsForwarder to callback to request the sequence headers.
virtual srs_error_t on_forwarder_start(SrsForwarder* forwarder);

View file

@ -27,7 +27,7 @@
// The version config.
#define VERSION_MAJOR 3
#define VERSION_MINOR 0
#define VERSION_REVISION 108
#define VERSION_REVISION 109
// The macros generated by configure script.
#include <srs_auto_headers.hpp>