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] avformat/rtpenc: Check dimensions during init
@ 2025-03-30 10:42 Andreas Rheinhardt
  2025-03-31  0:45 ` Michael Niedermayer
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Rheinhardt @ 2025-03-30 10:42 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

[-- Attachment #1: Type: text/plain, Size: 87 bytes --]

Obsoletes my earlier patch to fix the Wdeclaration-after-statement warning.

- Andreas

[-- Attachment #2: 0001-avformat-rtpenc-Check-dimensions-during-init.patch --]
[-- Type: text/x-patch, Size: 2025 bytes --]

From 46e1284d95407f1b757f23aedf59fb9332f48913 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sun, 30 Mar 2025 12:06:13 +0200
Subject: [PATCH] avformat/rtpenc: Check dimensions during init

Also fixes a -Wdeclaration-after-statement warning.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/rtpenc.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index 8b989dca71..b220a941a2 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -219,6 +219,14 @@ static int rtp_write_header(AVFormatContext *s1)
             s->nal_length_size = (st->codecpar->extradata[21] & 0x03) + 1;
         }
         break;
+    case AV_CODEC_ID_MJPEG:
+    case AV_CODEC_ID_BITPACKED:
+    case AV_CODEC_ID_RAWVIDEO:
+        if (st->codecpar->width <= 0 || st->codecpar->height <= 0) {
+            av_log(s1, AV_LOG_ERROR, "dimensions not set\n");
+            return AVERROR(EINVAL);
+        }
+        break;
     case AV_CODEC_ID_VP9:
         if (s1->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
             av_log(s, AV_LOG_ERROR,
@@ -635,18 +643,10 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
         rtp_send_ilbc(s1, pkt->data, size);
         break;
     case AV_CODEC_ID_MJPEG:
-        if (st->codecpar->width <= 0 || st->codecpar->height <= 0) {
-            av_log(s1, AV_LOG_ERROR, "dimensions not set\n");
-            return AVERROR(EINVAL);
-        }
         ff_rtp_send_jpeg(s1, pkt->data, size);
         break;
     case AV_CODEC_ID_BITPACKED:
     case AV_CODEC_ID_RAWVIDEO: {
-        if (st->codecpar->width <= 0 || st->codecpar->height <= 0) {
-            av_log(s1, AV_LOG_ERROR, "dimensions not set\n");
-            return AVERROR(EINVAL);
-        }
         int interlaced = st->codecpar->field_order != AV_FIELD_PROGRESSIVE;
 
         ff_rtp_send_raw_rfc4175(s1, pkt->data, size, interlaced, 0);
-- 
2.45.2


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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] 2+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/rtpenc: Check dimensions during init
  2025-03-30 10:42 [FFmpeg-devel] [PATCH] avformat/rtpenc: Check dimensions during init Andreas Rheinhardt
@ 2025-03-31  0:45 ` Michael Niedermayer
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Niedermayer @ 2025-03-31  0:45 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


[-- Attachment #1.1: Type: text/plain, Size: 1188 bytes --]

Hi Andreas

On Sun, Mar 30, 2025 at 12:42:38PM +0200, Andreas Rheinhardt wrote:
> Obsoletes my earlier patch to fix the Wdeclaration-after-statement warning.
> 
> - Andreas

>  rtpenc.c |   16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 16e728ea020e7f62b97032aa108cc281c7cd4d96  0001-avformat-rtpenc-Check-dimensions-during-init.patch
> From 46e1284d95407f1b757f23aedf59fb9332f48913 Mon Sep 17 00:00:00 2001
> From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> Date: Sun, 30 Mar 2025 12:06:13 +0200
> Subject: [PATCH] avformat/rtpenc: Check dimensions during init
> 
> Also fixes a -Wdeclaration-after-statement warning.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavformat/rtpenc.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)

LGTM

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If one takes all money from those who grow wealth and gives it to those who
do not grow wealth, 10 years later, almost the same people who where wealthy
will be wealthy again, the same people who where poor will be poor again.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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] 2+ messages in thread

end of thread, other threads:[~2025-03-31  0:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-30 10:42 [FFmpeg-devel] [PATCH] avformat/rtpenc: Check dimensions during init Andreas Rheinhardt
2025-03-31  0:45 ` Michael Niedermayer

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