[FFmpeg-devel] [PATCH] hls: call avformat_find_stream_info for mpegts subdemuxer

Anssi Hannula anssi.hannula at iki.fi
Thu Nov 3 12:18:16 EET 2016


Hi,

Andreas Cadhalpun kirjoitti 2016-11-03 02:12:
> This fixes probing dts/eac3/mp2 in hls.
> 
> The problem was introduced in commit 
> 04964ac311abe670fb3b60290a330f2067544b13.
> 
> Also update the fate reference for the fate-segment-mp4-to-ts test.

Thanks.

Can you point me to some example streams with this issue? (or how to 
generate one)

Unfortunately calling avformat_find_stream_info() for sub-mpegts streams 
is quite bandwidth-heavy (especially if there are many stream variants 
and/or alternative renditions, and especially now that we no longer 
clear mpegts AVFMTCTX_NOHEADER flag so that streams like #4930 work) so 
I tried to avoid that.
It is better than doing nothing, though, if we can't find an alternative 
solution (better slow than not working).

I'd first like to try to understand what is happening, though.



> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> ---
> 
> I've no idea why the fate reference changes, but this also happens when
> partially/fully reverting commit 
> 04964ac311abe670fb3b60290a330f2067544b13.
> And it's a very recent fate test...
> 
> ---
>  libavformat/hls.c                |  2 +-
>  tests/ref/fate/segment-mp4-to-ts | 77 
> +++++++++++++++++++++++++---------------
>  2 files changed, 50 insertions(+), 29 deletions(-)
> 
> diff --git a/libavformat/hls.c b/libavformat/hls.c
> index 3c09dd8..543e65c 100644
> --- a/libavformat/hls.c
> +++ b/libavformat/hls.c
> @@ -1756,7 +1756,7 @@ static int hls_read_header(AVFormatContext *s)
>           * but for other streams we can rely on our user calling
> avformat_find_stream_info()
>           * on us if they want to.
>           */
> -        if (pls->is_id3_timestamped) {
> +        if (pls->is_id3_timestamped || av_match_name(in_fmt->name, 
> "mpegts")) {
>              ret = avformat_find_stream_info(pls->ctx, NULL);
>              if (ret < 0)
>                  goto fail;
> diff --git a/tests/ref/fate/segment-mp4-to-ts 
> b/tests/ref/fate/segment-mp4-to-ts
> index 8513027..acb1199 100644
> --- a/tests/ref/fate/segment-mp4-to-ts
> +++ b/tests/ref/fate/segment-mp4-to-ts
> @@ -5,34 +5,55 @@
>  #dimensions 0: 640x360
>  #sar 0: 1/1
>  0,      -7200,          0,        0,    22630, 0x9b109541, S=1,
>  1, 0x00e000e0
> -0,      -3600,      14400,        0,     4021, 0xbf7cdb02, F=0x0,
> S=1,        1, 0x00e000e0
> -0,          0,       7200,        0,     1096, 0x4f162690, F=0x0,
> S=1,        1, 0x00e000e0
> -0,       3600,       3600,        0,      687, 0x00394b95, F=0x0,
> S=1,        1, 0x00e000e0
> -0,       7200,      10800,        0,      445, 0x08c3d065, F=0x0,
> S=1,        1, 0x00e000e0
> -0,      10800,      28800,        0,     4212, 0x56d12b8f, F=0x0,
> S=1,        1, 0x00e000e0
> -0,      14400,      21600,        0,     1117, 0xd521260b, F=0x0,
> S=1,        1, 0x00e000e0
> -0,      18000,      18000,        0,      892, 0x4262bdbc, F=0x0,
> S=1,        1, 0x00e000e0
> -0,      21600,      25200,        0,      480, 0x3be1ef0b, F=0x0,
> S=1,        1, 0x00e000e0
> -0,      25200,      43200,        0,     4065, 0x40dee237, F=0x0,
> S=1,        1, 0x00e000e0
> -0,      28800,      36000,        0,      962, 0x31a4ceb1, F=0x0,
> S=1,        1, 0x00e000e0
> -0,      32400,      32400,        0,      651, 0xb2aa317a, F=0x0,
> S=1,        1, 0x00e000e0
> -0,      36000,      39600,        0,      543, 0x9c4e0024, F=0x0,
> S=1,        1, 0x00e000e0
> -0,      39600,      57600,        0,     4221, 0x77c23977, F=0x0,
> S=1,        1, 0x00e000e0
> -0,      43200,      50400,        0,     1040, 0x482cfa34, F=0x0,
> S=1,        1, 0x00e000e0
> -0,      46800,      46800,        0,      576, 0x2686136a, F=0x0,
> S=1,        1, 0x00e000e0
> -0,      50400,      54000,        0,      607, 0xc53c2339, F=0x0,
> S=1,        1, 0x00e000e0
> -0,      54000,      72000,        0,     4755, 0x2f642b58, F=0x0,
> S=1,        1, 0x00e000e0
> -0,      57600,      64800,        0,     1182, 0xbe1a4847, F=0x0,
> S=1,        1, 0x00e000e0
> -0,      61200,      61200,        0,      809, 0x8d948a4e, F=0x0,
> S=1,        1, 0x00e000e0
> -0,      64800,      68400,        0,      656, 0x4fa03c2b, F=0x0,
> S=1,        1, 0x00e000e0
> -0,      68400,      86400,        0,    26555, 0x5629b584, S=1,
>  1, 0x00e000e0
> -0,      72000,      79200,        0,     1141, 0x761b31e8, F=0x0,
> S=1,        1, 0x00e000e0
> -0,      75600,      75600,        0,      717, 0x57746351, F=0x0,
> S=1,        1, 0x00e000e0
> -0,      79200,      82800,        0,      693, 0x78b24263, F=0x0,
> S=1,        1, 0x00e000e0
> -0,      82800,     100800,        0,     3417, 0x560dbc89, F=0x0,
> S=1,        1, 0x00e000e0
> -0,      86400,      93600,        0,     1128, 0xc0f1383c, F=0x0,
> S=1,        1, 0x00e000e0
> -0,      90000,      90000,        0,      650, 0xc3ad485e, F=0x0,
> S=1,        1, 0x00e000e0
> -0,      93600,      97200,        0,      766, 0xd3e9757d, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      -3600,      14400,     3600,     4021, 0xbf7cdb02, F=0x0,
> S=1,        1, 0x00e000e0
> +0,          0,       7200,     3600,     1096, 0x4f162690, F=0x0,
> S=1,        1, 0x00e000e0
> +0,       3600,       3600,     3600,      687, 0x00394b95, F=0x0,
> S=1,        1, 0x00e000e0
> +0,       7200,      10800,     3600,      445, 0x08c3d065, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      10800,      28800,     3600,     4212, 0x56d12b8f, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      14400,      21600,     3600,     1117, 0xd521260b, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      18000,      18000,     3600,      892, 0x4262bdbc, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      21600,      25200,     3600,      480, 0x3be1ef0b, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      25200,      43200,     3600,     4065, 0x40dee237, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      28800,      36000,     3600,      962, 0x31a4ceb1, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      32400,      32400,     3600,      651, 0xb2aa317a, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      36000,      39600,     3600,      543, 0x9c4e0024, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      39600,      57600,     3600,     4221, 0x77c23977, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      43200,      50400,     3600,     1040, 0x482cfa34, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      46800,      46800,     3600,      576, 0x2686136a, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      50400,      54000,     3600,      607, 0xc53c2339, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      54000,      72000,     3600,     4755, 0x2f642b58, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      57600,      64800,     3600,     1182, 0xbe1a4847, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      61200,      61200,     3600,      809, 0x8d948a4e, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      64800,      68400,     3600,      656, 0x4fa03c2b, F=0x0
> +0,      64800,      64800,     3600,    22630, 0x9b109541, S=1,
>  1, 0x00e000e0
> +0,      64800,      64800,     3600,     4021, 0xbf7cdb02, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      64800,      64800,     3600,     1096, 0x4f162690, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      64800,      64800,     3600,      687, 0x00394b95, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      64800,      64800,     3600,      445, 0x08c3d065, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      64800,      64800,     3600,     4212, 0x56d12b8f, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      64800,      64800,     3600,     1117, 0xd521260b, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      64800,      64800,     3600,      892, 0x4262bdbc, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      64800,      64800,     3600,      480, 0x3be1ef0b, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      64800,      64800,     3600,     4065, 0x40dee237, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      64800,      64800,     3600,      962, 0x31a4ceb1, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      64800,      64800,     3600,      651, 0xb2aa317a, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      64800,      64800,     3600,      543, 0x9c4e0024, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      64800,      64800,     3600,     4221, 0x77c23977, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      64800,      64800,     3600,     1040, 0x482cfa34, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      64800,      64800,     3600,      576, 0x2686136a, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      64800,      64800,     3600,      607, 0xc53c2339, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      64800,      72000,     3600,     4755, 0x2f642b58, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      64800,      64800,     3600,     1182, 0xbe1a4847, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      64800,      64800,     3600,      809, 0x8d948a4e, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      64800,      68400,     3600,      656, 0x4fa03c2b, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      68400,      86400,     3600,    26555, 0x5629b584, S=1,
>  1, 0x00e000e0
> +0,      72000,      79200,     3600,     1141, 0x761b31e8, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      75600,      75600,     3600,      717, 0x57746351, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      79200,      82800,     3600,      693, 0x78b24263, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      82800,     100800,     3600,     3417, 0x560dbc89, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      86400,      93600,     3600,     1128, 0xc0f1383c, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      90000,      90000,     3600,      650, 0xc3ad485e, F=0x0,
> S=1,        1, 0x00e000e0
> +0,      93600,      97200,     3600,      766, 0xd3e9757d, F=0x0,
> S=1,        1, 0x00e000e0
>  0,      97200,     115200,     3600,     4268, 0xec1235b5, F=0x0,
> S=1,        1, 0x00e000e0
>  0,     100800,     108000,     3600,     1119, 0x65f51fb7, F=0x0,
> S=1,        1, 0x00e000e0
>  0,     104400,     104400,     3600,      766, 0x213b78d3, F=0x0,
> S=1,        1, 0x00e000e0

-- 
Anssi Hannula



More information about the ffmpeg-devel mailing list