diff mbox

[FFmpeg-devel,01/11] avformat/matroskaenc: don't reserve space for stream duration tags if the output is not seekable

Message ID 20161003233707.3624-2-jamrial@gmail.com
State Accepted
Commit b33369b6128a7c99fa7fa4686712ce8b8b5fef05
Headers show

Commit Message

James Almer Oct. 3, 2016, 11:36 p.m. UTC
The durations are never written in that situation.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/matroskaenc.c    | 2 +-
 tests/fate/matroska.mak      | 2 +-
 tests/fate/wavpack.mak       | 4 ++--
 tests/ref/fate/binsub-mksenc | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

Comments

Michael Niedermayer Oct. 5, 2016, midnight UTC | #1
On Mon, Oct 03, 2016 at 08:36:57PM -0300, James Almer wrote:
> The durations are never written in that situation.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavformat/matroskaenc.c    | 2 +-
>  tests/fate/matroska.mak      | 2 +-
>  tests/fate/wavpack.mak       | 4 ++--
>  tests/ref/fate/binsub-mksenc | 2 +-
>  4 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index 3eeb09b..32d5dcf 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -1376,7 +1376,7 @@ static int mkv_write_tags(AVFormatContext *s)
>          if (ret < 0) return ret;
>      }
>  
> -    if (!mkv->is_live) {
> +    if (s->pb->seekable && !mkv->is_live) {
>          for (i = 0; i < s->nb_streams; i++) {
>              ebml_master tag_target;
>              ebml_master tag;

LGTM


> diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
> index 8e4a1e8..36cc779 100644
> --- a/tests/fate/matroska.mak
> +++ b/tests/fate/matroska.mak
> @@ -4,6 +4,6 @@
>  FATE_MATROSKA-$(call DEMMUX, MATROSKA, MATROSKA) += fate-matroska-remux
>  fate-matroska-remux: CMD = md5 -i $(TARGET_SAMPLES)/vp9-test-vectors/vp90-2-2pass-akiyo.webm -color_trc 4 -c:v copy -fflags +bitexact -strict -2 -f matroska
>  fate-matroska-remux: CMP = oneline
> -fate-matroska-remux: REF = f08b20b90f158a4de5a02a52c25596b9
> +fate-matroska-remux: REF = 1040692ffdfee2428954af79a7d5d155

off topic, but storing the output files on disk and printing some
richer information would be quite usefull to understand changes

thx

[...]
James Almer Oct. 5, 2016, 12:23 a.m. UTC | #2
On 10/4/2016 9:00 PM, Michael Niedermayer wrote:
> On Mon, Oct 03, 2016 at 08:36:57PM -0300, James Almer wrote:
>> The durations are never written in that situation.
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>  libavformat/matroskaenc.c    | 2 +-
>>  tests/fate/matroska.mak      | 2 +-
>>  tests/fate/wavpack.mak       | 4 ++--
>>  tests/ref/fate/binsub-mksenc | 2 +-
>>  4 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
>> index 3eeb09b..32d5dcf 100644
>> --- a/libavformat/matroskaenc.c
>> +++ b/libavformat/matroskaenc.c
>> @@ -1376,7 +1376,7 @@ static int mkv_write_tags(AVFormatContext *s)
>>          if (ret < 0) return ret;
>>      }
>>  
>> -    if (!mkv->is_live) {
>> +    if (s->pb->seekable && !mkv->is_live) {
>>          for (i = 0; i < s->nb_streams; i++) {
>>              ebml_master tag_target;
>>              ebml_master tag;
> 
> LGTM
> 
> 
>> diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
>> index 8e4a1e8..36cc779 100644
>> --- a/tests/fate/matroska.mak
>> +++ b/tests/fate/matroska.mak
>> @@ -4,6 +4,6 @@
>>  FATE_MATROSKA-$(call DEMMUX, MATROSKA, MATROSKA) += fate-matroska-remux
>>  fate-matroska-remux: CMD = md5 -i $(TARGET_SAMPLES)/vp9-test-vectors/vp90-2-2pass-akiyo.webm -color_trc 4 -c:v copy -fflags +bitexact -strict -2 -f matroska
>>  fate-matroska-remux: CMP = oneline
>> -fate-matroska-remux: REF = f08b20b90f158a4de5a02a52c25596b9
>> +fate-matroska-remux: REF = 1040692ffdfee2428954af79a7d5d155
> 
> off topic, but storing the output files on disk and printing some
> richer information would be quite usefull to understand changes
> 
> thx

Having tests like this where a non seekable protocol is used comes in
handy. Notice how in this set these md5 tests are unaffected by most
changes precisely because the output AVIOContext is not seekable.
I guess what could be done is duplicate the tests, using both md5
protocol and framecrc output.

In any case, what happened in here is that all of them aren't writing
Duration tags with a never-updated Void element inside anymore.

Applied, thanks.

> 
> [...]
> 
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
Michael Niedermayer Oct. 5, 2016, 2:26 a.m. UTC | #3
On Tue, Oct 04, 2016 at 09:23:37PM -0300, James Almer wrote:
> On 10/4/2016 9:00 PM, Michael Niedermayer wrote:
> > On Mon, Oct 03, 2016 at 08:36:57PM -0300, James Almer wrote:
> >> The durations are never written in that situation.
> >>
> >> Signed-off-by: James Almer <jamrial@gmail.com>
> >> ---
> >>  libavformat/matroskaenc.c    | 2 +-
> >>  tests/fate/matroska.mak      | 2 +-
> >>  tests/fate/wavpack.mak       | 4 ++--
> >>  tests/ref/fate/binsub-mksenc | 2 +-
> >>  4 files changed, 5 insertions(+), 5 deletions(-)
> >>
> >> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> >> index 3eeb09b..32d5dcf 100644
> >> --- a/libavformat/matroskaenc.c
> >> +++ b/libavformat/matroskaenc.c
> >> @@ -1376,7 +1376,7 @@ static int mkv_write_tags(AVFormatContext *s)
> >>          if (ret < 0) return ret;
> >>      }
> >>  
> >> -    if (!mkv->is_live) {
> >> +    if (s->pb->seekable && !mkv->is_live) {
> >>          for (i = 0; i < s->nb_streams; i++) {
> >>              ebml_master tag_target;
> >>              ebml_master tag;
> > 
> > LGTM
> > 
> > 
> >> diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
> >> index 8e4a1e8..36cc779 100644
> >> --- a/tests/fate/matroska.mak
> >> +++ b/tests/fate/matroska.mak
> >> @@ -4,6 +4,6 @@
> >>  FATE_MATROSKA-$(call DEMMUX, MATROSKA, MATROSKA) += fate-matroska-remux
> >>  fate-matroska-remux: CMD = md5 -i $(TARGET_SAMPLES)/vp9-test-vectors/vp90-2-2pass-akiyo.webm -color_trc 4 -c:v copy -fflags +bitexact -strict -2 -f matroska
> >>  fate-matroska-remux: CMP = oneline
> >> -fate-matroska-remux: REF = f08b20b90f158a4de5a02a52c25596b9
> >> +fate-matroska-remux: REF = 1040692ffdfee2428954af79a7d5d155
> > 
> > off topic, but storing the output files on disk and printing some
> > richer information would be quite usefull to understand changes
> > 
> > thx
> 
> Having tests like this where a non seekable protocol is used comes in
> handy. Notice how in this set these md5 tests are unaffected by most
> changes precisely because the output AVIOContext is not seekable.
> I guess what could be done is duplicate the tests, using both md5
> protocol and framecrc output.

i dont think duplication would really be optimal,
i was more thinking about
storing the output with a "non seekable" file protocol and then
printing information about that file

thx

[...]
diff mbox

Patch

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 3eeb09b..32d5dcf 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1376,7 +1376,7 @@  static int mkv_write_tags(AVFormatContext *s)
         if (ret < 0) return ret;
     }
 
-    if (!mkv->is_live) {
+    if (s->pb->seekable && !mkv->is_live) {
         for (i = 0; i < s->nb_streams; i++) {
             ebml_master tag_target;
             ebml_master tag;
diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
index 8e4a1e8..36cc779 100644
--- a/tests/fate/matroska.mak
+++ b/tests/fate/matroska.mak
@@ -4,6 +4,6 @@ 
 FATE_MATROSKA-$(call DEMMUX, MATROSKA, MATROSKA) += fate-matroska-remux
 fate-matroska-remux: CMD = md5 -i $(TARGET_SAMPLES)/vp9-test-vectors/vp90-2-2pass-akiyo.webm -color_trc 4 -c:v copy -fflags +bitexact -strict -2 -f matroska
 fate-matroska-remux: CMP = oneline
-fate-matroska-remux: REF = f08b20b90f158a4de5a02a52c25596b9
+fate-matroska-remux: REF = 1040692ffdfee2428954af79a7d5d155
 
 FATE_SAMPLES_AVCONV += $(FATE_MATROSKA-yes)
diff --git a/tests/fate/wavpack.mak b/tests/fate/wavpack.mak
index a825a02..240f5ea 100644
--- a/tests/fate/wavpack.mak
+++ b/tests/fate/wavpack.mak
@@ -91,12 +91,12 @@  fate-wavpack-matroskamode: CMD = md5 -i $(TARGET_SAMPLES)/wavpack/special/matros
 FATE_WAVPACK-$(call DEMMUX, WV, MATROSKA) += fate-wavpack-matroska_mux-mono
 fate-wavpack-matroska_mux-mono: CMD = md5 -i $(TARGET_SAMPLES)/wavpack/num_channels/mono_16bit_int.wv -c copy -fflags +bitexact -f matroska
 fate-wavpack-matroska_mux-mono: CMP = oneline
-fate-wavpack-matroska_mux-mono: REF = 4befcc41dab6c690a15d0c396c324468
+fate-wavpack-matroska_mux-mono: REF = a2987e2e51e01a35e47e7da13eb47a35
 
 FATE_WAVPACK-$(call DEMMUX, WV, MATROSKA) += fate-wavpack-matroska_mux-61
 fate-wavpack-matroska_mux-61: CMD = md5 -i $(TARGET_SAMPLES)/wavpack/num_channels/eva_2.22_6.1_16bit-partial.wv -c copy -fflags +bitexact -f matroska
 fate-wavpack-matroska_mux-61: CMP = oneline
-fate-wavpack-matroska_mux-61: REF = 7fedbfc3b9ea7348761db664626c29f4
+fate-wavpack-matroska_mux-61: REF = ffba4ddea1ba71f7a5901d9ed1a267be
 
 FATE_SAMPLES_AVCONV += $(FATE_WAVPACK-yes)
 fate-wavpack: $(FATE_WAVPACK-yes)
diff --git a/tests/ref/fate/binsub-mksenc b/tests/ref/fate/binsub-mksenc
index 128ca31..c473497 100644
--- a/tests/ref/fate/binsub-mksenc
+++ b/tests/ref/fate/binsub-mksenc
@@ -1 +1 @@ 
-37a212f8d56ad71e7466d5129f88e756
+2dad5f63688ec613a04e94c8d4d167db