mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 06:15:43 +00:00
Bug 1215003. Part 3 - fix AsyncReadMetadata() and its callers. r=gerald.
This commit is contained in:
parent
9e488683b4
commit
cc0244c899
@ -94,6 +94,14 @@ public:
|
||||
// on failure.
|
||||
virtual nsresult Init() { return NS_OK; }
|
||||
|
||||
RefPtr<MetadataPromise> AsyncReadMetadata()
|
||||
{
|
||||
return OnTaskQueue() ?
|
||||
AsyncReadMetadataInternal() :
|
||||
InvokeAsync(OwnerThread(), this, __func__,
|
||||
&MediaDecoderReader::AsyncReadMetadataInternal);
|
||||
}
|
||||
|
||||
// Release media resources they should be released in dormant state
|
||||
// The reader can be made usable again by calling ReadMetadata().
|
||||
void ReleaseMediaResources()
|
||||
@ -177,11 +185,6 @@ public:
|
||||
virtual bool HasAudio() = 0;
|
||||
virtual bool HasVideo() = 0;
|
||||
|
||||
// The default implementation of AsyncReadMetadata is implemented in terms of
|
||||
// synchronous ReadMetadata() calls. Implementations may also
|
||||
// override AsyncReadMetadata to create a more proper async implementation.
|
||||
virtual RefPtr<MetadataPromise> AsyncReadMetadata();
|
||||
|
||||
// Fills aInfo with the latest cached data required to present the media,
|
||||
// ReadUpdatedMetadata will always be called once ReadMetadata has succeeded.
|
||||
virtual void ReadUpdatedMetadata(MediaInfo* aInfo) { };
|
||||
|
@ -2256,11 +2256,10 @@ nsresult MediaDecoderStateMachine::RunStateMachine()
|
||||
|
||||
case DECODER_STATE_DECODING_METADATA: {
|
||||
if (!mMetadataRequest.Exists()) {
|
||||
DECODER_LOG("Dispatching AsyncReadMetadata");
|
||||
DECODER_LOG("Calling AsyncReadMetadata");
|
||||
// Set mode to METADATA since we are about to read metadata.
|
||||
mResource->SetReadMode(MediaCacheStream::MODE_METADATA);
|
||||
mMetadataRequest.Begin(InvokeAsync(DecodeTaskQueue(), mReader.get(), __func__,
|
||||
&MediaDecoderReader::AsyncReadMetadata)
|
||||
mMetadataRequest.Begin(mReader->AsyncReadMetadata()
|
||||
->Then(OwnerThread(), __func__, this,
|
||||
&MediaDecoderStateMachine::OnMetadataRead,
|
||||
&MediaDecoderStateMachine::OnMetadataNotRead));
|
||||
|
Loading…
Reference in New Issue
Block a user