mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
fix #474, config to donot parse width/height from sps. 2.0.189
This commit is contained in:
parent
eb578b4a39
commit
511627abab
10 changed files with 94 additions and 11 deletions
|
@ -1290,7 +1290,7 @@ int SrsSource::on_hls_start()
|
|||
// when reload to start hls, hls will never get the sequence header in stream,
|
||||
// use the SrsSource.on_hls_start to push the sequence header to HLS.
|
||||
// TODO: maybe need to decode the metadata?
|
||||
if (cache_sh_video && (ret = hls->on_video(cache_sh_video)) != ERROR_SUCCESS) {
|
||||
if (cache_sh_video && (ret = hls->on_video(cache_sh_video, true)) != ERROR_SUCCESS) {
|
||||
srs_error("hls process video sequence header message failed. ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
@ -1587,7 +1587,6 @@ int SrsSource::on_audio_imp(SrsSharedPtrMessage* msg)
|
|||
codec.audio_data_rate / 1000, aac_sample_rates[codec.aac_sample_rate],
|
||||
flv_sample_sizes[sample.sound_size], flv_sound_types[sample.sound_type],
|
||||
flv_sample_rates[sample.sound_rate]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef SRS_AUTO_HLS
|
||||
|
@ -1674,6 +1673,11 @@ int SrsSource::on_audio_imp(SrsSharedPtrMessage* msg)
|
|||
cache_sh_audio = msg->copy();
|
||||
}
|
||||
|
||||
// when sequence header, donot push to gop cache and adjust the timestamp.
|
||||
if (is_sequence_header) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
// cache the last gop packets
|
||||
if ((ret = gop_cache->cache(msg)) != ERROR_SUCCESS) {
|
||||
srs_error("shrink gop cache failed. ret=%d", ret);
|
||||
|
@ -1779,6 +1783,11 @@ int SrsSource::on_video_imp(SrsSharedPtrMessage* msg)
|
|||
|
||||
// parse detail audio codec
|
||||
SrsAvcAacCodec codec;
|
||||
|
||||
// user can disable the sps parse to workaround when parse sps failed.
|
||||
// @see https://github.com/simple-rtmp-server/srs/issues/474
|
||||
codec.avc_parse_sps = _srs_config->get_parse_sps(_req->vhost);
|
||||
|
||||
SrsCodecSample sample;
|
||||
if ((ret = codec.video_avc_demux(msg->payload, msg->size, &sample)) != ERROR_SUCCESS) {
|
||||
srs_error("source codec demux video failed. ret=%d", ret);
|
||||
|
@ -1796,11 +1805,10 @@ int SrsSource::on_video_imp(SrsSharedPtrMessage* msg)
|
|||
srs_codec_avc_profile2str(codec.avc_profile).c_str(),
|
||||
srs_codec_avc_level2str(codec.avc_level).c_str(), codec.width, codec.height,
|
||||
codec.video_data_rate / 1000, codec.frame_rate, codec.duration);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef SRS_AUTO_HLS
|
||||
if ((ret = hls->on_video(msg)) != ERROR_SUCCESS) {
|
||||
if ((ret = hls->on_video(msg, is_sequence_header)) != ERROR_SUCCESS) {
|
||||
// apply the error strategy for hls.
|
||||
// @see https://github.com/simple-rtmp-server/srs/issues/264
|
||||
std::string hls_error_strategy = _srs_config->get_hls_on_error(_req->vhost);
|
||||
|
@ -1874,6 +1882,11 @@ int SrsSource::on_video_imp(SrsSharedPtrMessage* msg)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// when sequence header, donot push to gop cache and adjust the timestamp.
|
||||
if (is_sequence_header) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
// cache the last gop packets
|
||||
if ((ret = gop_cache->cache(msg)) != ERROR_SUCCESS) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue