Bug 1157075: Part1. Rename and make AsyncReadMetadata virtual. r=bholley

This commit is contained in:
Jean-Yves Avenard 2015-05-01 15:37:29 +10:00
parent 9e25ffc9c1
commit ba36ac0511
3 changed files with 10 additions and 10 deletions

View File

@ -179,13 +179,13 @@ MediaDecoderReader::ComputeStartTime(const VideoData* aVideo, const AudioData* a
}
nsRefPtr<MediaDecoderReader::MetadataPromise>
MediaDecoderReader::CallReadMetadata()
MediaDecoderReader::AsyncReadMetadata()
{
typedef ReadMetadataFailureReason Reason;
MOZ_ASSERT(OnTaskQueue());
mDecoder->GetReentrantMonitor().AssertNotCurrentThreadIn();
DECODER_LOG("MediaDecoderReader::CallReadMetadata");
DECODER_LOG("MediaDecoderReader::AsyncReadMetadata");
// PreReadMetadata causes us to try to allocate various hardware and OS
// resources, which may not be available at the moment.
@ -198,8 +198,8 @@ MediaDecoderReader::CallReadMetadata()
nsRefPtr<MetadataHolder> metadata = new MetadataHolder();
nsresult rv = ReadMetadata(&metadata->mInfo, getter_Transfers(metadata->mTags));
// Reading metadata can cause us to discover that we need resources (like
// encryption keys).
// Reading metadata can cause us to discover that we need resources (a hardware
// resource initialized but not yet ready for use).
if (IsWaitingMediaResources()) {
return MetadataPromise::CreateAndReject(Reason::WAITING_FOR_RESOURCES, __func__);
}

View File

@ -167,10 +167,10 @@ public:
virtual bool HasAudio() = 0;
virtual bool HasVideo() = 0;
// The ReadMetadata API is unfortunately synchronous. We should fix that at
// some point, but for now we can make things a bit better by using a
// promise-y API on top of a synchronous call.
nsRefPtr<MetadataPromise> CallReadMetadata();
// The default implementation of AsyncReadMetadata is implemented in terms of
// synchronous PreReadMetadata() / ReadMetadata() calls. Implementations may also
// override AsyncReadMetadata to create a more proper async implementation.
virtual nsRefPtr<MetadataPromise> AsyncReadMetadata();
// A function that is called before ReadMetadata() call.
virtual void PreReadMetadata() {};

View File

@ -2615,9 +2615,9 @@ nsresult MediaDecoderStateMachine::RunStateMachine()
case DECODER_STATE_DECODING_METADATA: {
if (!mMetadataRequest.Exists()) {
DECODER_LOG("Dispatching CallReadMetadata");
DECODER_LOG("Dispatching AsyncReadMetadata");
mMetadataRequest.Begin(ProxyMediaCall(DecodeTaskQueue(), mReader.get(), __func__,
&MediaDecoderReader::CallReadMetadata)
&MediaDecoderReader::AsyncReadMetadata)
->RefableThen(TaskQueue(), __func__, this,
&MediaDecoderStateMachine::OnMetadataRead,
&MediaDecoderStateMachine::OnMetadataNotRead));