mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset a622dbe33efb (bug 1135544) for ASAN mochitest-3 bustage on CLOSED TREE
This commit is contained in:
parent
a294ca4245
commit
d6d05cd452
@ -20,7 +20,6 @@
|
||||
#include "mp4_demuxer/AnnexB.h"
|
||||
#include "mp4_demuxer/H264.h"
|
||||
#include "SharedDecoderManager.h"
|
||||
#include "mp4_demuxer/MP4TrackDemuxer.h"
|
||||
|
||||
#ifdef MOZ_EME
|
||||
#include "mozilla/CDMProxy.h"
|
||||
@ -333,8 +332,8 @@ bool MP4Reader::IsWaitingMediaResources()
|
||||
void
|
||||
MP4Reader::ExtractCryptoInitData(nsTArray<uint8_t>& aInitData)
|
||||
{
|
||||
MOZ_ASSERT(mCrypto.valid);
|
||||
const nsTArray<mp4_demuxer::PsshInfo>& psshs = mCrypto.pssh;
|
||||
MOZ_ASSERT(mDemuxer->Crypto().valid);
|
||||
const nsTArray<mp4_demuxer::PsshInfo>& psshs = mDemuxer->Crypto().pssh;
|
||||
for (uint32_t i = 0; i < psshs.Length(); i++) {
|
||||
aInitData.AppendElements(psshs[i].data);
|
||||
}
|
||||
@ -385,20 +384,13 @@ MP4Reader::ReadMetadata(MediaInfo* aInfo,
|
||||
// To decode, we need valid video and a place to put it.
|
||||
mInfo.mVideo.mHasVideo = mVideo.mActive = mDemuxer->HasValidVideo() &&
|
||||
mDecoder->GetImageContainer();
|
||||
if (mVideo.mActive) {
|
||||
mVideo.mTrackDemuxer = new MP4VideoDemuxer(mDemuxer);
|
||||
}
|
||||
|
||||
mInfo.mAudio.mHasAudio = mAudio.mActive = mDemuxer->HasValidAudio();
|
||||
if (mAudio.mActive) {
|
||||
mAudio.mTrackDemuxer = new MP4AudioDemuxer(mDemuxer);
|
||||
}
|
||||
mCrypto = mDemuxer->Crypto();
|
||||
|
||||
{
|
||||
MonitorAutoUnlock unlock(mDemuxerMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
mInfo.mIsEncrypted = mIsEncrypted = mCrypto.valid;
|
||||
mInfo.mIsEncrypted = mIsEncrypted = mDemuxer->Crypto().valid;
|
||||
}
|
||||
|
||||
// Remember that we've initialized the demuxer, so that if we're decoding
|
||||
@ -411,7 +403,7 @@ MP4Reader::ReadMetadata(MediaInfo* aInfo,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (mCrypto.valid) {
|
||||
if (mDemuxer->Crypto().valid) {
|
||||
#ifdef MOZ_EME
|
||||
// We have encrypted audio or video. We'll need a CDM to decrypt and
|
||||
// possibly decode this. Wait until we've received a CDM from the
|
||||
@ -537,7 +529,7 @@ MP4Reader::IsMediaSeekable()
|
||||
// We can seek if we get a duration *and* the reader reports that it's
|
||||
// seekable.
|
||||
MonitorAutoLock mon(mDemuxerMonitor);
|
||||
return mDecoder->GetResource()->IsTransportSeekable();
|
||||
return mDecoder->GetResource()->IsTransportSeekable() && mDemuxer->CanSeek();
|
||||
}
|
||||
|
||||
bool
|
||||
@ -566,7 +558,7 @@ Microseconds
|
||||
MP4Reader::GetNextKeyframeTime()
|
||||
{
|
||||
MonitorAutoLock mon(mDemuxerMonitor);
|
||||
return mVideo.mTrackDemuxer->GetNextKeyframeTime();
|
||||
return mDemuxer->GetNextKeyframeTime();
|
||||
}
|
||||
|
||||
bool
|
||||
@ -719,16 +711,16 @@ MP4Reader::Update(TrackType aTrack)
|
||||
decoder.mIsFlushing);
|
||||
|
||||
if (needInput) {
|
||||
MediaSample* sample = PopSample(aTrack);
|
||||
MP4Sample* sample = PopSample(aTrack);
|
||||
|
||||
// Collect telemetry from h264 Annex B SPS.
|
||||
if (sample && !mFoundSPSForTelemetry && AnnexB::HasSPS(sample->mMp4Sample)) {
|
||||
nsRefPtr<ByteBuffer> extradata = AnnexB::ExtractExtraData(sample->mMp4Sample);
|
||||
if (sample && !mFoundSPSForTelemetry && AnnexB::HasSPS(sample)) {
|
||||
nsRefPtr<ByteBuffer> extradata = AnnexB::ExtractExtraData(sample);
|
||||
mFoundSPSForTelemetry = AccumulateSPSTelemetry(extradata);
|
||||
}
|
||||
|
||||
if (sample) {
|
||||
decoder.mDecoder->Input(sample->mMp4Sample.forget());
|
||||
decoder.mDecoder->Input(sample);
|
||||
if (aTrack == kVideo) {
|
||||
parsed++;
|
||||
}
|
||||
@ -772,25 +764,25 @@ MP4Reader::ReturnOutput(MediaData* aData, TrackType aTrack)
|
||||
}
|
||||
}
|
||||
|
||||
MediaSample*
|
||||
MP4Sample*
|
||||
MP4Reader::PopSample(TrackType aTrack)
|
||||
{
|
||||
MonitorAutoLock mon(mDemuxerMonitor);
|
||||
return PopSampleLocked(aTrack);
|
||||
}
|
||||
|
||||
MediaSample*
|
||||
MP4Sample*
|
||||
MP4Reader::PopSampleLocked(TrackType aTrack)
|
||||
{
|
||||
mDemuxerMonitor.AssertCurrentThreadOwns();
|
||||
switch (aTrack) {
|
||||
case kAudio:
|
||||
return InvokeAndRetry(mAudio.mTrackDemuxer.get(), &TrackDemuxer::DemuxSample, mStream, &mDemuxerMonitor);
|
||||
return InvokeAndRetry(mDemuxer.get(), &MP4Demuxer::DemuxAudioSample, mStream, &mDemuxerMonitor);
|
||||
case kVideo:
|
||||
if (mQueuedVideoSample) {
|
||||
return mQueuedVideoSample.forget();
|
||||
}
|
||||
return InvokeAndRetry(mVideo.mTrackDemuxer.get(), &TrackDemuxer::DemuxSample, mStream, &mDemuxerMonitor);
|
||||
return InvokeAndRetry(mDemuxer.get(), &MP4Demuxer::DemuxVideoSample, mStream, &mDemuxerMonitor);
|
||||
|
||||
default:
|
||||
return nullptr;
|
||||
@ -824,15 +816,15 @@ MP4Reader::ResetDecode()
|
||||
Flush(kVideo);
|
||||
{
|
||||
MonitorAutoLock mon(mDemuxerMonitor);
|
||||
if (mVideo.mTrackDemuxer) {
|
||||
mVideo.mTrackDemuxer->Seek(0);
|
||||
if (mDemuxer) {
|
||||
mDemuxer->SeekVideo(0);
|
||||
}
|
||||
}
|
||||
Flush(kAudio);
|
||||
{
|
||||
MonitorAutoLock mon(mDemuxerMonitor);
|
||||
if (mAudio.mTrackDemuxer) {
|
||||
mAudio.mTrackDemuxer->Seek(0);
|
||||
if (mDemuxer) {
|
||||
mDemuxer->SeekAudio(0);
|
||||
}
|
||||
}
|
||||
return MediaDecoderReader::ResetDecode();
|
||||
@ -948,7 +940,7 @@ MP4Reader::SkipVideoDemuxToNextKeyFrame(int64_t aTimeThreshold, uint32_t& parsed
|
||||
|
||||
// Loop until we reach the next keyframe after the threshold.
|
||||
while (true) {
|
||||
nsAutoPtr<MediaSample> compressed(PopSample(kVideo));
|
||||
nsAutoPtr<MP4Sample> compressed(PopSample(kVideo));
|
||||
if (!compressed) {
|
||||
// EOS, or error. This code assumes EOS, which may or may not be right.
|
||||
MonitorAutoLock mon(mVideo.mMonitor);
|
||||
@ -956,8 +948,8 @@ MP4Reader::SkipVideoDemuxToNextKeyFrame(int64_t aTimeThreshold, uint32_t& parsed
|
||||
return false;
|
||||
}
|
||||
parsed++;
|
||||
if (!compressed->mMp4Sample->is_sync_point ||
|
||||
compressed->mMp4Sample->composition_timestamp < aTimeThreshold) {
|
||||
if (!compressed->is_sync_point ||
|
||||
compressed->composition_timestamp < aTimeThreshold) {
|
||||
continue;
|
||||
}
|
||||
mQueuedVideoSample = compressed;
|
||||
@ -981,14 +973,14 @@ MP4Reader::Seek(int64_t aTime, int64_t aEndTime)
|
||||
int64_t seekTime = aTime;
|
||||
mQueuedVideoSample = nullptr;
|
||||
if (mDemuxer->HasValidVideo()) {
|
||||
mVideo.mTrackDemuxer->Seek(seekTime);
|
||||
mDemuxer->SeekVideo(seekTime);
|
||||
mQueuedVideoSample = PopSampleLocked(kVideo);
|
||||
if (mQueuedVideoSample) {
|
||||
seekTime = mQueuedVideoSample->mMp4Sample->composition_timestamp;
|
||||
seekTime = mQueuedVideoSample->composition_timestamp;
|
||||
}
|
||||
}
|
||||
if (mDemuxer->HasValidAudio()) {
|
||||
mAudio.mTrackDemuxer->Seek(seekTime);
|
||||
mDemuxer->SeekAudio(seekTime);
|
||||
}
|
||||
LOG("MP4Reader::Seek(%lld) exit", aTime);
|
||||
return SeekPromise::CreateAndResolve(seekTime, __func__);
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "nsAutoPtr.h"
|
||||
#include "PlatformDecoderModule.h"
|
||||
#include "mp4_demuxer/mp4_demuxer.h"
|
||||
#include "demuxer/TrackDemuxer.h"
|
||||
#include "MediaTaskQueue.h"
|
||||
|
||||
#include <deque>
|
||||
@ -23,7 +22,7 @@ namespace dom {
|
||||
class TimeRanges;
|
||||
}
|
||||
|
||||
typedef std::deque<MediaSample*> MediaSampleQueue;
|
||||
typedef std::deque<mp4_demuxer::MP4Sample*> MP4SampleQueue;
|
||||
|
||||
class MP4Stream;
|
||||
|
||||
@ -102,8 +101,8 @@ private:
|
||||
|
||||
// Blocks until the demuxer produces an sample of specified type.
|
||||
// Returns nullptr on error on EOS. Caller must delete sample.
|
||||
MediaSample* PopSample(mp4_demuxer::TrackType aTrack);
|
||||
MediaSample* PopSampleLocked(mp4_demuxer::TrackType aTrack);
|
||||
mp4_demuxer::MP4Sample* PopSample(mp4_demuxer::TrackType aTrack);
|
||||
mp4_demuxer::MP4Sample* PopSampleLocked(mp4_demuxer::TrackType aTrack);
|
||||
|
||||
bool SkipVideoDemuxToNextKeyFrame(int64_t aTimeThreshold, uint32_t& parsed);
|
||||
|
||||
@ -128,9 +127,8 @@ private:
|
||||
size_t SizeOfQueue(TrackType aTrack);
|
||||
|
||||
nsRefPtr<MP4Stream> mStream;
|
||||
nsRefPtr<mp4_demuxer::MP4Demuxer> mDemuxer;
|
||||
nsAutoPtr<mp4_demuxer::MP4Demuxer> mDemuxer;
|
||||
nsRefPtr<PlatformDecoderModule> mPlatform;
|
||||
mp4_demuxer::CryptoFile mCrypto;
|
||||
|
||||
class DecoderCallback : public MediaDataDecoderCallback {
|
||||
public:
|
||||
@ -183,7 +181,6 @@ private:
|
||||
{
|
||||
}
|
||||
|
||||
nsAutoPtr<TrackDemuxer> mTrackDemuxer;
|
||||
// The platform decoder.
|
||||
nsRefPtr<MediaDataDecoder> mDecoder;
|
||||
// TaskQueue on which decoder can choose to decode.
|
||||
@ -242,7 +239,7 @@ private:
|
||||
|
||||
// Queued samples extracted by the demuxer, but not yet sent to the platform
|
||||
// decoder.
|
||||
nsAutoPtr<MediaSample> mQueuedVideoSample;
|
||||
nsAutoPtr<mp4_demuxer::MP4Sample> mQueuedVideoSample;
|
||||
|
||||
// Returns true when the decoder for this track needs input.
|
||||
// aDecoder.mMonitor must be locked.
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
|
||||
nsRefPtr<MockMediaResource> resource;
|
||||
Monitor mMonitor;
|
||||
nsRefPtr<MP4Demuxer> demuxer;
|
||||
nsAutoPtr<MP4Demuxer> demuxer;
|
||||
|
||||
explicit MP4DemuxerBinding(const char* aFileName = "dash_dashinit.mp4")
|
||||
: resource(new MockMediaResource(aFileName))
|
||||
|
@ -1,57 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mp4_demuxer/MP4TrackDemuxer.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
namespace mp4_demuxer {
|
||||
|
||||
void
|
||||
MP4AudioDemuxer::Seek(Microseconds aTime)
|
||||
{
|
||||
mDemuxer->SeekAudio(aTime);
|
||||
}
|
||||
|
||||
MediaSample*
|
||||
MP4AudioDemuxer::DemuxSample()
|
||||
{
|
||||
nsAutoPtr<MP4Sample> sample(mDemuxer->DemuxAudioSample());
|
||||
if (!sample) {
|
||||
return nullptr;
|
||||
}
|
||||
return new MediaSample(sample.forget());
|
||||
}
|
||||
|
||||
Microseconds
|
||||
MP4AudioDemuxer::GetNextKeyframeTime()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
MP4VideoDemuxer::Seek(Microseconds aTime)
|
||||
{
|
||||
mDemuxer->SeekVideo(aTime);
|
||||
}
|
||||
|
||||
MediaSample*
|
||||
MP4VideoDemuxer::DemuxSample()
|
||||
{
|
||||
nsAutoPtr<MP4Sample> sample(mDemuxer->DemuxVideoSample());
|
||||
if (!sample) {
|
||||
return nullptr;
|
||||
}
|
||||
return new MediaSample(sample.forget());
|
||||
}
|
||||
|
||||
Microseconds
|
||||
MP4VideoDemuxer::GetNextKeyframeTime()
|
||||
{
|
||||
return mDemuxer->GetNextKeyframeTime();
|
||||
}
|
||||
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef TRACK_DEMUXER_H_
|
||||
#define TRACK_DEMUXER_H_
|
||||
|
||||
namespace mp4_demuxer { class MP4Sample; }
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class MediaByteRange;
|
||||
|
||||
typedef int64_t Microseconds;
|
||||
|
||||
class MediaSample {
|
||||
public:
|
||||
explicit MediaSample(mp4_demuxer::MP4Sample* aMp4Sample) : mMp4Sample(aMp4Sample)
|
||||
{
|
||||
}
|
||||
|
||||
nsAutoPtr<mp4_demuxer::MP4Sample> mMp4Sample;
|
||||
};
|
||||
|
||||
class TrackDemuxer {
|
||||
public:
|
||||
TrackDemuxer() {}
|
||||
virtual ~TrackDemuxer() {}
|
||||
|
||||
virtual void Seek(Microseconds aTime) = 0;
|
||||
|
||||
// DemuxSample returns nullptr on end of stream or error.
|
||||
virtual MediaSample* DemuxSample() = 0;
|
||||
|
||||
// Returns timestamp of next keyframe, or -1 if demuxer can't
|
||||
// report this.
|
||||
virtual Microseconds GetNextKeyframeTime() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -44,12 +44,6 @@ struct PsshInfo
|
||||
class CryptoFile
|
||||
{
|
||||
public:
|
||||
CryptoFile() {}
|
||||
CryptoFile(const CryptoFile& aCryptoFile) : valid(aCryptoFile.valid)
|
||||
{
|
||||
pssh.AppendElements(aCryptoFile.pssh);
|
||||
}
|
||||
|
||||
void Update(stagefright::sp<stagefright::MetaData>& aMetaData)
|
||||
{
|
||||
valid = DoUpdate(aMetaData);
|
||||
|
@ -1,38 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef MP4_TRACK_DEMUXER_H_
|
||||
#define MP4_TRACK_DEMUXER_H_
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "demuxer/TrackDemuxer.h"
|
||||
|
||||
namespace mp4_demuxer
|
||||
{
|
||||
|
||||
class MP4AudioDemuxer : public mozilla::TrackDemuxer {
|
||||
public:
|
||||
explicit MP4AudioDemuxer(MP4Demuxer* aDemuxer) : mDemuxer(aDemuxer) {}
|
||||
virtual void Seek(Microseconds aTime) MOZ_OVERRIDE;
|
||||
virtual mozilla::MediaSample* DemuxSample() MOZ_OVERRIDE;
|
||||
virtual Microseconds GetNextKeyframeTime() MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
nsRefPtr<MP4Demuxer> mDemuxer;
|
||||
};
|
||||
|
||||
class MP4VideoDemuxer : public mozilla::TrackDemuxer {
|
||||
public:
|
||||
explicit MP4VideoDemuxer(MP4Demuxer* aDemuxer) : mDemuxer(aDemuxer) {}
|
||||
virtual void Seek(Microseconds aTime) MOZ_OVERRIDE;
|
||||
virtual mozilla::MediaSample* DemuxSample() MOZ_OVERRIDE;
|
||||
virtual Microseconds GetNextKeyframeTime() MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
nsRefPtr<MP4Demuxer> mDemuxer;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -43,9 +43,8 @@ enum TrackType { kVideo = 1, kAudio };
|
||||
class MP4Demuxer
|
||||
{
|
||||
public:
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MP4Demuxer)
|
||||
|
||||
explicit MP4Demuxer(Stream* aSource, Monitor* aMonitor);
|
||||
~MP4Demuxer();
|
||||
|
||||
bool Init();
|
||||
Microseconds Duration();
|
||||
@ -78,9 +77,6 @@ public:
|
||||
// report this.
|
||||
Microseconds GetNextKeyframeTime();
|
||||
|
||||
protected:
|
||||
~MP4Demuxer();
|
||||
|
||||
private:
|
||||
AudioDecoderConfig mAudioConfig;
|
||||
VideoDecoderConfig mVideoConfig;
|
||||
|
@ -60,14 +60,9 @@ EXPORTS.mp4_demuxer += [
|
||||
'binding/include/mp4_demuxer/Interval.h',
|
||||
'binding/include/mp4_demuxer/MoofParser.h',
|
||||
'binding/include/mp4_demuxer/mp4_demuxer.h',
|
||||
'binding/include/mp4_demuxer/MP4TrackDemuxer.h',
|
||||
'binding/include/mp4_demuxer/SinfParser.h',
|
||||
]
|
||||
|
||||
EXPORTS.demuxer += [
|
||||
'binding/include/demuxer/TrackDemuxer.h',
|
||||
]
|
||||
|
||||
SOURCES += [
|
||||
'frameworks/av/media/libstagefright/foundation/hexdump.cpp',
|
||||
'frameworks/av/media/libstagefright/MetaData.cpp',
|
||||
@ -87,7 +82,6 @@ UNIFIED_SOURCES += [
|
||||
'binding/Index.cpp',
|
||||
'binding/MoofParser.cpp',
|
||||
'binding/mp4_demuxer.cpp',
|
||||
'binding/MP4TrackDemuxer.cpp',
|
||||
'binding/SinfParser.cpp',
|
||||
'frameworks/av/media/libstagefright/DataSource.cpp',
|
||||
'frameworks/av/media/libstagefright/ESDS.cpp',
|
||||
|
Loading…
Reference in New Issue
Block a user