diff mbox

[FFmpeg-devel] fftools/ffprobe: Fix for ticket 6796 (ffprobe show_frames ts dvbsubs infinite loop)

Message ID DM5PR22MB06813C9BE0036786E8673BE5FE3C0@DM5PR22MB0681.namprd22.prod.outlook.com
State New
Headers show

Commit Message

Colin NG Dec. 4, 2017, 2:53 a.m. UTC
---
 fftools/ffprobe.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Moritz Barsnick Dec. 4, 2017, 9:42 a.m. UTC | #1
On Mon, Dec 04, 2017 at 02:53:36 +0000, Colin NG wrote:

> fftools/ffprobe: Fix for ticket 6796 (ffprobe show_frames ts dvbsubs infinite loop)

You are supposed to primarily write *what* you changed, not why. The
reference to the ticket belongs in thew "body" of the commit message.
Like:

-- snip --
fftools/ffprobe: skip blabla for subtitle frames (I'm making this up)

Avoids infinite looping for "ffprobe -show_frames" on mpegts files with
dvbsubs.

Fixes #6796.
-- snip --

> +++ b/fftools/ffprobe.c
> @@ -2280,6 +2280,7 @@ static av_always_inline int process_frame(WriterContext *w,
>              break;
>          default:
>              *packet_new = 0;
> +            break;
>          }

This is an irrelevant style change, right?

>          int is_sub = (par->codec_type == AVMEDIA_TYPE_SUBTITLE);
>          nb_streams_frames[pkt->stream_index]++;
> +        got_frame = (par->codec_type == AVMEDIA_TYPE_SUBTITLE) ? 0: got_frame;

Two lines above, "is_sub" was introduced as a handy shortcut. Why not
just use it?

Moritz
diff mbox

Patch

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 0e7a771..6ddd81e 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2280,6 +2280,7 @@  static av_always_inline int process_frame(WriterContext *w,
             break;
         default:
             *packet_new = 0;
+            break;
         }
     } else {
         *packet_new = 0;
@@ -2290,6 +2291,7 @@  static av_always_inline int process_frame(WriterContext *w,
     if (got_frame) {
         int is_sub = (par->codec_type == AVMEDIA_TYPE_SUBTITLE);
         nb_streams_frames[pkt->stream_index]++;
+        got_frame = (par->codec_type == AVMEDIA_TYPE_SUBTITLE) ? 0: got_frame;
         if (do_show_frames)
             if (is_sub)
                 show_subtitle(w, &sub, ifile->streams[pkt->stream_index].st, fmt_ctx);