diff mbox

[FFmpeg-devel,v1,3/3] avformat/movenc: replace the deprecated av_copy_packet_side_data

Message ID 20190904152712.23850-3-lance.lmwang@gmail.com
State New
Headers show

Commit Message

Lance Wang Sept. 4, 2019, 3:27 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavformat/movenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

James Almer Sept. 4, 2019, 3:36 p.m. UTC | #1
On 9/4/2019 12:27 PM, lance.lmwang@gmail.com wrote:
> From: Limin Wang <lance.lmwang@gmail.com>
> 
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
>  libavformat/movenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index edddfee..503f099 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -518,7 +518,7 @@ concatenate:
>          memcpy(info->pkt.data + info->pkt.size - pkt->size, pkt->data, pkt->size);
>          info->num_blocks += num_blocks;
>          info->pkt.duration += pkt->duration;
> -        if ((ret = av_copy_packet_side_data(&info->pkt, pkt)) < 0)
> +        if ((ret = av_packet_copy_props(&info->pkt, pkt)) < 0)

av_packet_copy_props() will overwrite almost every info->pkt field,
which in this case will result in lost information. Just look at the
line above accumulating packet durations before this call.

I don't know what could be the cleanest solution for this. I suggested
adding a replacement for av_copy_packet_side_data() using the
av_packet_* namespace, but the idea was rejected.

>              goto end;
>          if (info->num_blocks != 6)
>              goto end;
>
Lance Wang Sept. 4, 2019, 10:58 p.m. UTC | #2
On Wed, Sep 04, 2019 at 12:36:16PM -0300, James Almer wrote:
> On 9/4/2019 12:27 PM, lance.lmwang@gmail.com wrote:
> > From: Limin Wang <lance.lmwang@gmail.com>
> > 
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> >  libavformat/movenc.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> > index edddfee..503f099 100644
> > --- a/libavformat/movenc.c
> > +++ b/libavformat/movenc.c
> > @@ -518,7 +518,7 @@ concatenate:
> >          memcpy(info->pkt.data + info->pkt.size - pkt->size, pkt->data, pkt->size);
> >          info->num_blocks += num_blocks;
> >          info->pkt.duration += pkt->duration;
> > -        if ((ret = av_copy_packet_side_data(&info->pkt, pkt)) < 0)
> > +        if ((ret = av_packet_copy_props(&info->pkt, pkt)) < 0)
> 
> av_packet_copy_props() will overwrite almost every info->pkt field,
> which in this case will result in lost information. Just look at the
> line above accumulating packet durations before this call.
> 
> I don't know what could be the cleanest solution for this. I suggested
> adding a replacement for av_copy_packet_side_data() using the
> av_packet_* namespace, but the idea was rejected.
I want to use the av_copy_packet_side_data() in other place, however it's deprecated.
By the log, it recomment to use av_packet_copy_props, but the function isn't replacement. 
Or if add av_packet_copy_side_data() to replace, why it's rejected? 

> 
> >              goto end;
> >          if (info->num_blocks != 6)
> >              goto end;
> > 
> 
> _______________________________________________
> 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".
diff mbox

Patch

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index edddfee..503f099 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -518,7 +518,7 @@  concatenate:
         memcpy(info->pkt.data + info->pkt.size - pkt->size, pkt->data, pkt->size);
         info->num_blocks += num_blocks;
         info->pkt.duration += pkt->duration;
-        if ((ret = av_copy_packet_side_data(&info->pkt, pkt)) < 0)
+        if ((ret = av_packet_copy_props(&info->pkt, pkt)) < 0)
             goto end;
         if (info->num_blocks != 6)
             goto end;