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 v3 1/2] libavformat/oggparseflac: Decode metadata packets. Fixes: #10364
@ 2023-05-14 21:37 toots
  2023-05-14 21:37 ` [FFmpeg-devel] [PATCH v3 2/2] libavformat/oggparseopus: Clear existing stream metadata before parsing potentially new one. Fixes: #10363 toots
  2023-05-14 21:43 ` [FFmpeg-devel] [PATCH v3 1/2] libavformat/oggparseflac: Decode metadata packets. Fixes: #10364 Romain Beauxis
  0 siblings, 2 replies; 5+ messages in thread
From: toots @ 2023-05-14 21:37 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Romain Beauxis

From: Romain Beauxis <toots@rastageeks.org>

This is the third version on a series of patches improving ffmpeg support for
ogg chained streams.

Reproduction steps for the issue fixed with patch are included in this bug
report: https://trac.ffmpeg.org/ticket/10363

---
 libavformat/oggparseflac.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/libavformat/oggparseflac.c b/libavformat/oggparseflac.c
index eef6e09927..1dd292483d 100644
--- a/libavformat/oggparseflac.c
+++ b/libavformat/oggparseflac.c
@@ -126,10 +126,30 @@ fail:
     return ret;
 }
 
+static int flac_packet(AVFormatContext *s, int idx)
+{
+    struct ogg *ogg = s->priv_data;
+    struct ogg_stream *os = ogg->streams + idx;
+    int ret;
+
+    if (os->psize > 4 && (*(os->buf + os->pstart) & 0x7F) == FLAC_METADATA_TYPE_VORBIS_COMMENT) {
+        AVStream *st = s->streams[idx];
+        av_dict_free(&st->metadata);
+        ret = ff_vorbis_stream_comment(s, st, os->buf + os->pstart + 4,
+                                       os->psize - 4);
+
+        if (ret < 0) return ret;
+    }
+
+    return 0;
+}
+
+
 const struct ogg_codec ff_flac_codec = {
     .magic = "\177FLAC",
     .magicsize = 5,
     .header = flac_header,
+    .packet = flac_packet,
     .nb_header = 2,
 };
 
-- 
2.37.1 (Apple Git-137.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".

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

* [FFmpeg-devel] [PATCH v3 2/2] libavformat/oggparseopus: Clear existing stream metadata before parsing potentially new one. Fixes: #10363
  2023-05-14 21:37 [FFmpeg-devel] [PATCH v3 1/2] libavformat/oggparseflac: Decode metadata packets. Fixes: #10364 toots
@ 2023-05-14 21:37 ` toots
  2023-05-19  0:50   ` Romain Beauxis
  2023-05-14 21:43 ` [FFmpeg-devel] [PATCH v3 1/2] libavformat/oggparseflac: Decode metadata packets. Fixes: #10364 Romain Beauxis
  1 sibling, 1 reply; 5+ messages in thread
From: toots @ 2023-05-14 21:37 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Romain Beauxis

From: Romain Beauxis <toots@rastageeks.org>

This is the third version of a series of patches improving metadata support in
chained ogg streams.

Previous versions of this patch were including changes that were later
identified as issues from another encoded and fixed there. See:
https://github.com/savonet/liquidsoap/pull/3062

The remaining changes address a memory leak in chained ogg/opus stream
metadata. Reproduction steps for the issue are detailed in:
https://trac.ffmpeg.org/ticket/10363

---
 libavformat/oggparseopus.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/oggparseopus.c b/libavformat/oggparseopus.c
index 54aa725be6..86977b41db 100644
--- a/libavformat/oggparseopus.c
+++ b/libavformat/oggparseopus.c
@@ -80,6 +80,7 @@ static int opus_header(AVFormatContext *avf, int idx)
     if (priv->need_comments) {
         if (os->psize < 8 || memcmp(packet, "OpusTags", 8))
             return AVERROR_INVALIDDATA;
+        av_dict_free(&st->metadata);
         ff_vorbis_stream_comment(avf, st, packet + 8, os->psize - 8);
         priv->need_comments--;
         return 1;
-- 
2.37.1 (Apple Git-137.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".

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

* Re: [FFmpeg-devel] [PATCH v3 1/2] libavformat/oggparseflac: Decode metadata packets. Fixes: #10364
  2023-05-14 21:37 [FFmpeg-devel] [PATCH v3 1/2] libavformat/oggparseflac: Decode metadata packets. Fixes: #10364 toots
  2023-05-14 21:37 ` [FFmpeg-devel] [PATCH v3 2/2] libavformat/oggparseopus: Clear existing stream metadata before parsing potentially new one. Fixes: #10363 toots
@ 2023-05-14 21:43 ` Romain Beauxis
  1 sibling, 0 replies; 5+ messages in thread
From: Romain Beauxis @ 2023-05-14 21:43 UTC (permalink / raw)
  To: ffmpeg-devel

Le dim. 14 mai 2023 à 16:40, <toots@rastageeks.org> a écrit :
>
> From: Romain Beauxis <toots@rastageeks.org>
>
> This is the third version on a series of patches improving ffmpeg support for
> ogg chained streams.
>
> Reproduction steps for the issue fixed with patch are included in this bug
> report: https://trac.ffmpeg.org/ticket/10363

Sorry correct link is: https://trac.ffmpeg.org/ticket/10364

>
> ---
>  libavformat/oggparseflac.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
>
> diff --git a/libavformat/oggparseflac.c b/libavformat/oggparseflac.c
> index eef6e09927..1dd292483d 100644
> --- a/libavformat/oggparseflac.c
> +++ b/libavformat/oggparseflac.c
> @@ -126,10 +126,30 @@ fail:
>      return ret;
>  }
>
> +static int flac_packet(AVFormatContext *s, int idx)
> +{
> +    struct ogg *ogg = s->priv_data;
> +    struct ogg_stream *os = ogg->streams + idx;
> +    int ret;
> +
> +    if (os->psize > 4 && (*(os->buf + os->pstart) & 0x7F) == FLAC_METADATA_TYPE_VORBIS_COMMENT) {
> +        AVStream *st = s->streams[idx];
> +        av_dict_free(&st->metadata);
> +        ret = ff_vorbis_stream_comment(s, st, os->buf + os->pstart + 4,
> +                                       os->psize - 4);
> +
> +        if (ret < 0) return ret;
> +    }
> +
> +    return 0;
> +}
> +
> +
>  const struct ogg_codec ff_flac_codec = {
>      .magic = "\177FLAC",
>      .magicsize = 5,
>      .header = flac_header,
> +    .packet = flac_packet,
>      .nb_header = 2,
>  };
>
> --
> 2.37.1 (Apple Git-137.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".

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

* Re: [FFmpeg-devel] [PATCH v3 2/2] libavformat/oggparseopus: Clear existing stream metadata before parsing potentially new one. Fixes: #10363
  2023-05-14 21:37 ` [FFmpeg-devel] [PATCH v3 2/2] libavformat/oggparseopus: Clear existing stream metadata before parsing potentially new one. Fixes: #10363 toots
@ 2023-05-19  0:50   ` Romain Beauxis
  2023-09-11 10:05     ` Paul B Mahol
  0 siblings, 1 reply; 5+ messages in thread
From: Romain Beauxis @ 2023-05-19  0:50 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Rostislav Pehlivanov

Hello again!

I wanted to see if there was any interest in this patch and the other one
adding metadata decoding for chained ogg bitstream. These two feel like
easy bugfixes and features to add to the next release.

Reproduction steps for this one are detailed here:
https://trac.ffmpeg.org/ticket/10363

-- Romain

Le dim. 14 mai 2023 à 16:42, <toots@rastageeks.org> a écrit :

> From: Romain Beauxis <toots@rastageeks.org>
>
> This is the third version of a series of patches improving metadata
> support in
> chained ogg streams.
>
> Previous versions of this patch were including changes that were later
> identified as issues from another encoded and fixed there. See:
> https://github.com/savonet/liquidsoap/pull/3062
>
> The remaining changes address a memory leak in chained ogg/opus stream
> metadata. Reproduction steps for the issue are detailed in:
> https://trac.ffmpeg.org/ticket/10363
>
> ---
>  libavformat/oggparseopus.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libavformat/oggparseopus.c b/libavformat/oggparseopus.c
> index 54aa725be6..86977b41db 100644
> --- a/libavformat/oggparseopus.c
> +++ b/libavformat/oggparseopus.c
> @@ -80,6 +80,7 @@ static int opus_header(AVFormatContext *avf, int idx)
>      if (priv->need_comments) {
>          if (os->psize < 8 || memcmp(packet, "OpusTags", 8))
>              return AVERROR_INVALIDDATA;
> +        av_dict_free(&st->metadata);
>          ff_vorbis_stream_comment(avf, st, packet + 8, os->psize - 8);
>          priv->need_comments--;
>          return 1;
> --
> 2.37.1 (Apple Git-137.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".

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

* Re: [FFmpeg-devel] [PATCH v3 2/2] libavformat/oggparseopus: Clear existing stream metadata before parsing potentially new one. Fixes: #10363
  2023-05-19  0:50   ` Romain Beauxis
@ 2023-09-11 10:05     ` Paul B Mahol
  0 siblings, 0 replies; 5+ messages in thread
From: Paul B Mahol @ 2023-09-11 10:05 UTC (permalink / raw)
  To: FFmpeg development discussions and patches, toots

Is this real leak as reported by valgrind or similar?
_______________________________________________
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] 5+ messages in thread

end of thread, other threads:[~2023-09-11  9:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-14 21:37 [FFmpeg-devel] [PATCH v3 1/2] libavformat/oggparseflac: Decode metadata packets. Fixes: #10364 toots
2023-05-14 21:37 ` [FFmpeg-devel] [PATCH v3 2/2] libavformat/oggparseopus: Clear existing stream metadata before parsing potentially new one. Fixes: #10363 toots
2023-05-19  0:50   ` Romain Beauxis
2023-09-11 10:05     ` Paul B Mahol
2023-05-14 21:43 ` [FFmpeg-devel] [PATCH v3 1/2] libavformat/oggparseflac: Decode metadata packets. Fixes: #10364 Romain Beauxis

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