AVFormatWriter: Add more error checking
* Check before to write chunks if the header was correctly written, the same happens for track infos, even if the code doesn't support it.
This commit is contained in:
@@ -601,6 +601,9 @@ AVFormatWriter::AddTrackInfo(void* _cookie, uint32 code,
|
|||||||
TRACE("AVFormatWriter::AddTrackInfo(%lu, %p, %ld, %lu)\n",
|
TRACE("AVFormatWriter::AddTrackInfo(%lu, %p, %ld, %lu)\n",
|
||||||
code, data, size, flags);
|
code, data, size, flags);
|
||||||
|
|
||||||
|
if (fHeaderError != 0)
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
StreamCookie* cookie = reinterpret_cast<StreamCookie*>(_cookie);
|
StreamCookie* cookie = reinterpret_cast<StreamCookie*>(_cookie);
|
||||||
return cookie->AddTrackInfo(code, data, size, flags);
|
return cookie->AddTrackInfo(code, data, size, flags);
|
||||||
}
|
}
|
||||||
@@ -613,6 +616,9 @@ AVFormatWriter::WriteChunk(void* _cookie, const void* chunkBuffer,
|
|||||||
TRACE_PACKET("AVFormatWriter::WriteChunk(%p, %ld, %p)\n", chunkBuffer,
|
TRACE_PACKET("AVFormatWriter::WriteChunk(%p, %ld, %p)\n", chunkBuffer,
|
||||||
chunkSize, encodeInfo);
|
chunkSize, encodeInfo);
|
||||||
|
|
||||||
|
if (fHeaderError != 0)
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
StreamCookie* cookie = reinterpret_cast<StreamCookie*>(_cookie);
|
StreamCookie* cookie = reinterpret_cast<StreamCookie*>(_cookie);
|
||||||
return cookie->WriteChunk(chunkBuffer, chunkSize, encodeInfo);
|
return cookie->WriteChunk(chunkBuffer, chunkSize, encodeInfo);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user