Message ID | 20210507130334.31002-2-mypopydev@gmail.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,1/2] doc/filters: Update commands doc for amix | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
On Fri, 7 May 2021, Jun Zhao wrote: > From: Jun Zhao <barryjzhao@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@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@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". >
On Mon, May 10, 2021 at 6:33 AM Marton Balint <cus@passwd.hu> wrote: > > > > On Fri, 7 May 2021, Jun Zhao wrote: > > > From: Jun Zhao <barryjzhao@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. Will follow the comments, thx > > Thanks, > Marton >
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) {