2014-02-03 17:49:21 -08:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* 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/. */
|
2010-04-01 20:03:07 -07:00
|
|
|
|
2013-09-05 10:29:38 -07:00
|
|
|
#include "MediaDecoderReader.h"
|
2012-11-19 07:11:21 -08:00
|
|
|
#include "AbstractMediaDecoder.h"
|
2010-04-27 01:53:44 -07:00
|
|
|
#include "VideoUtils.h"
|
2012-08-20 21:06:46 -07:00
|
|
|
#include "ImageContainer.h"
|
2010-04-01 20:03:07 -07:00
|
|
|
|
2012-01-11 00:23:07 -08:00
|
|
|
#include "mozilla/mozalloc.h"
|
2013-07-30 07:25:31 -07:00
|
|
|
#include <stdint.h>
|
2013-01-15 04:22:03 -08:00
|
|
|
#include <algorithm>
|
2012-01-11 00:23:07 -08:00
|
|
|
|
2012-11-14 11:45:33 -08:00
|
|
|
namespace mozilla {
|
|
|
|
|
2010-04-01 20:03:07 -07:00
|
|
|
// Un-comment to enable logging of seek bisections.
|
|
|
|
//#define SEEK_LOGGING
|
|
|
|
|
|
|
|
#ifdef PR_LOGGING
|
2012-11-14 11:46:40 -08:00
|
|
|
extern PRLogModuleInfo* gMediaDecoderLog;
|
2013-11-20 19:02:42 -08:00
|
|
|
#define DECODER_LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg)
|
2010-04-01 20:03:07 -07:00
|
|
|
#ifdef SEEK_LOGGING
|
2012-11-14 11:46:40 -08:00
|
|
|
#define SEEK_LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg)
|
2010-04-01 20:03:07 -07:00
|
|
|
#else
|
|
|
|
#define SEEK_LOG(type, msg)
|
|
|
|
#endif
|
|
|
|
#else
|
2013-11-20 19:02:42 -08:00
|
|
|
#define DECODER_LOG(type, msg)
|
2010-04-01 20:03:07 -07:00
|
|
|
#define SEEK_LOG(type, msg)
|
|
|
|
#endif
|
|
|
|
|
2014-03-19 14:33:12 -07:00
|
|
|
class VideoQueueMemoryFunctor : public nsDequeFunctor {
|
|
|
|
public:
|
|
|
|
VideoQueueMemoryFunctor() : mSize(0) {}
|
|
|
|
|
|
|
|
MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf);
|
|
|
|
|
|
|
|
virtual void* operator()(void* aObject) {
|
|
|
|
const VideoData* v = static_cast<const VideoData*>(aObject);
|
|
|
|
mSize += v->SizeOfIncludingThis(MallocSizeOf);
|
2012-08-20 21:06:46 -07:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2014-03-19 14:33:12 -07:00
|
|
|
size_t mSize;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class AudioQueueMemoryFunctor : public nsDequeFunctor {
|
|
|
|
public:
|
|
|
|
AudioQueueMemoryFunctor() : mSize(0) {}
|
|
|
|
|
|
|
|
MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf);
|
|
|
|
|
|
|
|
virtual void* operator()(void* aObject) {
|
|
|
|
const AudioData* audioData = static_cast<const AudioData*>(aObject);
|
|
|
|
mSize += audioData->SizeOfIncludingThis(MallocSizeOf);
|
|
|
|
return nullptr;
|
2013-07-07 13:33:56 -07:00
|
|
|
}
|
2014-03-19 14:33:12 -07:00
|
|
|
|
|
|
|
size_t mSize;
|
|
|
|
};
|
2012-08-20 21:06:46 -07:00
|
|
|
|
2012-11-19 07:11:21 -08:00
|
|
|
MediaDecoderReader::MediaDecoderReader(AbstractMediaDecoder* aDecoder)
|
2014-02-05 15:11:25 -08:00
|
|
|
: mAudioCompactor(mAudioQueue),
|
|
|
|
mDecoder(aDecoder),
|
2013-08-29 02:43:44 -07:00
|
|
|
mIgnoreAudioOutputFormat(false)
|
2010-04-01 20:03:07 -07:00
|
|
|
{
|
2012-11-14 11:46:40 -08:00
|
|
|
MOZ_COUNT_CTOR(MediaDecoderReader);
|
2010-04-01 20:03:07 -07:00
|
|
|
}
|
|
|
|
|
2012-11-14 11:46:40 -08:00
|
|
|
MediaDecoderReader::~MediaDecoderReader()
|
2010-04-01 20:03:07 -07:00
|
|
|
{
|
|
|
|
ResetDecode();
|
2012-11-14 11:46:40 -08:00
|
|
|
MOZ_COUNT_DTOR(MediaDecoderReader);
|
2010-04-01 20:03:07 -07:00
|
|
|
}
|
|
|
|
|
2014-03-19 14:33:12 -07:00
|
|
|
size_t MediaDecoderReader::SizeOfVideoQueueInBytes() const
|
|
|
|
{
|
|
|
|
VideoQueueMemoryFunctor functor;
|
|
|
|
mVideoQueue.LockedForEach(functor);
|
|
|
|
return functor.mSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t MediaDecoderReader::SizeOfAudioQueueInBytes() const
|
|
|
|
{
|
|
|
|
AudioQueueMemoryFunctor functor;
|
|
|
|
mAudioQueue.LockedForEach(functor);
|
|
|
|
return functor.mSize;
|
|
|
|
}
|
|
|
|
|
2012-11-14 11:46:40 -08:00
|
|
|
nsresult MediaDecoderReader::ResetDecode()
|
2010-04-01 20:03:07 -07:00
|
|
|
{
|
|
|
|
nsresult res = NS_OK;
|
|
|
|
|
2012-12-06 15:27:08 -08:00
|
|
|
VideoQueue().Reset();
|
|
|
|
AudioQueue().Reset();
|
2010-04-01 20:03:07 -07:00
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2012-11-14 11:46:40 -08:00
|
|
|
VideoData* MediaDecoderReader::DecodeToFirstVideoData()
|
2012-11-06 14:33:01 -08:00
|
|
|
{
|
|
|
|
bool eof = false;
|
2012-12-06 15:27:08 -08:00
|
|
|
while (!eof && VideoQueue().GetSize() == 0) {
|
2012-11-06 14:33:01 -08:00
|
|
|
{
|
|
|
|
ReentrantMonitorAutoEnter decoderMon(mDecoder->GetReentrantMonitor());
|
2012-11-19 07:11:21 -08:00
|
|
|
if (mDecoder->IsShutdown()) {
|
2012-11-06 14:33:01 -08:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bool keyframeSkip = false;
|
|
|
|
eof = !DecodeVideoFrame(keyframeSkip, 0);
|
|
|
|
}
|
2014-02-24 21:45:03 -08:00
|
|
|
if (eof) {
|
|
|
|
VideoQueue().Finish();
|
|
|
|
}
|
2012-11-06 14:33:01 -08:00
|
|
|
VideoData* d = nullptr;
|
2012-12-06 15:27:08 -08:00
|
|
|
return (d = VideoQueue().PeekFront()) ? d : nullptr;
|
2012-11-06 14:33:01 -08:00
|
|
|
}
|
|
|
|
|
2012-11-14 11:46:40 -08:00
|
|
|
AudioData* MediaDecoderReader::DecodeToFirstAudioData()
|
2012-11-06 14:33:01 -08:00
|
|
|
{
|
|
|
|
bool eof = false;
|
2012-12-06 15:27:08 -08:00
|
|
|
while (!eof && AudioQueue().GetSize() == 0) {
|
2012-11-06 14:33:01 -08:00
|
|
|
{
|
|
|
|
ReentrantMonitorAutoEnter decoderMon(mDecoder->GetReentrantMonitor());
|
2012-11-19 07:11:21 -08:00
|
|
|
if (mDecoder->IsShutdown()) {
|
2012-11-06 14:33:01 -08:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
eof = !DecodeAudioData();
|
|
|
|
}
|
2014-02-24 21:45:03 -08:00
|
|
|
if (eof) {
|
|
|
|
AudioQueue().Finish();
|
|
|
|
}
|
2012-11-06 14:33:01 -08:00
|
|
|
AudioData* d = nullptr;
|
2012-12-06 15:27:08 -08:00
|
|
|
return (d = AudioQueue().PeekFront()) ? d : nullptr;
|
2012-11-06 14:33:01 -08:00
|
|
|
}
|
|
|
|
|
2012-11-14 11:46:40 -08:00
|
|
|
VideoData* MediaDecoderReader::FindStartTime(int64_t& aOutStartTime)
|
2010-04-01 20:03:07 -07:00
|
|
|
{
|
2011-07-11 20:39:23 -07:00
|
|
|
NS_ASSERTION(mDecoder->OnStateMachineThread() || mDecoder->OnDecodeThread(),
|
|
|
|
"Should be on state machine or decode thread.");
|
2010-04-01 20:03:07 -07:00
|
|
|
|
|
|
|
// Extract the start times of the bitstreams in order to calculate
|
|
|
|
// the duration.
|
2012-08-22 08:56:38 -07:00
|
|
|
int64_t videoStartTime = INT64_MAX;
|
|
|
|
int64_t audioStartTime = INT64_MAX;
|
2012-07-30 07:20:58 -07:00
|
|
|
VideoData* videoData = nullptr;
|
2010-04-01 20:03:07 -07:00
|
|
|
|
|
|
|
if (HasVideo()) {
|
2012-11-06 14:33:01 -08:00
|
|
|
videoData = DecodeToFirstVideoData();
|
2010-04-01 20:03:07 -07:00
|
|
|
if (videoData) {
|
|
|
|
videoStartTime = videoData->mTime;
|
2013-11-20 19:02:42 -08:00
|
|
|
DECODER_LOG(PR_LOG_DEBUG, ("MediaDecoderReader::FindStartTime() video=%lld", videoStartTime));
|
2010-04-01 20:03:07 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (HasAudio()) {
|
2012-11-06 14:33:01 -08:00
|
|
|
AudioData* audioData = DecodeToFirstAudioData();
|
2011-08-15 22:19:51 -07:00
|
|
|
if (audioData) {
|
|
|
|
audioStartTime = audioData->mTime;
|
2013-11-20 19:02:42 -08:00
|
|
|
DECODER_LOG(PR_LOG_DEBUG, ("MediaDecoderReader::FindStartTime() audio=%lld", audioStartTime));
|
2010-04-01 20:03:07 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-15 04:22:03 -08:00
|
|
|
int64_t startTime = std::min(videoStartTime, audioStartTime);
|
2012-01-11 00:23:07 -08:00
|
|
|
if (startTime != INT64_MAX) {
|
2010-04-01 20:03:07 -07:00
|
|
|
aOutStartTime = startTime;
|
|
|
|
}
|
|
|
|
|
|
|
|
return videoData;
|
|
|
|
}
|
|
|
|
|
2012-11-14 11:46:40 -08:00
|
|
|
nsresult MediaDecoderReader::DecodeToTarget(int64_t aTarget)
|
2010-08-12 19:28:15 -07:00
|
|
|
{
|
2013-11-20 19:02:42 -08:00
|
|
|
DECODER_LOG(PR_LOG_DEBUG, ("MediaDecoderReader::DecodeToTarget(%lld) Begin", aTarget));
|
2013-08-12 21:49:25 -07:00
|
|
|
|
2010-08-12 19:28:15 -07:00
|
|
|
// Decode forward to the target frame. Start with video, if we have it.
|
|
|
|
if (HasVideo()) {
|
2014-03-31 20:39:04 -07:00
|
|
|
// Note: when decoding hits the end of stream we must keep the last frame
|
|
|
|
// in the video queue so that we'll have something to display after the
|
|
|
|
// seek completes. This makes our logic a bit messy.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool eof = false;
|
2014-03-28 05:31:29 -07:00
|
|
|
nsAutoPtr<VideoData> video;
|
2010-08-12 19:28:15 -07:00
|
|
|
while (HasVideo() && !eof) {
|
2012-12-06 15:27:08 -08:00
|
|
|
while (VideoQueue().GetSize() == 0 && !eof) {
|
2011-09-28 23:19:26 -07:00
|
|
|
bool skip = false;
|
2010-08-12 19:28:15 -07:00
|
|
|
eof = !DecodeVideoFrame(skip, 0);
|
|
|
|
{
|
2011-04-29 12:21:57 -07:00
|
|
|
ReentrantMonitorAutoEnter decoderMon(mDecoder->GetReentrantMonitor());
|
2012-11-19 07:11:21 -08:00
|
|
|
if (mDecoder->IsShutdown()) {
|
2010-08-12 19:28:15 -07:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-02-24 21:45:03 -08:00
|
|
|
if (eof) {
|
2011-09-29 21:15:24 -07:00
|
|
|
// Hit end of file, we want to display the last frame of the video.
|
2014-03-28 05:31:29 -07:00
|
|
|
if (video) {
|
2014-03-31 20:39:04 -07:00
|
|
|
DECODER_LOG(PR_LOG_DEBUG,
|
|
|
|
("MediaDecoderReader::DecodeToTarget(%lld) repushing video frame [%lld, %lld] at EOF",
|
|
|
|
aTarget, video->mTime, video->GetEndTime()));
|
2014-03-28 05:31:29 -07:00
|
|
|
VideoQueue().PushFront(video.forget());
|
|
|
|
}
|
2014-02-24 21:45:03 -08:00
|
|
|
VideoQueue().Finish();
|
2010-08-12 19:28:15 -07:00
|
|
|
break;
|
|
|
|
}
|
2012-12-06 15:27:08 -08:00
|
|
|
video = VideoQueue().PeekFront();
|
2010-08-12 19:28:15 -07:00
|
|
|
// If the frame end time is less than the seek target, we won't want
|
|
|
|
// to display this frame after the seek, so discard it.
|
2014-03-28 05:31:29 -07:00
|
|
|
if (video && video->GetEndTime() <= aTarget) {
|
2014-03-31 20:39:04 -07:00
|
|
|
DECODER_LOG(PR_LOG_DEBUG,
|
|
|
|
("MediaDecoderReader::DecodeToTarget(%lld) pop video frame [%lld, %lld]",
|
|
|
|
aTarget, video->mTime, video->GetEndTime()));
|
2014-03-28 05:31:29 -07:00
|
|
|
VideoQueue().PopFront();
|
|
|
|
} else {
|
2014-03-31 20:39:04 -07:00
|
|
|
// Found a frame after or encompasing the seek target.
|
|
|
|
if (aTarget >= video->mTime && video->GetEndTime() >= aTarget) {
|
|
|
|
// The seek target lies inside this frame's time slice. Adjust the frame's
|
|
|
|
// start time to match the seek target. We do this by replacing the
|
|
|
|
// first frame with a shallow copy which has the new timestamp.
|
|
|
|
VideoQueue().PopFront();
|
|
|
|
VideoData* temp = VideoData::ShallowCopyUpdateTimestamp(video, aTarget);
|
|
|
|
video = temp;
|
|
|
|
VideoQueue().PushFront(video);
|
|
|
|
}
|
|
|
|
DECODER_LOG(PR_LOG_DEBUG,
|
|
|
|
("MediaDecoderReader::DecodeToTarget(%lld) found target video frame [%lld,%lld]",
|
|
|
|
aTarget, video->mTime, video->GetEndTime()));
|
|
|
|
|
2014-03-28 05:31:29 -07:00
|
|
|
video.forget();
|
2010-08-12 19:28:15 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
{
|
2011-04-29 12:21:57 -07:00
|
|
|
ReentrantMonitorAutoEnter decoderMon(mDecoder->GetReentrantMonitor());
|
2012-11-19 07:11:21 -08:00
|
|
|
if (mDecoder->IsShutdown()) {
|
2010-08-12 19:28:15 -07:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
2014-03-31 20:39:04 -07:00
|
|
|
#ifdef PR_LOGGING
|
|
|
|
const VideoData* front = VideoQueue().PeekFront();
|
|
|
|
DECODER_LOG(PR_LOG_DEBUG, ("First video frame after decode is %lld",
|
|
|
|
front ? front->mTime : -1));
|
|
|
|
#endif
|
2010-08-12 19:28:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (HasAudio()) {
|
|
|
|
// Decode audio forward to the seek target.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool eof = false;
|
2010-08-12 19:28:15 -07:00
|
|
|
while (HasAudio() && !eof) {
|
2012-12-06 15:27:08 -08:00
|
|
|
while (!eof && AudioQueue().GetSize() == 0) {
|
2010-08-12 19:28:15 -07:00
|
|
|
eof = !DecodeAudioData();
|
|
|
|
{
|
2011-04-29 12:21:57 -07:00
|
|
|
ReentrantMonitorAutoEnter decoderMon(mDecoder->GetReentrantMonitor());
|
2012-11-19 07:11:21 -08:00
|
|
|
if (mDecoder->IsShutdown()) {
|
2010-08-12 19:28:15 -07:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-12-06 15:27:08 -08:00
|
|
|
const AudioData* audio = AudioQueue().PeekFront();
|
2014-02-24 21:45:03 -08:00
|
|
|
if (!audio || eof) {
|
|
|
|
AudioQueue().Finish();
|
2011-07-08 18:10:40 -07:00
|
|
|
break;
|
2014-02-24 21:45:03 -08:00
|
|
|
}
|
2013-09-26 22:22:38 -07:00
|
|
|
CheckedInt64 startFrame = UsecsToFrames(audio->mTime, mInfo.mAudio.mRate);
|
|
|
|
CheckedInt64 targetFrame = UsecsToFrames(aTarget, mInfo.mAudio.mRate);
|
2012-05-14 12:50:20 -07:00
|
|
|
if (!startFrame.isValid() || !targetFrame.isValid()) {
|
2011-07-08 18:10:40 -07:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
2012-02-22 04:28:06 -08:00
|
|
|
if (startFrame.value() + audio->mFrames <= targetFrame.value()) {
|
2011-09-26 20:31:18 -07:00
|
|
|
// Our seek target lies after the frames in this AudioData. Pop it
|
2011-07-08 18:10:40 -07:00
|
|
|
// off the queue, and keep decoding forwards.
|
2012-12-06 15:27:08 -08:00
|
|
|
delete AudioQueue().PopFront();
|
2012-07-30 07:20:58 -07:00
|
|
|
audio = nullptr;
|
2011-07-08 18:10:40 -07:00
|
|
|
continue;
|
|
|
|
}
|
2012-02-22 04:28:06 -08:00
|
|
|
if (startFrame.value() > targetFrame.value()) {
|
2011-07-31 19:45:58 -07:00
|
|
|
// The seek target doesn't lie in the audio block just after the last
|
2011-09-26 20:31:18 -07:00
|
|
|
// audio frames we've seen which were before the seek target. This
|
2011-07-31 19:45:58 -07:00
|
|
|
// could have been the first audio data we've seen after seek, i.e. the
|
|
|
|
// seek terminated after the seek target in the audio stream. Just
|
|
|
|
// abort the audio decode-to-target, the state machine will play
|
|
|
|
// silence to cover the gap. Typically this happens in poorly muxed
|
|
|
|
// files.
|
|
|
|
NS_WARNING("Audio not synced after seek, maybe a poorly muxed file?");
|
|
|
|
break;
|
|
|
|
}
|
2011-07-08 18:10:40 -07:00
|
|
|
|
2011-09-26 20:31:18 -07:00
|
|
|
// The seek target lies somewhere in this AudioData's frames, strip off
|
|
|
|
// any frames which lie before the seek target, so we'll begin playback
|
2011-07-08 18:10:40 -07:00
|
|
|
// exactly at the seek target.
|
2012-02-22 04:28:06 -08:00
|
|
|
NS_ASSERTION(targetFrame.value() >= startFrame.value(),
|
|
|
|
"Target must at or be after data start.");
|
|
|
|
NS_ASSERTION(targetFrame.value() < startFrame.value() + audio->mFrames,
|
|
|
|
"Data must end after target.");
|
2011-07-08 18:10:40 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int64_t framesToPrune = targetFrame.value() - startFrame.value();
|
2011-09-26 20:31:18 -07:00
|
|
|
if (framesToPrune > audio->mFrames) {
|
|
|
|
// We've messed up somehow. Don't try to trim frames, the |frames|
|
2011-07-08 18:10:40 -07:00
|
|
|
// variable below will overflow.
|
2011-09-26 20:31:18 -07:00
|
|
|
NS_WARNING("Can't prune more frames that we have!");
|
2010-08-12 19:28:15 -07:00
|
|
|
break;
|
|
|
|
}
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t frames = audio->mFrames - static_cast<uint32_t>(framesToPrune);
|
|
|
|
uint32_t channels = audio->mChannels;
|
2011-09-26 20:31:18 -07:00
|
|
|
nsAutoArrayPtr<AudioDataValue> audioData(new AudioDataValue[frames * channels]);
|
2011-07-08 18:10:40 -07:00
|
|
|
memcpy(audioData.get(),
|
2011-09-26 20:31:18 -07:00
|
|
|
audio->mAudioData.get() + (framesToPrune * channels),
|
|
|
|
frames * channels * sizeof(AudioDataValue));
|
2013-09-26 22:22:38 -07:00
|
|
|
CheckedInt64 duration = FramesToUsecs(frames, mInfo.mAudio.mRate);
|
2012-05-14 12:50:20 -07:00
|
|
|
if (!duration.isValid()) {
|
2011-07-08 18:10:40 -07:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
2011-08-15 22:19:51 -07:00
|
|
|
nsAutoPtr<AudioData> data(new AudioData(audio->mOffset,
|
2011-07-08 18:10:40 -07:00
|
|
|
aTarget,
|
2012-02-22 04:28:06 -08:00
|
|
|
duration.value(),
|
2011-09-26 20:31:18 -07:00
|
|
|
frames,
|
2011-07-08 18:10:40 -07:00
|
|
|
audioData.forget(),
|
|
|
|
channels));
|
2012-12-06 15:27:08 -08:00
|
|
|
delete AudioQueue().PopFront();
|
|
|
|
AudioQueue().PushFront(data.forget());
|
2011-07-08 18:10:40 -07:00
|
|
|
break;
|
2010-08-12 19:28:15 -07:00
|
|
|
}
|
|
|
|
}
|
2013-08-12 21:49:25 -07:00
|
|
|
|
2014-03-31 20:39:04 -07:00
|
|
|
#ifdef PR_LOGGING
|
|
|
|
const VideoData* v = VideoQueue().PeekFront();
|
|
|
|
const AudioData* a = AudioQueue().PeekFront();
|
|
|
|
DECODER_LOG(PR_LOG_DEBUG,
|
|
|
|
("MediaDecoderReader::DecodeToTarget(%lld) finished v=%lld a=%lld",
|
|
|
|
aTarget, v ? v->mTime : -1, a ? a->mTime : -1));
|
|
|
|
#endif
|
2014-03-28 05:31:29 -07:00
|
|
|
|
2010-08-12 19:28:15 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2013-10-20 20:31:05 -07:00
|
|
|
nsresult
|
|
|
|
MediaDecoderReader::GetBuffered(mozilla::dom::TimeRanges* aBuffered,
|
|
|
|
int64_t aStartTime)
|
|
|
|
{
|
|
|
|
MediaResource* stream = mDecoder->GetResource();
|
|
|
|
int64_t durationUs = 0;
|
|
|
|
{
|
|
|
|
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
|
|
|
durationUs = mDecoder->GetMediaDuration();
|
|
|
|
}
|
|
|
|
GetEstimatedBufferedTimeRanges(stream, durationUs, aBuffered);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-11-14 11:45:33 -08:00
|
|
|
} // namespace mozilla
|