mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 06:43:32 +00:00
Backed out 3 changesets (bug 1878510, bug 1900191, bug 1904168) for causing build bustages in TrackBuffersManager.cpp. a=backout
Backed out changeset 50b824509129 (bug 1904168) Backed out changeset fb0b0f4b0395 (bug 1900191) Backed out changeset fec193c3620a (bug 1878510)
This commit is contained in:
parent
d09bff4b08
commit
f59e7b0f6e
@ -917,11 +917,7 @@ void TrackBuffersManager::SegmentParserLoop() {
|
||||
if (mNewMediaSegmentStarted) {
|
||||
if (NS_SUCCEEDED(newData) && mLastParsedEndTime.isSome() &&
|
||||
start < mLastParsedEndTime.ref()) {
|
||||
MSE_DEBUG("Re-creating demuxer, new start (%" PRId64
|
||||
") is smaller than last parsed end time (%" PRId64 ")",
|
||||
start.ToMicroseconds(),
|
||||
mLastParsedEndTime->ToMicroseconds());
|
||||
mFrameEndTimeBeforeRecreateDemuxer = Some(end);
|
||||
MSE_DEBUG("Re-creating demuxer");
|
||||
ResetDemuxingState();
|
||||
return;
|
||||
}
|
||||
@ -1037,15 +1033,8 @@ void TrackBuffersManager::CreateDemuxerforMIMEType() {
|
||||
|
||||
if (mType.Type() == MEDIAMIMETYPE(VIDEO_WEBM) ||
|
||||
mType.Type() == MEDIAMIMETYPE(AUDIO_WEBM)) {
|
||||
if (mFrameEndTimeBeforeRecreateDemuxer) {
|
||||
MSE_DEBUG(
|
||||
"CreateDemuxerFromMimeType: "
|
||||
"mFrameEndTimeBeforeRecreateDemuxer=%" PRId64,
|
||||
mFrameEndTimeBeforeRecreateDemuxer->ToMicroseconds());
|
||||
}
|
||||
mInputDemuxer = new WebMDemuxer(mCurrentInputBuffer, true,
|
||||
mFrameEndTimeBeforeRecreateDemuxer);
|
||||
mFrameEndTimeBeforeRecreateDemuxer.reset();
|
||||
mInputDemuxer =
|
||||
new WebMDemuxer(mCurrentInputBuffer, true /* IsMediaSource*/);
|
||||
DDLINKCHILD("demuxer", mInputDemuxer.get());
|
||||
return;
|
||||
}
|
||||
@ -1054,7 +1043,6 @@ void TrackBuffersManager::CreateDemuxerforMIMEType() {
|
||||
if (mType.Type() == MEDIAMIMETYPE(VIDEO_MP4) ||
|
||||
mType.Type() == MEDIAMIMETYPE(AUDIO_MP4)) {
|
||||
mInputDemuxer = new MP4Demuxer(mCurrentInputBuffer);
|
||||
mFrameEndTimeBeforeRecreateDemuxer.reset();
|
||||
DDLINKCHILD("demuxer", mInputDemuxer.get());
|
||||
return;
|
||||
}
|
||||
@ -1634,11 +1622,9 @@ void TrackBuffersManager::MaybeDispatchEncryptedEvent(
|
||||
void TrackBuffersManager::OnVideoDemuxCompleted(
|
||||
RefPtr<MediaTrackDemuxer::SamplesHolder> aSamples) {
|
||||
mTaskQueueCapability->AssertOnCurrentThread();
|
||||
MSE_DEBUG("%zu video samples demuxed", aSamples->GetSamples().Length());
|
||||
mVideoTracks.mDemuxRequest.Complete();
|
||||
mVideoTracks.mQueuedSamples.AppendElements(aSamples->GetSamples());
|
||||
MSE_DEBUG("%zu video samples demuxed, queued-sz=%zu",
|
||||
aSamples->GetSamples().Length(),
|
||||
mVideoTracks.mQueuedSamples.Length());
|
||||
|
||||
MaybeDispatchEncryptedEvent(aSamples->GetSamples());
|
||||
DoDemuxAudio();
|
||||
@ -1889,9 +1875,6 @@ void TrackBuffersManager::ProcessFrames(TrackBuffer& aSamples,
|
||||
// coded frame.
|
||||
if (!sample->mKeyframe) {
|
||||
previouslyDroppedSample = nullptr;
|
||||
SAMPLE_DEBUGV("skipping sample [%" PRId64 ",%" PRId64 "]",
|
||||
sample->mTime.ToMicroseconds(),
|
||||
sample->GetEndTime().ToMicroseconds());
|
||||
continue;
|
||||
}
|
||||
// 2. Set the need random access point flag on track buffer to false.
|
||||
@ -1968,7 +1951,6 @@ void TrackBuffersManager::ProcessFrames(TrackBuffer& aSamples,
|
||||
// 4. Unset the highest end timestamp on all track buffers.
|
||||
// 5. Set the need random access point flag on all track buffers to
|
||||
// true.
|
||||
MSE_DEBUG("Resetting append state");
|
||||
track->ResetAppendState();
|
||||
}
|
||||
// 6. Jump to the Loop Top step above to restart processing of the current
|
||||
@ -2487,12 +2469,10 @@ void TrackBuffersManager::RecreateParser(bool aReuseInitData) {
|
||||
mParser = ContainerParser::CreateForMIMEType(mType);
|
||||
DDLINKCHILD("parser", mParser.get());
|
||||
if (aReuseInitData && mInitData) {
|
||||
MSE_DEBUG("Using existing init data to reset parser");
|
||||
TimeUnit start, end;
|
||||
mParser->ParseStartAndEndTimestamps(MediaSpan(mInitData), start, end);
|
||||
mProcessedInput = mInitData->Length();
|
||||
} else {
|
||||
MSE_DEBUG("Resetting parser, not reusing init data");
|
||||
mProcessedInput = 0;
|
||||
}
|
||||
}
|
||||
@ -2777,20 +2757,12 @@ const MediaRawData* TrackBuffersManager::GetSample(TrackInfo::TrackType aTrack,
|
||||
const TrackBuffer& track = GetTrackBuffer(aTrack);
|
||||
|
||||
if (aIndex >= track.Length()) {
|
||||
MSE_DEBUGV(
|
||||
"Can't get sample due to reaching to the end, index=%u, "
|
||||
"length=%zu",
|
||||
aIndex, track.Length());
|
||||
// reached the end.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!(aExpectedDts + aFuzz).IsValid() || !(aExpectedPts + aFuzz).IsValid()) {
|
||||
// Time overflow, it seems like we also reached the end.
|
||||
MSE_DEBUGV("Can't get sample due to time overflow, expectedPts=%" PRId64
|
||||
", aExpectedDts=%" PRId64 ", fuzz=%" PRId64,
|
||||
aExpectedPts.ToMicroseconds(), aExpectedPts.ToMicroseconds(),
|
||||
aFuzz.ToMicroseconds());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -2801,12 +2773,6 @@ const MediaRawData* TrackBuffersManager::GetSample(TrackInfo::TrackType aTrack,
|
||||
return sample;
|
||||
}
|
||||
|
||||
MSE_DEBUGV("Can't get sample due to big gap, sample=%" PRId64
|
||||
", expectedPts=%" PRId64 ", aExpectedDts=%" PRId64
|
||||
", fuzz=%" PRId64,
|
||||
sample->mTime.ToMicroseconds(), aExpectedPts.ToMicroseconds(),
|
||||
aExpectedPts.ToMicroseconds(), aFuzz.ToMicroseconds());
|
||||
|
||||
// Gap is too big. End of Stream or Waiting for Data.
|
||||
// TODO, check that we have continuous data based on the sanitized buffered
|
||||
// range instead.
|
||||
|
@ -561,8 +561,6 @@ class TrackBuffersManager final
|
||||
// mTaskQueue. However, there's special locking around mTaskQueue, so we keep
|
||||
// both for now.
|
||||
Maybe<EventTargetCapability<TaskQueue>> mTaskQueueCapability;
|
||||
|
||||
Maybe<media::TimeUnit> mFrameEndTimeBeforeRecreateDemuxer;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -25,12 +25,11 @@ class NesteggPacketHolder {
|
||||
mOffset(-1),
|
||||
mTimestamp(-1),
|
||||
mDuration(-1),
|
||||
mDefaultDuration(-1),
|
||||
mTrack(0),
|
||||
mIsKeyframe(false) {}
|
||||
|
||||
bool Init(nestegg_packet* aPacket, nestegg* aContext, int64_t aOffset,
|
||||
unsigned aTrack, bool aIsKeyframe) {
|
||||
bool Init(nestegg_packet* aPacket, int64_t aOffset, unsigned aTrack,
|
||||
bool aIsKeyframe) {
|
||||
uint64_t timestamp_ns;
|
||||
if (nestegg_packet_tstamp(aPacket, ×tamp_ns) == -1) {
|
||||
return false;
|
||||
@ -48,10 +47,6 @@ class NesteggPacketHolder {
|
||||
if (!nestegg_packet_duration(aPacket, &duration_ns)) {
|
||||
mDuration = duration_ns / 1000;
|
||||
}
|
||||
if (!nestegg_track_default_duration(aContext, mTrack, &duration_ns)) {
|
||||
mDefaultDuration = duration_ns / 1000;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -71,10 +66,6 @@ class NesteggPacketHolder {
|
||||
MOZ_ASSERT(IsInitialized());
|
||||
return mDuration;
|
||||
}
|
||||
int64_t DefaultDuration() const {
|
||||
MOZ_ASSERT(IsInitialized());
|
||||
return mDefaultDuration;
|
||||
}
|
||||
unsigned Track() {
|
||||
MOZ_ASSERT(IsInitialized());
|
||||
return mTrack;
|
||||
@ -87,7 +78,7 @@ class NesteggPacketHolder {
|
||||
private:
|
||||
~NesteggPacketHolder() { nestegg_free_packet(mPacket); }
|
||||
|
||||
bool IsInitialized() const { return mOffset >= 0; }
|
||||
bool IsInitialized() { return mOffset >= 0; }
|
||||
|
||||
nestegg_packet* mPacket;
|
||||
|
||||
@ -99,13 +90,8 @@ class NesteggPacketHolder {
|
||||
int64_t mTimestamp;
|
||||
|
||||
// Packet duration in microseconds; -1 if unknown or retrieval failed.
|
||||
// https://www.webmproject.org/docs/container/#BlockDuration
|
||||
int64_t mDuration;
|
||||
|
||||
// Default durtaion in microseconds; -1 if unknown or retrieval failed.
|
||||
// https://www.webmproject.org/docs/container/#Duration
|
||||
int64_t mDefaultDuration;
|
||||
|
||||
// Track ID.
|
||||
unsigned mTrack;
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "gfx2DGlue.h"
|
||||
#include "gfxUtils.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/SharedThreadPool.h"
|
||||
#include "MediaDataDemuxer.h"
|
||||
#include "nsAutoRef.h"
|
||||
@ -152,9 +151,7 @@ int WebMDemuxer::NestEggContext::Init() {
|
||||
WebMDemuxer::WebMDemuxer(MediaResource* aResource)
|
||||
: WebMDemuxer(aResource, false) {}
|
||||
|
||||
WebMDemuxer::WebMDemuxer(
|
||||
MediaResource* aResource, bool aIsMediaSource,
|
||||
Maybe<media::TimeUnit> aFrameEndTimeBeforeRecreateDemuxer)
|
||||
WebMDemuxer::WebMDemuxer(MediaResource* aResource, bool aIsMediaSource)
|
||||
: mVideoContext(this, aResource),
|
||||
mAudioContext(this, aResource),
|
||||
mBufferedState(nullptr),
|
||||
@ -173,14 +170,6 @@ WebMDemuxer::WebMDemuxer(
|
||||
// Audio/video contexts hold a MediaResourceIndex.
|
||||
DDLINKCHILD("video context", mVideoContext.GetResource());
|
||||
DDLINKCHILD("audio context", mAudioContext.GetResource());
|
||||
|
||||
MOZ_ASSERT_IF(!aIsMediaSource,
|
||||
aFrameEndTimeBeforeRecreateDemuxer.isNothing());
|
||||
if (aIsMediaSource && aFrameEndTimeBeforeRecreateDemuxer) {
|
||||
mVideoFrameEndTimeBeforeReset = aFrameEndTimeBeforeRecreateDemuxer;
|
||||
WEBM_DEBUG("Set mVideoFrameEndTimeBeforeReset=%" PRId64,
|
||||
mVideoFrameEndTimeBeforeReset->ToMicroseconds());
|
||||
}
|
||||
}
|
||||
|
||||
WebMDemuxer::~WebMDemuxer() {
|
||||
@ -597,12 +586,6 @@ nsresult WebMDemuxer::GetNextPacket(TrackInfo::TrackType aType,
|
||||
}
|
||||
int64_t tstamp = holder->Timestamp();
|
||||
int64_t duration = holder->Duration();
|
||||
int64_t defaultDuration = holder->DefaultDuration();
|
||||
if (aType == TrackInfo::TrackType::kVideoTrack) {
|
||||
WEBM_DEBUG("GetNextPacket(video): tstamp=%" PRId64 ", duration=%" PRId64
|
||||
", defaultDuration=%" PRId64,
|
||||
tstamp, duration, defaultDuration);
|
||||
}
|
||||
|
||||
// The end time of this frame is the start time of the next frame. Fetch
|
||||
// the timestamp of the next packet for this track. If we've reached the
|
||||
@ -624,12 +607,6 @@ nsresult WebMDemuxer::GetNextPacket(TrackInfo::TrackType aType,
|
||||
next_tstamp = tstamp + duration;
|
||||
} else if (lastFrameTime.isSome()) {
|
||||
next_tstamp = tstamp + (tstamp - lastFrameTime.ref());
|
||||
} else if (defaultDuration >= 0) {
|
||||
next_tstamp = tstamp + defaultDuration;
|
||||
} else if (mVideoFrameEndTimeBeforeReset) {
|
||||
WEBM_DEBUG("Setting next timestamp to be %" PRId64 " us",
|
||||
mVideoFrameEndTimeBeforeReset->ToMicroseconds());
|
||||
next_tstamp = mVideoFrameEndTimeBeforeReset->ToMicroseconds();
|
||||
} else if (mIsMediaSource) {
|
||||
(this->*pushPacket)(holder);
|
||||
} else {
|
||||
@ -939,7 +916,7 @@ nsresult WebMDemuxer::DemuxPacket(TrackInfo::TrackType aType,
|
||||
|
||||
int64_t offset = Resource(aType).Tell();
|
||||
RefPtr<NesteggPacketHolder> holder = new NesteggPacketHolder();
|
||||
if (!holder->Init(packet, Context(aType), offset, track, false)) {
|
||||
if (!holder->Init(packet, offset, track, false)) {
|
||||
return NS_ERROR_DOM_MEDIA_DEMUXER_ERR;
|
||||
}
|
||||
|
||||
|
@ -94,9 +94,7 @@ class WebMDemuxer : public MediaDataDemuxer,
|
||||
explicit WebMDemuxer(MediaResource* aResource);
|
||||
// Indicate if the WebMDemuxer is to be used with MediaSource. In which
|
||||
// case the demuxer will stop reads to the last known complete block.
|
||||
WebMDemuxer(
|
||||
MediaResource* aResource, bool aIsMediaSource,
|
||||
Maybe<media::TimeUnit> aFrameEndTimeBeforeRecreateDemuxer = Nothing());
|
||||
WebMDemuxer(MediaResource* aResource, bool aIsMediaSource);
|
||||
|
||||
RefPtr<InitPromise> Init() override;
|
||||
|
||||
@ -225,8 +223,6 @@ class WebMDemuxer : public MediaDataDemuxer,
|
||||
Maybe<int64_t> mLastAudioFrameTime;
|
||||
Maybe<int64_t> mLastVideoFrameTime;
|
||||
|
||||
Maybe<media::TimeUnit> mVideoFrameEndTimeBeforeReset;
|
||||
|
||||
// Codec ID of audio track
|
||||
int mAudioCodec;
|
||||
// Codec ID of video track
|
||||
|
@ -70,15 +70,10 @@ nsresult SpeculativeTransaction::ReadSegments(nsAHttpSegmentReader* aReader,
|
||||
|
||||
void SpeculativeTransaction::Close(nsresult aReason) {
|
||||
MOZ_ASSERT(OnSocketThread(), "not on socket thread");
|
||||
LOG(("SpeculativeTransaction::Close %p aReason=%" PRIx32, this,
|
||||
static_cast<uint32_t>(aReason)));
|
||||
NullHttpTransaction::Close(aReason);
|
||||
|
||||
if (aReason == NS_BASE_STREAM_CLOSED) {
|
||||
aReason = NS_OK;
|
||||
}
|
||||
if (mCloseCallback) {
|
||||
mCloseCallback(mTriedToWrite && NS_SUCCEEDED(aReason));
|
||||
mCloseCallback(mTriedToWrite && aReason == NS_BASE_STREAM_CLOSED);
|
||||
mCloseCallback = nullptr;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user