Re: [FFmpeg-devel] [PATCH 08/10] lavf/matroskaenc: don't rewrite extradata if we already have some

2018-03-15 Thread Rodger Combs


> On Mar 15, 2018, at 17:36, James Almer  wrote:
> 
> On 3/14/2018 3:24 AM, Rodger Combs wrote:
>> matroska doesn't support mid-stream extradata changes
> 
> How so? We update flac extradata as sent by the encoder in the last
> packet as side data.

Right, but the format itself doesn't support changing mid-stream; we handle 
that case by rewriting the header.

> 
>> , and rewriting
>> the same extradata already written in write_header would cause errors
>> since we previously didn't write a filler void.
> 
> When would this happen? What sets both extradata in codecpar then sends
> new one as packet side data for AAC audio?

Happens after the subsequent patch ("lavf/mux: propagate extradata changes 
before we call write_header to codecpar").

> 
>> ---
>> libavformat/matroskaenc.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
>> index 5950b4de44..e4db5a9a1c 100644
>> --- a/libavformat/matroskaenc.c
>> +++ b/libavformat/matroskaenc.c
>> @@ -2266,7 +2266,8 @@ static int mkv_check_new_extra_data(AVFormatContext 
>> *s, AVPacket *pkt)
>> 
>> switch (par->codec_id) {
>> case AV_CODEC_ID_AAC:
>> -if (side_data_size && (s->pb->seekable & AVIO_SEEKABLE_NORMAL) && 
>> !mkv->is_live) {
>> +if (side_data_size && !par->extradata_size &&
>> +(s->pb->seekable & AVIO_SEEKABLE_NORMAL) && !mkv->is_live) {
>> int filler, output_sample_rate = 0;
>> int64_t curpos;
>> ret = get_aac_sample_rates(s, side_data, side_data_size, 
>> >sample_rate,
>> 
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org 
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel 
> 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 08/10] lavf/matroskaenc: don't rewrite extradata if we already have some

2018-03-15 Thread James Almer
On 3/14/2018 3:24 AM, Rodger Combs wrote:
> matroska doesn't support mid-stream extradata changes

How so? We update flac extradata as sent by the encoder in the last
packet as side data.

> , and rewriting
> the same extradata already written in write_header would cause errors
> since we previously didn't write a filler void.

When would this happen? What sets both extradata in codecpar then sends
new one as packet side data for AAC audio?

> ---
>  libavformat/matroskaenc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index 5950b4de44..e4db5a9a1c 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -2266,7 +2266,8 @@ static int mkv_check_new_extra_data(AVFormatContext *s, 
> AVPacket *pkt)
>  
>  switch (par->codec_id) {
>  case AV_CODEC_ID_AAC:
> -if (side_data_size && (s->pb->seekable & AVIO_SEEKABLE_NORMAL) && 
> !mkv->is_live) {
> +if (side_data_size && !par->extradata_size &&
> +(s->pb->seekable & AVIO_SEEKABLE_NORMAL) && !mkv->is_live) {
>  int filler, output_sample_rate = 0;
>  int64_t curpos;
>  ret = get_aac_sample_rates(s, side_data, side_data_size, 
> >sample_rate,
> 

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 08/10] lavf/matroskaenc: don't rewrite extradata if we already have some

2018-03-14 Thread Rodger Combs
matroska doesn't support mid-stream extradata changes, and rewriting
the same extradata already written in write_header would cause errors
since we previously didn't write a filler void.
---
 libavformat/matroskaenc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 5950b4de44..e4db5a9a1c 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2266,7 +2266,8 @@ static int mkv_check_new_extra_data(AVFormatContext *s, 
AVPacket *pkt)
 
 switch (par->codec_id) {
 case AV_CODEC_ID_AAC:
-if (side_data_size && (s->pb->seekable & AVIO_SEEKABLE_NORMAL) && 
!mkv->is_live) {
+if (side_data_size && !par->extradata_size &&
+(s->pb->seekable & AVIO_SEEKABLE_NORMAL) && !mkv->is_live) {
 int filler, output_sample_rate = 0;
 int64_t curpos;
 ret = get_aac_sample_rates(s, side_data, side_data_size, 
>sample_rate,
-- 
2.16.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel