1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

for #635, refine hls open/close gop.

This commit is contained in:
winlin 2017-01-10 18:07:46 +08:00
parent 4104f25069
commit 6fbda2ae3f
4 changed files with 67 additions and 119 deletions

View file

@ -324,20 +324,13 @@ SrsCodecSampleUnit::~SrsCodecSampleUnit()
SrsCodecSample::SrsCodecSample()
{
reset();
clear();
}
SrsCodecSample::~SrsCodecSample()
{
}
void SrsCodecSample::reset()
{
clear();
open_gop = false;
}
void SrsCodecSample::clear()
{
is_video = false;
@ -346,7 +339,7 @@ void SrsCodecSample::clear()
cts = 0;
frame_type = SrsCodecVideoAVCFrameReserved;
avc_packet_type = SrsCodecVideoAVCTypeReserved;
has_aud = has_idr = false;
has_sps_pps = has_aud = has_idr = false;
first_nalu_type = SrsAvcNaluTypeReserved;
acodec = SrsCodecAudioReserved1;
@ -377,6 +370,8 @@ int SrsCodecSample::add_sample_unit(char* bytes, int size)
if (nal_unit_type == SrsAvcNaluTypeIDR) {
has_idr = true;
} else if (nal_unit_type == SrsAvcNaluTypeSPS || nal_unit_type == SrsAvcNaluTypePPS) {
has_sps_pps = true;
} else if (nal_unit_type == SrsAvcNaluTypeAccessUnitDelimiter) {
has_aud = true;
}
@ -773,11 +768,6 @@ int SrsAvcAacCodec::video_nalu_demux(SrsStream* stream, SrsCodecSample* sample)
srs_info("hls decode avc payload in annexb format.");
}
// for keyframe, but not IDR, it's open gop.
if (sample->frame_type == SrsCodecVideoAVCFrameKeyFrame && !sample->has_idr) {
sample->open_gop = true;
}
return ret;
}