Bug 1215003. Part 2 - rename AsyncReadMetadata and move it to the private section. r=gerald.

This commit is contained in:
JW Wang 2015-10-19 10:52:15 +08:00
parent d5279ca663
commit 84fb1fa3b2
14 changed files with 35 additions and 25 deletions

View File

@ -250,12 +250,12 @@ MediaDecoderReader::GetBuffered()
}
RefPtr<MediaDecoderReader::MetadataPromise>
MediaDecoderReader::AsyncReadMetadata()
MediaDecoderReader::AsyncReadMetadataInternal()
{
typedef ReadMetadataFailureReason Reason;
MOZ_ASSERT(OnTaskQueue());
DECODER_LOG("MediaDecoderReader::AsyncReadMetadata");
DECODER_LOG("MediaDecoderReader::AsyncReadMetadataInternal");
// Attempt to read the metadata.
RefPtr<MetadataHolder> metadata = new MetadataHolder();

View File

@ -267,6 +267,12 @@ private:
// Returns NS_OK on success, or NS_ERROR_FAILURE on failure.
virtual nsresult ReadMetadata(MediaInfo*, MetadataTags**) { MOZ_CRASH(); }
// The default implementation of AsyncReadMetadataInternal is implemented in
// terms of synchronous ReadMetadata() calls. Implementations may also
// override AsyncReadMetadataInternal to create a more proper async
// implementation.
virtual RefPtr<MetadataPromise> AsyncReadMetadataInternal();
protected:
friend class TrackBuffer;
virtual void NotifyDataArrivedInternal(uint32_t aLength, int64_t aOffset) { }

View File

@ -243,7 +243,7 @@ MediaFormatReader::IsWaitingOnCDMResource() {
}
RefPtr<MediaDecoderReader::MetadataPromise>
MediaFormatReader::AsyncReadMetadata()
MediaFormatReader::AsyncReadMetadataInternal()
{
MOZ_ASSERT(OnTaskQueue());

View File

@ -52,8 +52,6 @@ public:
return mAudio.mTrackDemuxer;
}
RefPtr<MetadataPromise> AsyncReadMetadata() override;
void ReadUpdatedMetadata(MediaInfo* aInfo) override;
RefPtr<SeekPromise>
@ -442,6 +440,7 @@ private:
// For Media Resource Management
void ReleaseMediaResourcesInternal() override;
void DisableHardwareAccelerationInternal() override;
RefPtr<MetadataPromise> AsyncReadMetadataInternal() override;
};
} // namespace mozilla

View File

@ -660,7 +660,7 @@ MediaCodecReader::ParseDataSegment(const char* aBuffer,
}
RefPtr<MediaDecoderReader::MetadataPromise>
MediaCodecReader::AsyncReadMetadata()
MediaCodecReader::AsyncReadMetadataInternal()
{
MOZ_ASSERT(OnTaskQueue());

View File

@ -70,8 +70,11 @@ protected:
// all contents have been continuously parsed. (ex. total duration of some
// variable-bit-rate MP3 files.)
virtual void NotifyDataArrivedInternal(uint32_t aLength, int64_t aOffset) override;
public:
virtual RefPtr<MediaDecoderReader::MetadataPromise>
AsyncReadMetadataInternal() override;
public:
// Flush the TaskQueue, flush MediaCodec and raise the mDiscontinuity.
virtual nsresult ResetDecode() override;
@ -86,8 +89,6 @@ public:
virtual bool HasAudio();
virtual bool HasVideo();
virtual RefPtr<MediaDecoderReader::MetadataPromise> AsyncReadMetadata() override;
// Moves the decode head to aTime microseconds. aStartTime and aEndTime
// denote the start and end times of the media in usecs, and aCurrentTime
// is the current playback position in microseconds.

View File

@ -212,7 +212,7 @@ nsresult MediaOmxReader::InitOmxDecoder()
}
RefPtr<MediaDecoderReader::MetadataPromise>
MediaOmxReader::AsyncReadMetadata()
MediaOmxReader::AsyncReadMetadataInternal()
{
MOZ_ASSERT(OnTaskQueue());
EnsureActive();

View File

@ -72,6 +72,10 @@ public:
protected:
virtual void NotifyDataArrivedInternal(uint32_t aLength, int64_t aOffset) override;
virtual RefPtr<MediaDecoderReader::MetadataPromise>
AsyncReadMetadataInternal() override;
public:
virtual nsresult ResetDecode()
@ -95,8 +99,6 @@ public:
return mHasVideo;
}
virtual RefPtr<MediaDecoderReader::MetadataPromise> AsyncReadMetadata() override;
virtual RefPtr<SeekPromise>
Seek(int64_t aTime, int64_t aEndTime) override;

View File

@ -89,13 +89,13 @@ RtspMediaCodecReader::RequestVideoData(bool aSkipToNextKeyframe,
}
RefPtr<MediaDecoderReader::MetadataPromise>
RtspMediaCodecReader::AsyncReadMetadata()
RtspMediaCodecReader::AsyncReadMetadataInternal()
{
mRtspResource->DisablePlayoutDelay();
EnsureActive();
RefPtr<MediaDecoderReader::MetadataPromise> p =
MediaCodecReader::AsyncReadMetadata();
MediaCodecReader::AsyncReadMetadataInternal();
// Send a PAUSE to the RTSP server because the underlying media resource is
// not ready.

View File

@ -58,12 +58,12 @@ public:
// Disptach a DecodeAudioDataTask to decode audio data.
virtual RefPtr<AudioDataPromise> RequestAudioData() override;
virtual RefPtr<MediaDecoderReader::MetadataPromise> AsyncReadMetadata()
override;
virtual void HandleResourceAllocated() override;
private:
virtual RefPtr<MediaDecoderReader::MetadataPromise>
AsyncReadMetadataInternal() override;
// A pointer to RtspMediaResource for calling the Rtsp specific function.
// The lifetime of mRtspResource is controlled by MediaDecoder. MediaDecoder
// holds the MediaDecoderStateMachine and RtspMediaResource.

View File

@ -87,14 +87,14 @@ void RtspOmxReader::EnsureActive() {
}
RefPtr<MediaDecoderReader::MetadataPromise>
RtspOmxReader::AsyncReadMetadata()
RtspOmxReader::AsyncReadMetadataInternal()
{
// Send a PLAY command to the RTSP server before reading metadata.
// Because we might need some decoded samples to ensure we have configuration.
mRtspResource->DisablePlayoutDelay();
RefPtr<MediaDecoderReader::MetadataPromise> p =
MediaOmxReader::AsyncReadMetadata();
MediaOmxReader::AsyncReadMetadataInternal();
// Send a PAUSE to the RTSP server because the underlying media resource is
// not ready.

View File

@ -66,12 +66,12 @@ public:
virtual void SetIdle() override;
virtual RefPtr<MediaDecoderReader::MetadataPromise> AsyncReadMetadata()
override;
virtual void HandleResourceAllocated() override;
private:
virtual RefPtr<MediaDecoderReader::MetadataPromise>
AsyncReadMetadataInternal() override;
// A pointer to RtspMediaResource for calling the Rtsp specific function.
// The lifetime of mRtspResource is controlled by MediaDecoder. MediaDecoder
// holds the MediaDecoderStateMachine and RtspMediaResource.

View File

@ -227,8 +227,10 @@ void WebMReader::Cleanup()
}
RefPtr<MediaDecoderReader::MetadataPromise>
WebMReader::AsyncReadMetadata()
WebMReader::AsyncReadMetadataInternal()
{
MOZ_ASSERT(OnTaskQueue());
RefPtr<MetadataHolder> metadata = new MetadataHolder();
if (NS_FAILED(RetrieveWebMMetadata(&metadata->mInfo)) ||

View File

@ -89,8 +89,6 @@ public:
return mHasVideo;
}
virtual RefPtr<MetadataPromise> AsyncReadMetadata() override;
virtual RefPtr<SeekPromise>
Seek(int64_t aTime, int64_t aEndTime) override;
@ -144,6 +142,8 @@ protected:
bool ShouldSkipVideoFrame(int64_t aTimeThreshold);
private:
virtual RefPtr<MetadataPromise> AsyncReadMetadataInternal() override;
nsresult RetrieveWebMMetadata(MediaInfo* aInfo);
// Get the timestamp of keyframe greater than aTimeThreshold.