acidburn0zzz / webm

Automatically exported from code.google.com/p/webm
1 stars 0 forks source link

Not specifying TrackType results in invalid matroska file #769

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Add a Track using Segment::AddTrack() and do not specify track type.

What is the expected output?
TrackType element should not be written to file since it was never specified. 
It should be a valid matroska file.

What do you see instead?
TrackType element is being written as zero (the default in mkvmuxer::Track 
class). But according to matroska spec TrackType can never be zero (it should 
be between 1-254). So, the resulting file is an invalid matroska file.

A check should be added before writing the TrackType element to see if it's not 
zero.

What version are you using?
libwebm git head.

Original issue reported on code.google.com by vigne...@google.com on 24 Apr 2014 at 10:32

GoogleCodeExporter commented 9 years ago
TrackType element is mandatory and not optional. So merely adding a check won't 
suffice. Nevertheless, the bug is still there because we are defaulting to 0 
which results in an invalid matroska file. According to the specification, 
there is no default value for the TrackType element.

So ideally, Segment::AddTrack() should take track_type as one of its mandatory 
arguments. But since we cannot change that (it's a public API) without breaking 
compatibility, we need to outright reject muxing files if Segment::AddTrack() 
is called but Track::set_type() is never called.

Original comment by vigne...@google.com on 26 Apr 2014 at 10:02