1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-15 04:42:04 +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 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, 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-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 * 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 #703]: https://github.com/ossrs/srs/issues/703
[bug #878]: https://github.com/ossrs/srs/issues/878 [bug #878]: https://github.com/ossrs/srs/issues/878
[bug #607]: https://github.com/ossrs/srs/issues/607 [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 [bug #xxxxxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxxxxx
[exo #828]: https://github.com/google/ExoPlayer/pull/828 [exo #828]: https://github.com/google/ExoPlayer/pull/828

View file

@ -903,6 +903,11 @@ srs_error_t SrsOriginHub::cycle()
return err; return err;
} }
bool SrsOriginHub::active()
{
return is_active;
}
srs_error_t SrsOriginHub::on_meta_data(SrsSharedPtrMessage* shared_metadata, SrsOnMetaDataPacket* packet) srs_error_t SrsOriginHub::on_meta_data(SrsSharedPtrMessage* shared_metadata, SrsOnMetaDataPacket* packet)
{ {
srs_error_t err = srs_success; srs_error_t err = srs_success;
@ -2475,21 +2480,24 @@ srs_error_t SrsSource::create_consumer(SrsConnection* conn, SrsConsumer*& consum
} }
} }
// Copy metadata and sequence header to consumer. // If stream is publishing, dumps the sequence header and gop cache.
if ((err = meta->dumps(consumer, atc, jitter_algorithm, dm, ds)) != srs_success) { if (hub->active()) {
return srs_error_wrap(err, "meta dumps"); // 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. // copy gop cache to client.
if (dg && (err = gop_cache->dump(consumer, atc, jitter_algorithm)) != srs_success) { if (dg && (err = gop_cache->dump(consumer, atc, jitter_algorithm)) != srs_success) {
return srs_error_wrap(err, "gop cache dumps"); return srs_error_wrap(err, "gop cache dumps");
}
} }
// print status. // print status.
if (dg) { 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 { } 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 // for edge, when play edge stream, check the state

View file

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

View file

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