1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avformat/nsvdec: Use av_packet_move_ref() for packet ownership transfer

Also simply return 0 in case a packet has been successfully read.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2020-03-21 08:57:19 +01:00
parent ba36a07734
commit 9a96677023

View File

@ -662,10 +662,8 @@ static int nsv_read_packet(AVFormatContext *s, AVPacket *pkt)
/* now pick one of the plates */
for (i = 0; i < 2; i++) {
if (nsv->ahead[i].data) {
/* avoid the cost of new_packet + memcpy(->data) */
memcpy(pkt, &nsv->ahead[i], sizeof(AVPacket));
nsv->ahead[i].data = NULL; /* we ate that one */
return pkt->size;
av_packet_move_ref(pkt, &nsv->ahead[i]);
return 0;
}
}