diff mbox

[FFmpeg-devel] avformat/rtpdec_rfc4175: Fix incorrect copy_offset calculation

Message ID DM6PR14MB2633A544A1FB7F0C073FE8E59AE70@DM6PR14MB2633.namprd14.prod.outlook.com
State Superseded
Headers show

Commit Message

Jacob Siddall June 21, 2019, 5:55 a.m. UTC
> doesnt apply with git

 >
 > Applying: avformat/rtpdec_rfc4175: Fix incorrect copy_offset calculation
 > Using index info to reconstruct a base tree...
 > error: patch failed: libavformat/rtpdec_rfc4175.c:206
 > error: libavformat/rtpdec_rfc4175.c: patch does not apply
 > error: Did you hand edit your patch?
 > It does not apply to blobs recorded in its index.
 > Patch failed at 0001 avformat/rtpdec_rfc4175: Fix incorrect 
copy_offset calculation

The patch successfully applies for me.
A few of my friends have tried and they also had success.

The steps I tried were:
    1. Cloned a fresh copy of the ffmpeg repository (and checked out master)
    2. Downloaded the mbox file from patchwork
    3. Applied the patch file using "git am <patch file>.patch"

I also tried the above steps with a plain text copy of my patch email
and that worked too.

Other than that, I'm not really sure what else to do.

I've attached the plain text copy of my patch email to this email.

Let me know if there's anything else I can do to help.

Regards,
Jacob
Subject: [PATCH] avformat/rtpdec_rfc4175: Fix incorrect copy_offset calculation
From: Jacob Siddall <kobe@live.com.au>
Date: 20/6/19, 2:21 pm
To: ffmpeg-devel@ffmpeg.org
CC: Jacob Siddall <kobe@live.com.au>

The previous calculation code did not account for the fact that the
copy_offset for the start of the frame array is at index 0, yet the
scan line number from the rfc4175 RTP header starts at 1.
This caused 2 issues to appear:
- The first scan line was being copied into the array where the second
  scan line should be. This caused the resulting video to have a green
  line at the top of it.
- Since the packet containing the last scan line would fail the
  calculation, the packet with the RTP marker would not be processed
  which caused a log message saying "Missed previous RTP marker" to be
  outputted for each frame.

Signed-off-by: Jacob Siddall <kobe@live.com.au>
---
 libavformat/rtpdec_rfc4175.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 2.20.1

Comments

Michael Niedermayer June 22, 2019, 8:20 a.m. UTC | #1
On Fri, Jun 21, 2019 at 05:55:23AM +0000, Jacob Siddall wrote:
>  > doesnt apply with git
> 
>  >
>  > Applying: avformat/rtpdec_rfc4175: Fix incorrect copy_offset calculation
>  > Using index info to reconstruct a base tree...
>  > error: patch failed: libavformat/rtpdec_rfc4175.c:206
>  > error: libavformat/rtpdec_rfc4175.c: patch does not apply
>  > error: Did you hand edit your patch?
>  > It does not apply to blobs recorded in its index.
>  > Patch failed at 0001 avformat/rtpdec_rfc4175: Fix incorrect 
> copy_offset calculation
> 
> The patch successfully applies for me.
> A few of my friends have tried and they also had success.
> 
> The steps I tried were:
>     1. Cloned a fresh copy of the ffmpeg repository (and checked out master)
>     2. Downloaded the mbox file from patchwork
>     3. Applied the patch file using "git am <patch file>.patch"
> 
> I also tried the above steps with a plain text copy of my patch email
> and that worked too.
> 
> Other than that, I'm not really sure what else to do.
> 
> I've attached the plain text copy of my patch email to this email.
> 
> Let me know if there's anything else I can do to help.
> 
> Regards,
> Jacob

> Subject: [PATCH] avformat/rtpdec_rfc4175: Fix incorrect copy_offset calculation
> From: Jacob Siddall <kobe@live.com.au>
> Date: 20/6/19, 2:21 pm
> To: ffmpeg-devel@ffmpeg.org
> CC: Jacob Siddall <kobe@live.com.au>
> 
> The previous calculation code did not account for the fact that the
> copy_offset for the start of the frame array is at index 0, yet the
> scan line number from the rfc4175 RTP header starts at 1.
> This caused 2 issues to appear:
> - The first scan line was being copied into the array where the second
>   scan line should be. This caused the resulting video to have a green
>   line at the top of it.
> - Since the packet containing the last scan line would fail the
>   calculation, the packet with the RTP marker would not be processed
>   which caused a log message saying "Missed previous RTP marker" to be
>   outputted for each frame.
> 
> Signed-off-by: Jacob Siddall <kobe@live.com.au>
> ---
>  libavformat/rtpdec_rfc4175.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c
> index e9c62c1..ec838fe 100644
> --- a/libavformat/rtpdec_rfc4175.c
> +++ b/libavformat/rtpdec_rfc4175.c
> @@ -206,7 +206,7 @@ static int rfc4175_handle_packet(AVFormatContext *ctx, PayloadContext *data,
>              length = payload_len;
>  
>          /* prevent ill-formed packets to write after buffer's end */
> -        copy_offset = (line * data->width + offset) * data->pgroup / data->xinc;
> +        copy_offset = ((line - 1) * data->width + offset) * data->pgroup / data->xinc;

what happens if line is 0 or is this somehow prevented ?

thx

[...]
diff mbox

Patch

diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c
index e9c62c1..ec838fe 100644
--- a/libavformat/rtpdec_rfc4175.c
+++ b/libavformat/rtpdec_rfc4175.c
@@ -206,7 +206,7 @@  static int rfc4175_handle_packet(AVFormatContext *ctx, PayloadContext *data,
             length = payload_len;
 
         /* prevent ill-formed packets to write after buffer's end */
-        copy_offset = (line * data->width + offset) * data->pgroup / data->xinc;
+        copy_offset = ((line - 1) * data->width + offset) * data->pgroup / data->xinc;
         if (copy_offset + length > data->frame_size)
             return AVERROR_INVALIDDATA;