mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
Merge branch '2.0release' into develop
This commit is contained in:
commit
600e8e10d0
2 changed files with 28 additions and 0 deletions
|
@ -900,6 +900,9 @@ SrsSource::SrsSource()
|
|||
gop_cache = new SrsGopCache();
|
||||
aggregate_stream = new SrsStream();
|
||||
|
||||
is_monotonically_increase = false;
|
||||
last_packet_time = 0;
|
||||
|
||||
_srs_config->subscribe(this);
|
||||
atc = false;
|
||||
}
|
||||
|
@ -1467,6 +1470,15 @@ int SrsSource::on_audio(SrsCommonMessage* shared_audio)
|
|||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
// monotically increase detect.
|
||||
if (!mix_correct && is_monotonically_increase) {
|
||||
if (last_packet_time > 0 && shared_audio->header.timestamp < last_packet_time) {
|
||||
is_monotonically_increase = false;
|
||||
srs_warn("stream not monotonically increase, please open mix_correct.");
|
||||
}
|
||||
}
|
||||
last_packet_time = shared_audio->header.timestamp;
|
||||
|
||||
// convert shared_audio to msg, user should not use shared_audio again.
|
||||
// the payload is transfer to msg, and set to NULL in shared_audio.
|
||||
SrsSharedPtrMessage msg;
|
||||
|
@ -1649,6 +1661,15 @@ int SrsSource::on_video(SrsCommonMessage* shared_video)
|
|||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
// monotically increase detect.
|
||||
if (!mix_correct && is_monotonically_increase) {
|
||||
if (last_packet_time > 0 && shared_video->header.timestamp < last_packet_time) {
|
||||
is_monotonically_increase = false;
|
||||
srs_warn("stream not monotonically increase, please open mix_correct.");
|
||||
}
|
||||
}
|
||||
last_packet_time = shared_video->header.timestamp;
|
||||
|
||||
// drop any unknown header video.
|
||||
// @see https://github.com/simple-rtmp-server/srs/issues/421
|
||||
if (!SrsFlvCodec::video_is_acceptable(shared_video->payload, shared_video->size)) {
|
||||
|
@ -1970,6 +1991,10 @@ int SrsSource::on_publish()
|
|||
// reset the mix queue.
|
||||
mix_queue->clear();
|
||||
|
||||
// detect the monotonically again.
|
||||
is_monotonically_increase = true;
|
||||
last_packet_time = 0;
|
||||
|
||||
// create forwarders
|
||||
if ((ret = create_forwarders()) != ERROR_SUCCESS) {
|
||||
srs_error("create forwarders failed. ret=%d", ret);
|
||||
|
|
|
@ -437,6 +437,9 @@ private:
|
|||
// whether use interlaced/mixed algorithm to correct timestamp.
|
||||
bool mix_correct;
|
||||
SrsMixQueue* mix_queue;
|
||||
// whether stream is monotonically increase.
|
||||
bool is_monotonically_increase;
|
||||
int64_t last_packet_time;
|
||||
// hls handler.
|
||||
#ifdef SRS_AUTO_HLS
|
||||
SrsHls* hls;
|
||||
|
|
Loading…
Reference in a new issue