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

for #512, partical hotfix the hls pure audio. 2.0.196

This commit is contained in:
winlin 2015-10-27 17:44:10 +08:00
parent 3683f06e4d
commit d1979c760f
5 changed files with 25 additions and 6 deletions

View file

@ -578,6 +578,7 @@ int SrsHlsMuxer::segment_open(int64_t segment_start_dts)
current->full_path.c_str(), tmp_file.c_str());
// set the segment muxer audio codec.
// TODO: FIXME: refine code, use event instead.
if (acodec != SrsCodecAudioReserved1) {
current->muxer->update_acodec(acodec);
}
@ -1044,7 +1045,7 @@ int SrsHlsCache::on_sequence_header(SrsHlsMuxer* muxer)
// when the sequence header changed, the stream is not republish.
return muxer->on_sequence_header();
}
int SrsHlsCache::write_audio(SrsAvcAacCodec* codec, SrsHlsMuxer* muxer, int64_t pts, SrsCodecSample* sample)
{
int ret = ERROR_SUCCESS;
@ -1069,6 +1070,13 @@ int SrsHlsCache::write_audio(SrsAvcAacCodec* codec, SrsHlsMuxer* muxer, int64_t
}
}
// for pure audio, aggregate some frame to one.
if (muxer->pure_audio() && cache->audio) {
if (pts - cache->audio->start_pts < SRS_CONSTS_HLS_PURE_AUDIO_AGGREGATE) {
return ret;
}
}
// directly write the audio frame by frame to ts,
// it's ok for the hls overload, or maybe cause the audio corrupt,
// which introduced by aggregate the audios to a big one.