Skip to content

Commit

Permalink
[DVDDemuxFFmpeg] Ignore extradata for unknown stream types
Browse files Browse the repository at this point in the history
https://github.com/xbianonpi/xbian issue 765 has a file with 250M of AVMEDIA_TYPE_ATTACHMENT which fails to play on pi.
Don't bother allocating and copying the data as we won't do anything with it
  • Loading branch information
popcornmix committed Sep 7, 2015
1 parent daa385b commit bbc8d32
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,7 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int iId)
if (langTag)
strncpy(stream->language, langTag->value, 3);

if( pStream->codec->extradata && pStream->codec->extradata_size > 0 )
if( stream->type != STREAM_NONE && pStream->codec->extradata && pStream->codec->extradata_size > 0 )
{
stream->ExtraSize = pStream->codec->extradata_size;
stream->ExtraData = new uint8_t[pStream->codec->extradata_size];
Expand Down

3 comments on commit bbc8d32

@FernetMenta
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks ok but I am still interested in what the issue is. why does copying extradata harm in this case?

@popcornmix
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extradata is 256M (yes a quarter or a gigabyte) for this file.
We don't have enough SDRAM to allocate a second 250M buffer. And copying 250M is not a cheap operation.

Ideally it would be discarded earlier and the first 250M buffer wouldn't be allocated and we wouldn't waste the time reading it (it takes 30 seconds on my linux x86 PC to open this file). But I suspect that is inside ffmpeg and it doesn't know whether anyone will want it.

@FernetMenta
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for clarifying. please submit to mainline.

Please sign in to comment.