diff mbox

[FFmpeg-devel] Update decode_simple_internal() to get the side data correctly.

Message ID CAG4UmKtTpnGfsNw4V53bjsfh+hesYTpmkdeehSq6_Bv15FsH3Q@mail.gmail.com
State Superseded
Headers show

Commit Message

John Rummell June 15, 2017, 12:04 a.m. UTC
From 6418fc43b06cea4cf49e410d474ae92022c4dbd1 Mon Sep 17 00:00:00 2001
From: John Rummell <jrummell@chromium.org>
Date: Wed, 14 Jun 2017 14:43:04 -0700
Subject: [PATCH] Update decode_simple_internal() to get the side data
correctly.

When FF_API_MERGE_SD is set, the compressed side data is expanded into
|tmp|,
leaving the original |pkt| unchanged. So when retrieving side data, get it
from |tmp|. If the side data is not compressed, |tmp| is a copy of |pkt|
so the side data should be accessible from either.
---
 libavcodec/decode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

             avctx->internal->skip_samples = AV_RL32(side) *
avctx->internal->skip_samples_multiplier;
             discard_padding = AV_RL32(side + 4);

Comments

James Almer June 15, 2017, 9:53 p.m. UTC | #1
On 6/14/2017 9:04 PM, John Rummell wrote:
> From 6418fc43b06cea4cf49e410d474ae92022c4dbd1 Mon Sep 17 00:00:00 2001
> From: John Rummell <jrummell@chromium.org>
> Date: Wed, 14 Jun 2017 14:43:04 -0700
> Subject: [PATCH] Update decode_simple_internal() to get the side data
> correctly.
> 
> When FF_API_MERGE_SD is set, the compressed side data is expanded into
> |tmp|,
> leaving the original |pkt| unchanged. So when retrieving side data, get it
> from |tmp|. If the side data is not compressed, |tmp| is a copy of |pkt|
> so the side data should be accessible from either.
> ---
>  libavcodec/decode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index 584d9d6241..327fb8ccb7 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -462,7 +462,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
>                  frame->sample_rate = avctx->sample_rate;
>          }
> 
> -        side= av_packet_get_side_data(pkt, AV_PKT_DATA_SKIP_SAMPLES,
> &side_size);
> +        side= av_packet_get_side_data(&tmp, AV_PKT_DATA_SKIP_SAMPLES,
> &side_size);

Could you please test if using avci->last_pkt_props instead of &tmp also
works for you?

I'm the one that changed it from avci->last_pkt_props (which contains
packet properties, including side data, as taken from tmp post side data
splitting) to pkt two months ago, if i remember correctly because it
fixed a regression in some test, but I'm unable to reproduce anything if
i revert it right now.
James Almer June 20, 2017, 8:34 p.m. UTC | #2
On 6/20/2017 5:09 PM, John Rummell wrote:
> Using avci->last_pkt_props works. Chromium tests work, "make fate"
> passes. Updated patch:
> 
> From 0fd3c5c9abd3cea943b12f65f219d479b5949e4b Mon Sep 17 00:00:00 2001
> From: John Rummell <jrummell@chromium.org <mailto:jrummell@chromium.org>>
> Date: Wed, 14 Jun 2017 14:43:04 -0700
> Subject: [PATCH] Update decode_simple_internal() to get the side data
>  correctly.
> 
> Use avci->last_pkt_props to get the side data. Using |pkt| doesn't work
> when FF_API_MERGE_SD is set, as the compressed side data is expanded into
> |tmp|, leaving the original |pkt| unchanged.
> ---
>  libavcodec/decode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index 584d9d6241..f7dea930ed 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -462,7 +462,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
>                  frame->sample_rate = avctx->sample_rate;
>          }
>  
> -        side= av_packet_get_side_data(pkt, AV_PKT_DATA_SKIP_SAMPLES,
> &side_size);
> +        side= av_packet_get_side_data(avci->last_pkt_props,
> AV_PKT_DATA_SKIP_SAMPLES, &side_size);
>          if(side && side_size>=10) {
>              avctx->internal->skip_samples = AV_RL32(side) *
> avctx->internal->skip_samples_multiplier;
>              discard_padding = AV_RL32(side + 4);
> -- 
> 2.13.1.518.g3df882009-goog

Pushed, thanks.
diff mbox

Patch

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 584d9d6241..327fb8ccb7 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -462,7 +462,7 @@  FF_ENABLE_DEPRECATION_WARNINGS
                 frame->sample_rate = avctx->sample_rate;
         }

-        side= av_packet_get_side_data(pkt, AV_PKT_DATA_SKIP_SAMPLES,
&side_size);
+        side= av_packet_get_side_data(&tmp, AV_PKT_DATA_SKIP_SAMPLES,
&side_size);
         if(side && side_size>=10) {