提交 9051092e 编写于 作者: J Jacob Siddall 提交者: Michael Niedermayer

avformat/rtpdec_rfc4175: Fix incorrect copy_offset calculation

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: NJacob Siddall <kobe@live.com.au>
Signed-off-by: NMichael Niedermayer <michael@niedermayer.cc>
上级 f12e662a
......@@ -205,8 +205,11 @@ static int rfc4175_handle_packet(AVFormatContext *ctx, PayloadContext *data,
if (length > payload_len)
length = payload_len;
if (line < 1)
return AVERROR_INVALIDDATA;
/* 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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册