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

Fix #301, User must config the codec in right way for HLS. 3.0.18

This commit is contained in:
winlin 2017-02-12 20:55:35 +08:00
parent d612a21bad
commit 2a4f57a587
6 changed files with 6 additions and 60 deletions

View file

@ -223,7 +223,6 @@ SrsHlsMuxer::SrsHlsMuxer()
max_td = 0;
_sequence_no = 0;
current = NULL;
acodec = SrsAudioCodecIdReserved1;
async = new SrsAsyncCallWorker();
context = new SrsTsContext();
}
@ -478,14 +477,7 @@ int SrsHlsMuxer::segment_open(int64_t segment_start_dts)
srs_error("open hls muxer failed. ret=%d", ret);
return ret;
}
srs_info("open HLS muxer success. path=%s, tmp=%s",
current->full_path.c_str(), tmp_file.c_str());
// set the segment muxer audio codec.
// TODO: FIXME: refine code, use event instead.
if (acodec != SrsAudioCodecIdReserved1) {
current->muxer->update_acodec(acodec);
}
srs_info("open HLS muxer success. path=%s, tmp=%s", current->full_path.c_str(), tmp_file.c_str());
return ret;
}
@ -543,14 +535,6 @@ bool SrsHlsMuxer::is_segment_absolutely_overflow()
return current->duration >= hls_aof_ratio * hls_fragment + deviation;
}
int SrsHlsMuxer::update_acodec(SrsAudioCodecId ac)
{
srs_assert(current);
srs_assert(current->muxer);
acodec = ac;
return current->muxer->update_acodec(ac);
}
bool SrsHlsMuxer::pure_audio()
{
return current && current->muxer && current->muxer->video_codec() == SrsVideoCodecIdDisabled;
@ -863,11 +847,6 @@ void SrsHlsController::dispose()
muxer->dispose();
}
int SrsHlsController::update_acodec(SrsAudioCodecId ac)
{
return muxer->update_acodec(ac);
}
int SrsHlsController::sequence_no()
{
return muxer->sequence_no();
@ -1220,12 +1199,6 @@ int SrsHls::on_audio(SrsSharedPtrMessage* shared_audio, SrsFormat* format)
if (acodec != SrsAudioCodecIdAAC && acodec != SrsAudioCodecIdMP3) {
return ret;
}
// when codec changed, write new header.
if ((ret = controller->update_acodec(acodec)) != ERROR_SUCCESS) {
srs_error("http: ts audio write header failed. ret=%d", ret);
return ret;
}
// ignore sequence header
srs_assert(format->audio);