зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1089480 - Assume a start time of 0 for MSE videos. r=cajbir
--HG-- extra : rebase_source : fb44192e9f7f97a9ed1d753dd185dc82fdeaaa48
This commit is contained in:
Родитель
b6106b43d2
Коммит
1668f024f7
|
@ -20,15 +20,10 @@ namespace mozilla {
|
|||
|
||||
#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 {
|
||||
|
@ -139,6 +134,20 @@ MediaDecoderReader::GetBuffered(mozilla::dom::TimeRanges* aBuffered,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
int64_t
|
||||
MediaDecoderReader::ComputeStartTime(const VideoData* aVideo, const AudioData* aAudio)
|
||||
{
|
||||
int64_t startTime = std::min<int64_t>(aAudio ? aAudio->mTime : INT64_MAX,
|
||||
aVideo ? aVideo->mTime : INT64_MAX);
|
||||
if (startTime == INT64_MAX) {
|
||||
startTime = 0;
|
||||
}
|
||||
DECODER_LOG("ComputeStartTime first video frame start %lld", aVideo ? aVideo->mTime : -1);
|
||||
DECODER_LOG("ComputeStartTime first audio frame start %lld", aAudio ? aAudio->mTime : -1);
|
||||
MOZ_ASSERT(startTime >= 0);
|
||||
return startTime;
|
||||
}
|
||||
|
||||
class RequestVideoWithSkipTask : public nsRunnable {
|
||||
public:
|
||||
RequestVideoWithSkipTask(MediaDecoderReader* aReader,
|
||||
|
|
|
@ -148,6 +148,8 @@ public:
|
|||
virtual nsresult GetBuffered(dom::TimeRanges* aBuffered,
|
||||
int64_t aStartTime);
|
||||
|
||||
virtual int64_t ComputeStartTime(const VideoData* aVideo, const AudioData* aAudio);
|
||||
|
||||
// Returns the number of bytes of memory allocated by structures/frames in
|
||||
// the video queue.
|
||||
size_t SizeOfVideoQueueInBytes() const;
|
||||
|
|
|
@ -2016,18 +2016,9 @@ MediaDecoderStateMachine::FinishDecodeMetadata()
|
|||
}
|
||||
|
||||
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(v, a));
|
||||
if (VideoQueue().GetSize()) {
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
RenderVideoFrame(VideoQueue().PeekFront(), TimeStamp::Now());
|
||||
|
|
|
@ -70,6 +70,11 @@ public:
|
|||
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(const VideoData* aVideo, const AudioData* aAudio) MOZ_OVERRIDE { return 0; }
|
||||
|
||||
bool IsMediaSeekable() { return true; }
|
||||
|
||||
nsresult ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) MOZ_OVERRIDE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче