mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1171311: P1. Add MediaDataDemuxer::IsThreadSafe() method. r=cpearce
This commit is contained in:
parent
be0c4421e7
commit
dec5a2fb99
@ -50,6 +50,14 @@ public:
|
||||
// again to retry once more data has been received.
|
||||
virtual nsRefPtr<InitPromise> Init() = 0;
|
||||
|
||||
// MediaFormatReader ensures that calls to the MediaDataDemuxer are thread-safe.
|
||||
// This is done by having multiple demuxers, created with Clone(), one per
|
||||
// running thread.
|
||||
// However, should the MediaDataDemuxer object guaranteed to be thread-safe
|
||||
// such cloning is unecessary and only one demuxer will be used across
|
||||
// all threads.
|
||||
virtual bool IsThreadSafe() { return false; }
|
||||
|
||||
// Clone the demuxer and return a new initialized demuxer.
|
||||
// This can only be called once Init() has succeeded.
|
||||
// The new demuxer can be immediately use to retrieve the track demuxers.
|
||||
|
@ -341,7 +341,11 @@ MediaFormatReader::OnDemuxerInitDone(nsresult)
|
||||
mSeekable = mDemuxer->IsSeekable();
|
||||
|
||||
// Create demuxer object for main thread.
|
||||
mMainThreadDemuxer = mDemuxer->Clone();
|
||||
if (mDemuxer->IsThreadSafe()) {
|
||||
mMainThreadDemuxer = mDemuxer;
|
||||
} else {
|
||||
mMainThreadDemuxer = mDemuxer->Clone();
|
||||
}
|
||||
if (!mMainThreadDemuxer) {
|
||||
mMetadataPromise.Reject(ReadMetadataFailureReason::METADATA_ERROR, __func__);
|
||||
NS_WARNING("Unable to clone current MediaDataDemuxer");
|
||||
|
Loading…
Reference in New Issue
Block a user