Skip to content

Commit

Permalink
Fix #1303, do not dispatch previous meta when not publishing. 3.0.109
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Jan 27, 2020
1 parent 01870cc commit 5d365ba
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 17 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
36 changes: 22 additions & 14 deletions trunk/src/app/srs_app_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()) {
Expand All @@ -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");
}

// 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");

// 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");
}
}

// 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
Expand Down
5 changes: 3 additions & 2 deletions trunk/src/app/srs_app_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -364,6 +363,8 @@ class SrsOriginHub : public ISrsReloadHandler
// 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);
Expand All @@ -376,7 +377,7 @@ class SrsOriginHub : public ISrsReloadHandler
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);
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 5d365ba

Please sign in to comment.