For #1506, ignore video when codec is unknown.

pull/1568/head
winlin 5 years ago
parent 65c66592e9
commit 52c6c7c45d

1
trunk/.gitignore vendored

@ -2,6 +2,7 @@
/*.conf /*.conf
/*.txt /*.txt
/*.flv /*.flv
/*.mp4
/doc/frozen*.flv /doc/frozen*.flv
/doc/kungfupanda*.flv /doc/kungfupanda*.flv
/doc/time*.flv /doc/time*.flv

@ -1194,6 +1194,12 @@ srs_error_t SrsHls::on_audio(SrsSharedPtrMessage* shared_audio, SrsFormat* forma
if (!enabled) { if (!enabled) {
return err; return err;
} }
// Ignore if no format->acodec, it means the codec is not parsed, or unknown codec.
// @issue https://github.com/ossrs/srs/issues/1506#issuecomment-562079474
if (!format->acodec) {
return err;
}
// update the hls time, for hls_dispose. // update the hls time, for hls_dispose.
last_update_time = srs_get_system_time(); last_update_time = srs_get_system_time();
@ -1202,7 +1208,6 @@ srs_error_t SrsHls::on_audio(SrsSharedPtrMessage* shared_audio, SrsFormat* forma
SrsAutoFree(SrsSharedPtrMessage, audio); SrsAutoFree(SrsSharedPtrMessage, audio);
// ts support audio codec: aac/mp3 // ts support audio codec: aac/mp3
srs_assert(format->acodec);
SrsAudioCodecId acodec = format->acodec->id; SrsAudioCodecId acodec = format->acodec->id;
if (acodec != SrsAudioCodecIdAAC && acodec != SrsAudioCodecIdMP3) { if (acodec != SrsAudioCodecIdAAC && acodec != SrsAudioCodecIdMP3) {
return err; return err;
@ -1251,7 +1256,13 @@ srs_error_t SrsHls::on_video(SrsSharedPtrMessage* shared_video, SrsFormat* forma
if (!enabled) { if (!enabled) {
return err; return err;
} }
// Ignore if no format->vcodec, it means the codec is not parsed, or unknown codec.
// @issue https://github.com/ossrs/srs/issues/1506#issuecomment-562079474
if (!format->vcodec) {
return err;
}
// update the hls time, for hls_dispose. // update the hls time, for hls_dispose.
last_update_time = srs_get_system_time(); last_update_time = srs_get_system_time();

Loading…
Cancel
Save