[FFmpeg-devel] [PATCH 2/2] lavf/mpegts: fix av_log use the uninitialized stream id
Marton Balint
cus at passwd.hu
Mon May 10 01:32:52 EEST 2021
On Fri, 7 May 2021, Jun Zhao wrote:
> From: Jun Zhao <barryjzhao at tencent.com>
>
> fix av_log use the uninitialized stream id
Actually i is not the correct value even if it is initialized because the
loop is executed in full.
Either remove remove logging the stream index, it is not super useful
anyway, or rework the function to find an index instead of an AVStream*,
that way you can log it cleanly and in the end return something like:
return found_idx == -1 ? NULL : s->streams[p->streams[found_idx].idx];
But it is also fine if you simply remove the PMT stream index logging.
Thanks,
Marton
>
> Signed-off-by: Jun Zhao <barryjzhao at tencent.com>
> ---
> libavformat/mpegts.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
> index 9092dbce72..722dae8e36 100644
> --- a/libavformat/mpegts.c
> +++ b/libavformat/mpegts.c
> @@ -2207,7 +2207,7 @@ static AVStream *find_matching_stream(MpegTSContext *ts, int pid, unsigned int p
> int stream_identifier, int pmt_stream_idx, struct Program *p)
> {
> AVFormatContext *s = ts->stream;
> - int i;
> + int i; // the stream id of the match
> AVStream *found = NULL;
>
> if (stream_identifier) { /* match based on "stream identifier descriptor" if present */
> @@ -2218,6 +2218,7 @@ static AVStream *find_matching_stream(MpegTSContext *ts, int pid, unsigned int p
> }
> } else if (pmt_stream_idx < p->nb_streams) { /* match based on position within the PMT */
> found = s->streams[p->streams[pmt_stream_idx].idx];
> + i = pmt_stream_idx;
> }
>
> if (found) {
> --
> 2.17.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>
More information about the ffmpeg-devel
mailing list