Commit a90e2f04 authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

mkv:matroska_segment: handle track init failure

We should not use a track that failed to be initialized properly.
The logic of the return value is inverted to be more readable. Before
it would never fail anyway.
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 61b10177
......@@ -166,7 +166,7 @@ private:
bool ParseCluster( KaxCluster *cluster, bool b_update_start_time = true, ScopeMode read_fully = SCOPE_ALL_DATA );
bool ParseSimpleTags( SimpleTag* out, KaxTagSimple *tag, int level = 50 );
void IndexAppendCluster( KaxCluster *cluster );
int32_t TrackInit( mkv_track_t * p_tk );
bool TrackInit( mkv_track_t * p_tk );
void ComputeTrackPriority();
void EnsureDuration();
......
......@@ -692,7 +692,7 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
return;
}
#endif
if( TrackInit( &track ) )
if( !TrackInit( &track ) )
{
msg_Err(&sys.demuxer, "Couldn't init track %u", track.i_number );
es_format_Clean( &track.fmt );
......@@ -1286,13 +1286,13 @@ bool matroska_segment_c::ParseCluster( KaxCluster *cluster, bool b_update_start_
}
int32_t matroska_segment_c::TrackInit( mkv_track_t * p_tk )
bool matroska_segment_c::TrackInit( mkv_track_t * p_tk )
{
if( p_tk->codec.empty() )
{
msg_Err( &sys.demuxer, "Empty codec id" );
p_tk->fmt.i_codec = VLC_CODEC_UNKNOWN;
return 0;
return true;
}
struct HandlerPayload {
......@@ -1891,7 +1891,8 @@ int32_t matroska_segment_c::TrackInit( mkv_track_t * p_tk )
{
msg_Err( &sys.demuxer, "Error when trying to initiate track (codec: %s): %s",
p_tk->codec.c_str(), e.what () );
return false;
}
return 0;
return true;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment