handled unknown size of segment for live stream
Change-Id: I7dcc08e38c6cd31a55693b39ace414c14399d1b5
This commit is contained in:
@@ -11,9 +11,6 @@
|
||||
#include <cstring>
|
||||
#include <new>
|
||||
#include <climits>
|
||||
//#include <windows.h>
|
||||
//#include "odbgstream.hpp"
|
||||
//using std::endl;
|
||||
|
||||
mkvparser::IMkvReader::~IMkvReader()
|
||||
{
|
||||
@@ -111,7 +108,6 @@ long long mkvparser::ReadUInt(IMkvReader* pReader, long long pos, long& len)
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
long long mkvparser::GetUIntLength(
|
||||
IMkvReader* pReader,
|
||||
long long pos,
|
||||
@@ -153,7 +149,6 @@ long long mkvparser::GetUIntLength(
|
||||
return 0; //success
|
||||
}
|
||||
|
||||
|
||||
long long mkvparser::SyncReadUInt(
|
||||
IMkvReader* pReader,
|
||||
long long pos,
|
||||
@@ -878,7 +873,7 @@ long long Segment::CreateInstance(
|
||||
|
||||
//TODO: if we liberalize the behavior of ReadUInt, we can
|
||||
//probably eliminate having to use GetUIntLength here.
|
||||
const long long size = ReadUInt(pReader, pos, len);
|
||||
long long size = ReadUInt(pReader, pos, len);
|
||||
|
||||
if (size < 0)
|
||||
return size;
|
||||
@@ -887,17 +882,25 @@ long long Segment::CreateInstance(
|
||||
|
||||
//Pos now points to start of payload
|
||||
|
||||
if ((pos + size) > total)
|
||||
return E_FILE_FORMAT_INVALID;
|
||||
|
||||
if (id == 0x08538067) //Segment ID
|
||||
{
|
||||
//Handle "unknown size" for live streaming of webm files.
|
||||
const long long unknown_size = (1LL << (7 * len)) - 1;
|
||||
|
||||
if (size == unknown_size)
|
||||
size = total - pos;
|
||||
else if ((pos + size) > total)
|
||||
return E_FILE_FORMAT_INVALID;
|
||||
|
||||
pSegment = new Segment(pReader, pos, size);
|
||||
assert(pSegment); //TODO
|
||||
|
||||
return 0; //success
|
||||
}
|
||||
|
||||
if ((pos + size) > total)
|
||||
return E_FILE_FORMAT_INVALID;
|
||||
|
||||
pos += size; //consume payload
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user