Commit 9a966770 authored by Andreas Rheinhardt's avatar Andreas Rheinhardt

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: 's avatarAnton Khirnov <anton@khirnov.net>
Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
parent ba36a077
...@@ -662,10 +662,8 @@ static int nsv_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -662,10 +662,8 @@ static int nsv_read_packet(AVFormatContext *s, AVPacket *pkt)
/* now pick one of the plates */ /* now pick one of the plates */
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
if (nsv->ahead[i].data) { if (nsv->ahead[i].data) {
/* avoid the cost of new_packet + memcpy(->data) */ av_packet_move_ref(pkt, &nsv->ahead[i]);
memcpy(pkt, &nsv->ahead[i], sizeof(AVPacket)); return 0;
nsv->ahead[i].data = NULL; /* we ate that one */
return pkt->size;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment