[FFmpeg-devel] [PATCH v2] avformat/hls: Fixed incorrect behaviour of default
Steven Liu
lingjiujianke at gmail.com
Sun Jul 14 15:04:42 EEST 2024
CoderVenkat <codervenkat at gmail.com> 于2024年7月14日周日 16:21写道:
Hi Coder Venkat,
>
> Ping.
> Any chance you could take a look? I would like to submit another fix based on this.
@@ -1434,6 +1436,31 @@ static int create_master_playlist(AVFormatContext *s,
avio_printf(hls->m3u8_out, ",INSTREAM-ID=\"%s\"\n", ccs->instreamid);
}
+ /* Check only one default is present in a group */
+ for (i = 0; i < hls->nb_varstreams; i++) {
+ vs = &(hls->var_streams[i]);
+ for (j = 0; j < hls->nb_varstreams; j++) {
+ if (i != j) {
+ temp_vs = &(hls->var_streams[j]);
+ if (vs->agroup && temp_vs->agroup &&
+ !vs->has_video && !temp_vs->has_video) {
+ if (!av_strcasecmp(vs->agroup, temp_vs->agroup) &&
+ vs->is_default && temp_vs->is_default) {
+ av_log(s, AV_LOG_ERROR, "Two streams in an
agroup can not be default\n");
+ goto fail;
+ }
+ } else if (vs->sgroup && temp_vs->sgroup &&
+ !vs->has_video && !temp_vs->has_video) {
+ if (!av_strcasecmp(vs->sgroup, temp_vs->sgroup) &&
+ vs->is_default && temp_vs->is_default) {
+ av_log(s, AV_LOG_ERROR, "Two streams in an
sgroup can not be default\n");
+ goto fail;
+ }
+ }
+ }
+ }
+ }
+
/* For audio only variant streams add #EXT-X-MEDIA tag with attributes*/
for (i = 0; i < hls->nb_varstreams; i++) {
vs = &(hls->var_streams[i]);
@@ -1452,7 +1479,7 @@ static int create_master_playlist(AVFormatContext
Can these logic be optimized? for example, audio in one for logic,
subtitle in the other for logic.
> Thanks,
> vckt
>
Thanks
Steven
More information about the ffmpeg-devel
mailing list