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:
Dario Casalinuovo
2016-04-12 02:26:15 +02:00
parent 9074223db0
commit ec2c5619c1
@@ -601,6 +601,9 @@ AVFormatWriter::AddTrackInfo(void* _cookie, uint32 code,
TRACE("AVFormatWriter::AddTrackInfo(%lu, %p, %ld, %lu)\n",
code, data, size, flags);
if (fHeaderError != 0)
return B_ERROR;
StreamCookie* cookie = reinterpret_cast<StreamCookie*>(_cookie);
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,
chunkSize, encodeInfo);
if (fHeaderError != 0)
return B_ERROR;
StreamCookie* cookie = reinterpret_cast<StreamCookie*>(_cookie);
return cookie->WriteChunk(chunkBuffer, chunkSize, encodeInfo);
}