Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/2] fftools/ffprobe: Flush decoder after draining
@ 2022-02-19 15:08 Andreas Rheinhardt
  2022-02-19 15:09 ` [FFmpeg-devel] [PATCH 2/2] fftools/ffprobe: Remove redundant checks Andreas Rheinhardt
  2022-02-22 22:49 ` [FFmpeg-devel] [PATCH 1/2] fftools/ffprobe: Flush decoder after draining Andreas Rheinhardt
  0 siblings, 2 replies; 3+ messages in thread
From: Andreas Rheinhardt @ 2022-02-19 15:08 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

This is a prerequisite to continue using the decoder at all
to decode the next interval (if any).
This fixes a regression introduced in commit
2a88ebd096f3c748a2d99ed1b60b22879b3c567c and reported in ticket #8657.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
I wonder whether it would not be simpler to let users reuse a decoder
after draining simply by sending new packets (without flushing).

 fftools/ffprobe.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 8a8e3de540..4205ddedda 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2730,8 +2730,11 @@ static int read_interval_packets(WriterContext *w, InputFile *ifile,
     //Flush remaining frames that are cached in the decoder
     for (i = 0; i < fmt_ctx->nb_streams; i++) {
         pkt->stream_index = i;
-        if (do_read_frames)
+        if (do_read_frames) {
             while (process_frame(w, ifile, frame, pkt, &(int){1}) > 0);
+            if (ifile->streams[i].dec_ctx)
+                avcodec_flush_buffers(ifile->streams[i].dec_ctx);
+        }
     }
 
 end:
-- 
2.32.0

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [FFmpeg-devel] [PATCH 2/2] fftools/ffprobe: Remove redundant checks
  2022-02-19 15:08 [FFmpeg-devel] [PATCH 1/2] fftools/ffprobe: Flush decoder after draining Andreas Rheinhardt
@ 2022-02-19 15:09 ` Andreas Rheinhardt
  2022-02-22 22:49 ` [FFmpeg-devel] [PATCH 1/2] fftools/ffprobe: Flush decoder after draining Andreas Rheinhardt
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Rheinhardt @ 2022-02-19 15:09 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

A decoder is only opened if there is a decoder for the codec,
so every AVCodecContext here has AVCodecContext.codec set.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 fftools/ffprobe.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 4205ddedda..38b7e7e00f 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2561,7 +2561,7 @@ static av_always_inline int process_frame(WriterContext *w,
     int ret = 0, got_frame = 0;
 
     clear_log(1);
-    if (dec_ctx && dec_ctx->codec) {
+    if (dec_ctx) {
         switch (par->codec_type) {
         case AVMEDIA_TYPE_VIDEO:
         case AVMEDIA_TYPE_AUDIO:
@@ -2901,7 +2901,7 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
         break;
     }
 
-    if (dec_ctx && dec_ctx->codec && dec_ctx->codec->priv_class && show_private_data) {
+    if (dec_ctx && dec_ctx->codec->priv_class && show_private_data) {
         const AVOption *opt = NULL;
         while (opt = av_opt_next(dec_ctx->priv_data,opt)) {
             uint8_t *str;
-- 
2.32.0

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/2] fftools/ffprobe: Flush decoder after draining
  2022-02-19 15:08 [FFmpeg-devel] [PATCH 1/2] fftools/ffprobe: Flush decoder after draining Andreas Rheinhardt
  2022-02-19 15:09 ` [FFmpeg-devel] [PATCH 2/2] fftools/ffprobe: Remove redundant checks Andreas Rheinhardt
@ 2022-02-22 22:49 ` Andreas Rheinhardt
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Rheinhardt @ 2022-02-22 22:49 UTC (permalink / raw)
  To: ffmpeg-devel

Andreas Rheinhardt:
> This is a prerequisite to continue using the decoder at all
> to decode the next interval (if any).
> This fixes a regression introduced in commit
> 2a88ebd096f3c748a2d99ed1b60b22879b3c567c and reported in ticket #8657.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> I wonder whether it would not be simpler to let users reuse a decoder
> after draining simply by sending new packets (without flushing).
> 
>  fftools/ffprobe.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> index 8a8e3de540..4205ddedda 100644
> --- a/fftools/ffprobe.c
> +++ b/fftools/ffprobe.c
> @@ -2730,8 +2730,11 @@ static int read_interval_packets(WriterContext *w, InputFile *ifile,
>      //Flush remaining frames that are cached in the decoder
>      for (i = 0; i < fmt_ctx->nb_streams; i++) {
>          pkt->stream_index = i;
> -        if (do_read_frames)
> +        if (do_read_frames) {
>              while (process_frame(w, ifile, frame, pkt, &(int){1}) > 0);
> +            if (ifile->streams[i].dec_ctx)
> +                avcodec_flush_buffers(ifile->streams[i].dec_ctx);
> +        }
>      }
>  
>  end:

Will apply tomorrow unless there are objections.

- Andreas
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-22 22:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-19 15:08 [FFmpeg-devel] [PATCH 1/2] fftools/ffprobe: Flush decoder after draining Andreas Rheinhardt
2022-02-19 15:09 ` [FFmpeg-devel] [PATCH 2/2] fftools/ffprobe: Remove redundant checks Andreas Rheinhardt
2022-02-22 22:49 ` [FFmpeg-devel] [PATCH 1/2] fftools/ffprobe: Flush decoder after draining Andreas Rheinhardt

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git