Backed out changeset d460f4c4b0c0 (bug 1309516) for notrun errors in media-src/media-src-7_3.html web-platform-test. r=backout

This commit is contained in:
Sebastian Hengst 2016-11-05 11:01:22 +01:00
Родитель 6977851a02
Коммит 1d1c10922e
3 изменённых файлов: 14 добавлений и 119 удалений

Просмотреть файл

@ -723,50 +723,10 @@ MediaFormatReader::OnDemuxerInitDone(nsresult)
return;
}
mTags = Move(tags);
mInitDone = true;
// Try to get the start time.
// For MSE case, the start time of each track is assumed to be 0.
// For others, we must demux the first sample to know the start time for each
// track.
if (ForceZeroStartTime()) {
mAudio.mFirstDemuxedSampleTime.emplace(TimeUnit::FromMicroseconds(0));
mVideo.mFirstDemuxedSampleTime.emplace(TimeUnit::FromMicroseconds(0));
} else {
if (HasAudio()) {
RequestDemuxSamples(TrackInfo::kAudioTrack);
}
if (HasVideo()) {
RequestDemuxSamples(TrackInfo::kVideoTrack);
}
}
MaybeResolveMetadataPromise();
}
void
MediaFormatReader::MaybeResolveMetadataPromise()
{
MOZ_ASSERT(OnTaskQueue());
if ((HasAudio() && mAudio.mFirstDemuxedSampleTime.isNothing()) ||
(HasVideo() && mVideo.mFirstDemuxedSampleTime.isNothing())) {
return;
}
TimeUnit startTime =
std::min(mAudio.mFirstDemuxedSampleTime.refOr(TimeUnit::FromInfinity()),
mVideo.mFirstDemuxedSampleTime.refOr(TimeUnit::FromInfinity()));
if (!startTime.IsInfinite()) {
mInfo.mStartTime = startTime; // mInfo.mStartTime is initialized to 0.
}
RefPtr<MetadataHolder> metadata = new MetadataHolder();
metadata->mInfo = mInfo;
metadata->mTags = mTags->Count() ? mTags.release() : nullptr;
metadata->mTags = tags->Count() ? tags.release() : nullptr;
mMetadataPromise.Resolve(metadata, __func__);
}
@ -894,22 +854,10 @@ MediaFormatReader::OnDemuxFailed(TrackType aTrack, const MediaResult& aError)
void
MediaFormatReader::DoDemuxVideo()
{
auto p = mVideo.mTrackDemuxer->GetSamples(1);
if (mVideo.mFirstDemuxedSampleTime.isNothing()) {
RefPtr<MediaFormatReader> self = this;
p = p->Then(OwnerThread(), __func__,
[self] (RefPtr<MediaTrackDemuxer::SamplesHolder> aSamples) {
self->OnFirstDemuxCompleted(TrackInfo::kVideoTrack, aSamples);
},
[self] (const MediaResult& aError) {
self->OnFirstDemuxFailed(TrackInfo::kVideoTrack, aError);
})->CompletionPromise();
}
mVideo.mDemuxRequest.Begin(p->Then(OwnerThread(), __func__, this,
&MediaFormatReader::OnVideoDemuxCompleted,
&MediaFormatReader::OnVideoDemuxFailed));
mVideo.mDemuxRequest.Begin(mVideo.mTrackDemuxer->GetSamples(1)
->Then(OwnerThread(), __func__, this,
&MediaFormatReader::OnVideoDemuxCompleted,
&MediaFormatReader::OnVideoDemuxFailed));
}
void
@ -960,22 +908,10 @@ MediaFormatReader::RequestAudioData()
void
MediaFormatReader::DoDemuxAudio()
{
auto p = mAudio.mTrackDemuxer->GetSamples(1);
if (mAudio.mFirstDemuxedSampleTime.isNothing()) {
RefPtr<MediaFormatReader> self = this;
p = p->Then(OwnerThread(), __func__,
[self] (RefPtr<MediaTrackDemuxer::SamplesHolder> aSamples) {
self->OnFirstDemuxCompleted(TrackInfo::kAudioTrack, aSamples);
},
[self] (const MediaResult& aError) {
self->OnFirstDemuxFailed(TrackInfo::kAudioTrack, aError);
})->CompletionPromise();
}
mAudio.mDemuxRequest.Begin(p->Then(OwnerThread(), __func__, this,
&MediaFormatReader::OnAudioDemuxCompleted,
&MediaFormatReader::OnAudioDemuxFailed));
mAudio.mDemuxRequest.Begin(mAudio.mTrackDemuxer->GetSamples(1)
->Then(OwnerThread(), __func__, this,
&MediaFormatReader::OnAudioDemuxCompleted,
&MediaFormatReader::OnAudioDemuxFailed));
}
void
@ -1259,6 +1195,11 @@ MediaFormatReader::HandleDemuxedSamples(TrackType aTrack,
return;
}
if (!ForceZeroStartTime() && decoder.mFirstDemuxedSampleTime.isNothing()) {
decoder.mFirstDemuxedSampleTime.emplace(
media::TimeUnit::FromMicroseconds(decoder.mQueuedSamples[0]->mTime));
}
LOGV("Giving %s input to decoder", TrackTypeToStr(aTrack));
// Decode all our demuxed frames.
@ -2386,37 +2327,4 @@ MediaFormatReader::SetBlankDecode(TrackType aTrack, bool aIsBlankDecode)
return;
}
void
MediaFormatReader::OnFirstDemuxCompleted(TrackInfo::TrackType aType,
RefPtr<MediaTrackDemuxer::SamplesHolder> aSamples)
{
MOZ_ASSERT(OnTaskQueue());
if (mShutdown) {
return;
}
auto& decoder = GetDecoderData(aType);
MOZ_ASSERT(decoder.mFirstDemuxedSampleTime.isNothing());
decoder.mFirstDemuxedSampleTime.emplace(
TimeUnit::FromMicroseconds(aSamples->mSamples[0]->mTime));
MaybeResolveMetadataPromise();
}
void
MediaFormatReader::OnFirstDemuxFailed(TrackInfo::TrackType aType,
const MediaResult& aError)
{
MOZ_ASSERT(OnTaskQueue());
if (mShutdown) {
return;
}
auto& decoder = GetDecoderData(aType);
MOZ_ASSERT(decoder.mFirstDemuxedSampleTime.isNothing());
decoder.mFirstDemuxedSampleTime.emplace(TimeUnit::FromInfinity());
MaybeResolveMetadataPromise();
}
} // namespace mozilla

Просмотреть файл

@ -575,15 +575,6 @@ private:
class DecoderFactory;
UniquePtr<DecoderFactory> mDecoderFactory;
void OnFirstDemuxCompleted(TrackInfo::TrackType aType,
RefPtr<MediaTrackDemuxer::SamplesHolder> aSamples);
void OnFirstDemuxFailed(TrackInfo::TrackType aType, const MediaResult& aError);
void MaybeResolveMetadataPromise();
UniquePtr<MetadataTags> mTags;
};
} // namespace mozilla

Просмотреть файл

@ -503,10 +503,6 @@ public:
bool mMediaSeekableOnlyInBufferedRanges = false;
EncryptionInfo mCrypto;
// The minimum of start times of audio and video tracks.
// Use to map the zero time on the media timeline to the first frame.
media::TimeUnit mStartTime;
};
class SharedTrackInfo {