diff mbox

[FFmpeg-devel] avformat/matroskadec: ignore CodecPrivate if the stream is VP9

Message ID 20180217023523.4920-1-jamrial@gmail.com
State Accepted
Commit acdea9e7c56b74b05c56b4733acc855b959ba073
Headers show

Commit Message

James Almer Feb. 17, 2018, 2:35 a.m. UTC
Defined in a recent revision of https://www.webmproject.org/docs/container/

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/matroskadec.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

James Almer Feb. 19, 2018, 2:19 p.m. UTC | #1
On 2/16/2018 11:35 PM, James Almer wrote:
> Defined in a recent revision of https://www.webmproject.org/docs/container/
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavformat/matroskadec.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> index cda8df2213..edc4f5d476 100644
> --- a/libavformat/matroskadec.c
> +++ b/libavformat/matroskadec.c
> @@ -2397,6 +2397,10 @@ static int matroska_parse_tracks(AVFormatContext *s)
>                  return ret;
>          } else if (codec_id == AV_CODEC_ID_PRORES && track->codec_priv.size == 4) {
>              fourcc = AV_RL32(track->codec_priv.data);
> +        } else if (codec_id == AV_CODEC_ID_VP9 && track->codec_priv.size) {
> +            /* we don't need any value stored in CodecPrivate.
> +               make sure that it's not exported as extradata. */
> +            track->codec_priv.size = 0;
>          }
>          track->codec_priv.size -= extradata_offset;

Ping. Will apply soon.
Carl Eugen Hoyos Feb. 19, 2018, 2:37 p.m. UTC | #2
2018-02-17 3:35 GMT+01:00 James Almer <jamrial@gmail.com>:
> Defined in a recent revision of https://www.webmproject.org/docs/container/
>
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavformat/matroskadec.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> index cda8df2213..edc4f5d476 100644
> --- a/libavformat/matroskadec.c
> +++ b/libavformat/matroskadec.c
> @@ -2397,6 +2397,10 @@ static int matroska_parse_tracks(AVFormatContext *s)
>                  return ret;
>          } else if (codec_id == AV_CODEC_ID_PRORES && track->codec_priv.size == 4) {
>              fourcc = AV_RL32(track->codec_priv.data);
> +        } else if (codec_id == AV_CODEC_ID_VP9 && track->codec_priv.size) {
> +            /* we don't need any value stored in CodecPrivate.
> +               make sure that it's not exported as extradata. */
> +            track->codec_priv.size = 0;

You could add information about what this patch fixes to
the commit message.

Carl Eugen
James Almer Feb. 19, 2018, 4:09 p.m. UTC | #3
On 2/19/2018 11:37 AM, Carl Eugen Hoyos wrote:
> 2018-02-17 3:35 GMT+01:00 James Almer <jamrial@gmail.com>:
>> Defined in a recent revision of https://www.webmproject.org/docs/container/
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>  libavformat/matroskadec.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
>> index cda8df2213..edc4f5d476 100644
>> --- a/libavformat/matroskadec.c
>> +++ b/libavformat/matroskadec.c
>> @@ -2397,6 +2397,10 @@ static int matroska_parse_tracks(AVFormatContext *s)
>>                  return ret;
>>          } else if (codec_id == AV_CODEC_ID_PRORES && track->codec_priv.size == 4) {
>>              fourcc = AV_RL32(track->codec_priv.data);
>> +        } else if (codec_id == AV_CODEC_ID_VP9 && track->codec_priv.size) {
>> +            /* we don't need any value stored in CodecPrivate.
>> +               make sure that it's not exported as extradata. */
>> +            track->codec_priv.size = 0;
> 
> You could add information about what this patch fixes to
> the commit message.
> 
> Carl Eugen

It prevents loading the contents of CodecPrivate into extradata for a
codec that doesn't need nor expect any. It will among other things
prevent said matroska specific binary data from being dumped onto other
formats during remuxing.
I'll add a line explaining the above to the commit message before pushing.
James Almer Feb. 20, 2018, 1:15 a.m. UTC | #4
On 2/19/2018 1:09 PM, James Almer wrote:
> On 2/19/2018 11:37 AM, Carl Eugen Hoyos wrote:
>> 2018-02-17 3:35 GMT+01:00 James Almer <jamrial@gmail.com>:
>>> Defined in a recent revision of https://www.webmproject.org/docs/container/
>>>
>>> Signed-off-by: James Almer <jamrial@gmail.com>
>>> ---
>>>  libavformat/matroskadec.c | 4 ++++
>>>  1 file changed, 4 insertions(+)
>>>
>>> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
>>> index cda8df2213..edc4f5d476 100644
>>> --- a/libavformat/matroskadec.c
>>> +++ b/libavformat/matroskadec.c
>>> @@ -2397,6 +2397,10 @@ static int matroska_parse_tracks(AVFormatContext *s)
>>>                  return ret;
>>>          } else if (codec_id == AV_CODEC_ID_PRORES && track->codec_priv.size == 4) {
>>>              fourcc = AV_RL32(track->codec_priv.data);
>>> +        } else if (codec_id == AV_CODEC_ID_VP9 && track->codec_priv.size) {
>>> +            /* we don't need any value stored in CodecPrivate.
>>> +               make sure that it's not exported as extradata. */
>>> +            track->codec_priv.size = 0;
>>
>> You could add information about what this patch fixes to
>> the commit message.
>>
>> Carl Eugen
> 
> It prevents loading the contents of CodecPrivate into extradata for a
> codec that doesn't need nor expect any. It will among other things
> prevent said matroska specific binary data from being dumped onto other
> formats during remuxing.
> I'll add a line explaining the above to the commit message before pushing.

Added and pushed. Thanks.
diff mbox

Patch

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index cda8df2213..edc4f5d476 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2397,6 +2397,10 @@  static int matroska_parse_tracks(AVFormatContext *s)
                 return ret;
         } else if (codec_id == AV_CODEC_ID_PRORES && track->codec_priv.size == 4) {
             fourcc = AV_RL32(track->codec_priv.data);
+        } else if (codec_id == AV_CODEC_ID_VP9 && track->codec_priv.size) {
+            /* we don't need any value stored in CodecPrivate.
+               make sure that it's not exported as extradata. */
+            track->codec_priv.size = 0;
         }
         track->codec_priv.size -= extradata_offset;