mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
fixed bug: video rendering in hls stream generates only vertical parttern (#841)
This commit is contained in:
parent
b11ddc7f41
commit
bd2a1f9d3c
1 changed files with 3 additions and 1 deletions
|
@ -3039,6 +3039,7 @@ int SrsTsCache::do_cache_avc(SrsAvcAacCodec* codec, SrsCodecSample* sample)
|
|||
video->payload->append((const char*)default_aud_nalu, 2);
|
||||
}
|
||||
|
||||
bool is_sps_pps_appended = false;
|
||||
// all sample use cont nalu header, except the sps-pps before IDR frame.
|
||||
for (int i = 0; i < sample->nb_sample_units; i++) {
|
||||
SrsCodecSampleUnit* sample_unit = &sample->sample_units[i];
|
||||
|
@ -3056,7 +3057,7 @@ int SrsTsCache::do_cache_avc(SrsAvcAacCodec* codec, SrsCodecSample* sample)
|
|||
|
||||
// Insert sps/pps before IDR when there is no sps/pps in samples.
|
||||
// The sps/pps is parsed from sequence header(generally the first flv packet).
|
||||
if (nal_unit_type == SrsAvcNaluTypeIDR && !sample->has_sps_pps) {
|
||||
if (nal_unit_type == SrsAvcNaluTypeIDR && !sample->has_sps_pps && !is_sps_pps_appended) {
|
||||
if (codec->sequenceParameterSetLength > 0) {
|
||||
srs_avc_insert_aud(video->payload, aud_inserted);
|
||||
video->payload->append(codec->sequenceParameterSetNALUnit, codec->sequenceParameterSetLength);
|
||||
|
@ -3065,6 +3066,7 @@ int SrsTsCache::do_cache_avc(SrsAvcAacCodec* codec, SrsCodecSample* sample)
|
|||
srs_avc_insert_aud(video->payload, aud_inserted);
|
||||
video->payload->append(codec->pictureParameterSetNALUnit, codec->pictureParameterSetLength);
|
||||
}
|
||||
is_sps_pps_appended = true;
|
||||
}
|
||||
|
||||
// Insert the NALU to video in annexb.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue