☠☠ backed out by a9fc09c6af94 ☠ ☠ | |
author | Matt Woodrow <mwoodrow@mozilla.com> |
Tue, 28 Oct 2014 17:48:24 +1300 | |
changeset 212590 | ac5e69c40ff179437831074827e1105f2503341e |
parent 212589 | bfa9cf004a661fb5a30c8eae9ffe00a4ec1bedc9 |
child 212591 | 982fc6c2f76b0b52215d7655df7836142799927d |
push id | 27721 |
push user | cbook@mozilla.com |
push date | Tue, 28 Oct 2014 14:55:05 +0000 |
treeherder | mozilla-central@c0ddb1b098ec [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | cajbir |
bugs | 1089480 |
milestone | 36.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/media/MediaDecoderReader.cpp +++ b/dom/media/MediaDecoderReader.cpp @@ -15,25 +15,20 @@ namespace mozilla { // Un-comment to enable logging of seek bisections. //#define SEEK_LOGGING #ifdef PR_LOGGING extern PRLogModuleInfo* gMediaDecoderLog; -#define DECODER_LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg) -#ifdef SEEK_LOGGING -#define SEEK_LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg) +#define DECODER_LOG(x, ...) \ + PR_LOG(gMediaDecoderLog, PR_LOG_DEBUG, ("Decoder=%p " x, mDecoder, ##__VA_ARGS__)) #else -#define SEEK_LOG(type, msg) -#endif -#else -#define DECODER_LOG(type, msg) -#define SEEK_LOG(type, msg) +#define DECODER_LOG(x, ...) #endif class VideoQueueMemoryFunctor : public nsDequeFunctor { public: VideoQueueMemoryFunctor() : mSize(0) {} MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf); @@ -134,16 +129,32 @@ MediaDecoderReader::GetBuffered(mozilla: { ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); durationUs = mDecoder->GetMediaDuration(); } GetEstimatedBufferedTimeRanges(stream, durationUs, aBuffered); return NS_OK; } +int64_t +MediaDecoderReader::ComputeStartTime() +{ + const VideoData* v = VideoQueue().PeekFront(); + const AudioData* a = AudioQueue().PeekFront(); + + int64_t startTime = std::min<int64_t>(a ? a->mTime : INT64_MAX, + v ? v->mTime : INT64_MAX); + if (startTime == INT64_MAX) { + startTime = 0; + } + DECODER_LOG("ComputeStartTime first video frame start %lld", v ? v->mTime : -1); + DECODER_LOG("ComputeStartTime first audio frame start %lld", a ? a->mTime : -1); + return startTime; +} + class RequestVideoWithSkipTask : public nsRunnable { public: RequestVideoWithSkipTask(MediaDecoderReader* aReader, int64_t aTimeThreshold) : mReader(aReader) , mTimeThreshold(aTimeThreshold) { }
--- a/dom/media/MediaDecoderReader.h +++ b/dom/media/MediaDecoderReader.h @@ -143,16 +143,18 @@ public: // is that it's a fast approximation, which does not perform any I/O. // // The OggReader relies on this base implementation not performing I/O, // since in FirefoxOS we can't do I/O on the main thread, where this is // called. virtual nsresult GetBuffered(dom::TimeRanges* aBuffered, int64_t aStartTime); + virtual int64_t ComputeStartTime(); + // Returns the number of bytes of memory allocated by structures/frames in // the video queue. size_t SizeOfVideoQueueInBytes() const; // Returns the number of bytes of memory allocated by structures/frames in // the audio queue. size_t SizeOfAudioQueueInBytes() const;
--- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -2011,28 +2011,17 @@ MediaDecoderStateMachine::FinishDecodeMe NS_ASSERTION(OnDecodeThread(), "Should be on decode thread."); DECODER_LOG("FinishDecodeMetadata"); if (mState == DECODER_STATE_SHUTDOWN) { return NS_ERROR_FAILURE; } if (!mScheduler->IsRealTime() && !mDecodingFrozenAtStateMetadata) { - - const VideoData* v = VideoQueue().PeekFront(); - const AudioData* a = AudioQueue().PeekFront(); - - int64_t startTime = std::min<int64_t>(a ? a->mTime : INT64_MAX, - v ? v->mTime : INT64_MAX); - if (startTime == INT64_MAX) { - startTime = 0; - } - DECODER_LOG("DecodeMetadata first video frame start %lld", v ? v->mTime : -1); - DECODER_LOG("DecodeMetadata first audio frame start %lld", a ? a->mTime : -1); - SetStartTime(startTime); + SetStartTime(mReader->ComputeStartTime()); if (VideoQueue().GetSize()) { ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor()); RenderVideoFrame(VideoQueue().PeekFront(), TimeStamp::Now()); } } NS_ASSERTION(mStartTime != -1, "Must have start time"); MOZ_ASSERT((!HasVideo() && !HasAudio()) ||
--- a/dom/media/mediasource/MediaSourceReader.h +++ b/dom/media/mediasource/MediaSourceReader.h @@ -65,16 +65,21 @@ public: return mInfo.HasVideo(); } bool HasAudio() MOZ_OVERRIDE { return mInfo.HasAudio(); } + // We can't compute a proper start time since we won't necessarily + // have the first frame of the resource available. This does the same + // as chrome/blink and assumes that we always start at t=0. + virtual int64_t ComputeStartTime() MOZ_OVERRIDE { return 0; } + bool IsMediaSeekable() { return true; } nsresult ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) MOZ_OVERRIDE; nsresult Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime, int64_t aCurrentTime) MOZ_OVERRIDE; already_AddRefed<SourceBufferDecoder> CreateSubDecoder(const nsACString& aType);