mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out 2 changesets (bug 939582) because of build bustage
Backed out changeset 2079c828645a (bug 939582) Backed out changeset af472e590088 (bug 939582)
This commit is contained in:
parent
db8775cc82
commit
7092b111ba
@ -9,6 +9,12 @@
|
||||
#include "MediaStreamGraph.h"
|
||||
#include "AudioNodeStream.h"
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
#define LOG(type, msg) PR_LOG(gMediaStreamGraphLog, type, msg)
|
||||
#else
|
||||
#define LOG(type, msg)
|
||||
#endif
|
||||
|
||||
// Forward declaration for mResamplerMap
|
||||
typedef struct SpeexResamplerState_ SpeexResamplerState;
|
||||
|
||||
|
@ -10,6 +10,12 @@
|
||||
#include "mozilla/dom/AudioNodeBinding.h"
|
||||
#include "AudioSegment.h"
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
#define LOG(type, msg) PR_LOG(gMediaStreamGraphLog, type, msg)
|
||||
#else
|
||||
#define LOG(type, msg)
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace dom {
|
||||
|
@ -26,9 +26,9 @@ namespace mozilla {
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
PRLogModuleInfo* gMediaCacheLog;
|
||||
#define CACHE_LOG(type, msg) PR_LOG(gMediaCacheLog, type, msg)
|
||||
#define LOG(type, msg) PR_LOG(gMediaCacheLog, type, msg)
|
||||
#else
|
||||
#define CACHE_LOG(type, msg)
|
||||
#define LOG(type, msg)
|
||||
#endif
|
||||
|
||||
// Readahead blocks for non-seekable streams will be limited to this
|
||||
@ -935,7 +935,7 @@ MediaCache::FreeBlock(int32_t aBlock)
|
||||
return;
|
||||
}
|
||||
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Released block %d", aBlock));
|
||||
LOG(PR_LOG_DEBUG, ("Released block %d", aBlock));
|
||||
|
||||
for (uint32_t i = 0; i < block->mOwners.Length(); ++i) {
|
||||
BlockOwner* bo = &block->mOwners[i];
|
||||
@ -1101,20 +1101,20 @@ MediaCache::Update()
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// We successfully copied the file data.
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Swapping blocks %d and %d (trimming cache)",
|
||||
blockIndex, destinationBlockIndex));
|
||||
LOG(PR_LOG_DEBUG, ("Swapping blocks %d and %d (trimming cache)",
|
||||
blockIndex, destinationBlockIndex));
|
||||
// Swapping the block metadata here lets us maintain the
|
||||
// correct positions in the linked lists
|
||||
SwapBlocks(blockIndex, destinationBlockIndex);
|
||||
//Free the overflowing block even if the copy failed.
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Released block %d (trimming cache)", blockIndex));
|
||||
LOG(PR_LOG_DEBUG, ("Released block %d (trimming cache)", blockIndex));
|
||||
FreeBlock(blockIndex);
|
||||
}
|
||||
} else {
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Could not trim cache block %d (destination %d, predicted next use %f, latest predicted use for overflow %f",
|
||||
blockIndex, destinationBlockIndex,
|
||||
PredictNextUse(now, destinationBlockIndex).ToSeconds(),
|
||||
latestPredictedUseForOverflow.ToSeconds()));
|
||||
LOG(PR_LOG_DEBUG, ("Could not trim cache block %d (destination %d, predicted next use %f, latest predicted use for overflow %f",
|
||||
blockIndex, destinationBlockIndex,
|
||||
PredictNextUse(now, destinationBlockIndex).ToSeconds(),
|
||||
latestPredictedUseForOverflow.ToSeconds()));
|
||||
}
|
||||
}
|
||||
// Try chopping back the array of cache entries and the cache file.
|
||||
@ -1194,29 +1194,29 @@ MediaCache::Update()
|
||||
// advertised with Content-Length, and we may as well keep reading.
|
||||
// But we don't want to seek to the end of the stream if we're not
|
||||
// already there.
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Stream %p at end of stream", stream));
|
||||
LOG(PR_LOG_DEBUG, ("Stream %p at end of stream", stream));
|
||||
enableReading = !stream->mCacheSuspended &&
|
||||
stream->mStreamLength == stream->mChannelOffset;
|
||||
} else if (desiredOffset < stream->mStreamOffset) {
|
||||
// We're reading to try to catch up to where the current stream
|
||||
// reader wants to be. Better not stop.
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Stream %p catching up", stream));
|
||||
LOG(PR_LOG_DEBUG, ("Stream %p catching up", stream));
|
||||
enableReading = true;
|
||||
} else if (desiredOffset < stream->mStreamOffset + BLOCK_SIZE) {
|
||||
// The stream reader is waiting for us, or nearly so. Better feed it.
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Stream %p feeding reader", stream));
|
||||
LOG(PR_LOG_DEBUG, ("Stream %p feeding reader", stream));
|
||||
enableReading = true;
|
||||
} else if (!stream->mIsTransportSeekable &&
|
||||
nonSeekableReadaheadBlockCount >= maxBlocks*NONSEEKABLE_READAHEAD_MAX) {
|
||||
// This stream is not seekable and there are already too many blocks
|
||||
// being cached for readahead for nonseekable streams (which we can't
|
||||
// free). So stop reading ahead now.
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Stream %p throttling non-seekable readahead", stream));
|
||||
LOG(PR_LOG_DEBUG, ("Stream %p throttling non-seekable readahead", stream));
|
||||
enableReading = false;
|
||||
} else if (mIndex.Length() > uint32_t(maxBlocks)) {
|
||||
// We're in the process of bringing the cache size back to the
|
||||
// desired limit, so don't bring in more data yet
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Stream %p throttling to reduce cache size", stream));
|
||||
LOG(PR_LOG_DEBUG, ("Stream %p throttling to reduce cache size", stream));
|
||||
enableReading = false;
|
||||
} else {
|
||||
TimeDuration predictedNewDataUse = PredictNextUseForIncomingData(stream);
|
||||
@ -1224,21 +1224,21 @@ MediaCache::Update()
|
||||
if (stream->mCacheSuspended &&
|
||||
predictedNewDataUse.ToMilliseconds() > CACHE_POWERSAVE_WAKEUP_LOW_THRESHOLD_MS) {
|
||||
// Don't need data for a while, so don't bother waking up the stream
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Stream %p avoiding wakeup since more data is not needed", stream));
|
||||
LOG(PR_LOG_DEBUG, ("Stream %p avoiding wakeup since more data is not needed", stream));
|
||||
enableReading = false;
|
||||
} else if (freeBlockCount > 0) {
|
||||
// Free blocks in the cache, so keep reading
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Stream %p reading since there are free blocks", stream));
|
||||
LOG(PR_LOG_DEBUG, ("Stream %p reading since there are free blocks", stream));
|
||||
enableReading = true;
|
||||
} else if (latestNextUse <= TimeDuration(0)) {
|
||||
// No reusable blocks, so can't read anything
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Stream %p throttling due to no reusable blocks", stream));
|
||||
LOG(PR_LOG_DEBUG, ("Stream %p throttling due to no reusable blocks", stream));
|
||||
enableReading = false;
|
||||
} else {
|
||||
// Read ahead if the data we expect to read is more valuable than
|
||||
// the least valuable block in the main part of the cache
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Stream %p predict next data in %f, current worst block is %f",
|
||||
stream, predictedNewDataUse.ToSeconds(), latestNextUse.ToSeconds()));
|
||||
LOG(PR_LOG_DEBUG, ("Stream %p predict next data in %f, current worst block is %f",
|
||||
stream, predictedNewDataUse.ToSeconds(), latestNextUse.ToSeconds()));
|
||||
enableReading = predictedNewDataUse < latestNextUse;
|
||||
}
|
||||
}
|
||||
@ -1252,8 +1252,8 @@ MediaCache::Update()
|
||||
// This block is already going to be read by the other stream.
|
||||
// So don't try to read it from this stream as well.
|
||||
enableReading = false;
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Stream %p waiting on same block (%lld) from stream %p",
|
||||
stream, desiredOffset/BLOCK_SIZE, other));
|
||||
LOG(PR_LOG_DEBUG, ("Stream %p waiting on same block (%lld) from stream %p",
|
||||
stream, desiredOffset/BLOCK_SIZE, other));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1316,17 +1316,17 @@ MediaCache::Update()
|
||||
switch (actions[i]) {
|
||||
case SEEK:
|
||||
case SEEK_AND_RESUME:
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Stream %p CacheSeek to %lld (resume=%d)", stream,
|
||||
(long long)stream->mChannelOffset, actions[i] == SEEK_AND_RESUME));
|
||||
LOG(PR_LOG_DEBUG, ("Stream %p CacheSeek to %lld (resume=%d)", stream,
|
||||
(long long)stream->mChannelOffset, actions[i] == SEEK_AND_RESUME));
|
||||
rv = stream->mClient->CacheClientSeek(stream->mChannelOffset,
|
||||
actions[i] == SEEK_AND_RESUME);
|
||||
break;
|
||||
case RESUME:
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Stream %p Resumed", stream));
|
||||
LOG(PR_LOG_DEBUG, ("Stream %p Resumed", stream));
|
||||
rv = stream->mClient->CacheClientResume();
|
||||
break;
|
||||
case SUSPEND:
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Stream %p Suspended", stream));
|
||||
LOG(PR_LOG_DEBUG, ("Stream %p Suspended", stream));
|
||||
rv = stream->mClient->CacheClientSuspend();
|
||||
break;
|
||||
default:
|
||||
@ -1447,8 +1447,8 @@ MediaCache::AllocateAndWriteBlock(MediaCacheStream* aStream, const void* aData,
|
||||
if (stream->mBlocks[streamBlockIndex] >= 0) {
|
||||
// We no longer want to own this block
|
||||
int32_t globalBlockIndex = stream->mBlocks[streamBlockIndex];
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Released block %d from stream %p block %d(%lld)",
|
||||
globalBlockIndex, stream, streamBlockIndex, (long long)streamBlockIndex*BLOCK_SIZE));
|
||||
LOG(PR_LOG_DEBUG, ("Released block %d from stream %p block %d(%lld)",
|
||||
globalBlockIndex, stream, streamBlockIndex, (long long)streamBlockIndex*BLOCK_SIZE));
|
||||
RemoveBlockOwner(globalBlockIndex, stream);
|
||||
}
|
||||
}
|
||||
@ -1461,8 +1461,8 @@ MediaCache::AllocateAndWriteBlock(MediaCacheStream* aStream, const void* aData,
|
||||
FreeBlock(blockIndex);
|
||||
|
||||
Block* block = &mIndex[blockIndex];
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Allocated block %d to stream %p block %d(%lld)",
|
||||
blockIndex, aStream, streamBlockIndex, (long long)streamBlockIndex*BLOCK_SIZE));
|
||||
LOG(PR_LOG_DEBUG, ("Allocated block %d to stream %p block %d(%lld)",
|
||||
blockIndex, aStream, streamBlockIndex, (long long)streamBlockIndex*BLOCK_SIZE));
|
||||
|
||||
mFreeBlocks.RemoveBlock(blockIndex);
|
||||
|
||||
@ -1496,8 +1496,8 @@ MediaCache::AllocateAndWriteBlock(MediaCacheStream* aStream, const void* aData,
|
||||
|
||||
nsresult rv = mFileCache->WriteBlock(blockIndex, reinterpret_cast<const uint8_t*>(aData));
|
||||
if (NS_FAILED(rv)) {
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Released block %d from stream %p block %d(%lld)",
|
||||
blockIndex, aStream, streamBlockIndex, (long long)streamBlockIndex*BLOCK_SIZE));
|
||||
LOG(PR_LOG_DEBUG, ("Released block %d from stream %p block %d(%lld)",
|
||||
blockIndex, aStream, streamBlockIndex, (long long)streamBlockIndex*BLOCK_SIZE));
|
||||
FreeBlock(blockIndex);
|
||||
}
|
||||
}
|
||||
@ -1513,7 +1513,7 @@ MediaCache::OpenStream(MediaCacheStream* aStream)
|
||||
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
|
||||
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Stream %p opened", aStream));
|
||||
LOG(PR_LOG_DEBUG, ("Stream %p opened", aStream));
|
||||
mStreams.AppendElement(aStream);
|
||||
aStream->mResourceID = AllocateResourceID();
|
||||
|
||||
@ -1527,7 +1527,7 @@ MediaCache::ReleaseStream(MediaCacheStream* aStream)
|
||||
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
|
||||
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Stream %p closed", aStream));
|
||||
LOG(PR_LOG_DEBUG, ("Stream %p closed", aStream));
|
||||
mStreams.RemoveElement(aStream);
|
||||
}
|
||||
|
||||
@ -1543,8 +1543,8 @@ MediaCache::ReleaseStreamBlocks(MediaCacheStream* aStream)
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
int32_t blockIndex = aStream->mBlocks[i];
|
||||
if (blockIndex >= 0) {
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Released block %d from stream %p block %d(%lld)",
|
||||
blockIndex, aStream, i, (long long)i*BLOCK_SIZE));
|
||||
LOG(PR_LOG_DEBUG, ("Released block %d from stream %p block %d(%lld)",
|
||||
blockIndex, aStream, i, (long long)i*BLOCK_SIZE));
|
||||
RemoveBlockOwner(blockIndex, aStream);
|
||||
}
|
||||
}
|
||||
@ -1712,8 +1712,8 @@ MediaCacheStream::NotifyDataReceived(int64_t aSize, const char* aData,
|
||||
int64_t size = aSize;
|
||||
const char* data = aData;
|
||||
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Stream %p DataReceived at %lld count=%lld",
|
||||
this, (long long)mChannelOffset, (long long)aSize));
|
||||
LOG(PR_LOG_DEBUG, ("Stream %p DataReceived at %lld count=%lld",
|
||||
this, (long long)mChannelOffset, (long long)aSize));
|
||||
|
||||
// We process the data one block (or part of a block) at a time
|
||||
while (size > 0) {
|
||||
@ -1780,12 +1780,12 @@ MediaCacheStream::FlushPartialBlockInternal(bool aNotifyAll)
|
||||
|
||||
int32_t blockOffset = int32_t(mChannelOffset%BLOCK_SIZE);
|
||||
if (blockOffset > 0) {
|
||||
CACHE_LOG(PR_LOG_DEBUG,
|
||||
("Stream %p writing partial block: [%d] bytes; "
|
||||
"mStreamOffset [%lld] mChannelOffset[%lld] mStreamLength [%lld] "
|
||||
"notifying: [%s]",
|
||||
this, blockOffset, mStreamOffset, mChannelOffset, mStreamLength,
|
||||
aNotifyAll ? "yes" : "no"));
|
||||
LOG(PR_LOG_DEBUG,
|
||||
("Stream %p writing partial block: [%d] bytes; "
|
||||
"mStreamOffset [%lld] mChannelOffset[%lld] mStreamLength [%lld] "
|
||||
"notifying: [%s]",
|
||||
this, blockOffset, mStreamOffset, mChannelOffset, mStreamLength,
|
||||
aNotifyAll ? "yes" : "no"));
|
||||
|
||||
// Write back the partial block
|
||||
memset(reinterpret_cast<char*>(mPartialBlockBuffer) + blockOffset, 0,
|
||||
@ -2107,7 +2107,7 @@ MediaCacheStream::Seek(int32_t aWhence, int64_t aOffset)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
CACHE_LOG(PR_LOG_DEBUG, ("Stream %p Seek to %lld", this, (long long)mStreamOffset));
|
||||
LOG(PR_LOG_DEBUG, ("Stream %p Seek to %lld", this, (long long)mStreamOffset));
|
||||
gMediaCache->NoteSeek(this, oldOffset);
|
||||
|
||||
gMediaCache->QueueUpdate();
|
||||
@ -2221,8 +2221,8 @@ MediaCacheStream::Read(char* aBuffer, uint32_t aCount, uint32_t* aBytes)
|
||||
// have changed
|
||||
gMediaCache->QueueUpdate();
|
||||
}
|
||||
CACHE_LOG(PR_LOG_DEBUG,
|
||||
("Stream %p Read at %lld count=%d", this, (long long)(mStreamOffset-count), count));
|
||||
LOG(PR_LOG_DEBUG,
|
||||
("Stream %p Read at %lld count=%d", this, (long long)(mStreamOffset-count), count));
|
||||
*aBytes = count;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -48,9 +48,9 @@ static const int64_t CAN_PLAY_THROUGH_MARGIN = 1;
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
PRLogModuleInfo* gMediaDecoderLog;
|
||||
#define DECODER_LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg)
|
||||
#define LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg)
|
||||
#else
|
||||
#define DECODER_LOG(type, msg)
|
||||
#define LOG(type, msg)
|
||||
#endif
|
||||
|
||||
class MediaMemoryTracker
|
||||
@ -251,8 +251,8 @@ void MediaDecoder::RecreateDecodedStream(int64_t aStartTimeUSecs)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("MediaDecoder::RecreateDecodedStream this=%p aStartTimeUSecs=%lld!",
|
||||
this, (long long)aStartTimeUSecs));
|
||||
LOG(PR_LOG_DEBUG, ("MediaDecoder::RecreateDecodedStream this=%p aStartTimeUSecs=%lld!",
|
||||
this, (long long)aStartTimeUSecs));
|
||||
|
||||
DestroyDecodedStream();
|
||||
|
||||
@ -296,8 +296,8 @@ void MediaDecoder::AddOutputStream(ProcessedMediaStream* aStream,
|
||||
bool aFinishWhenEnded)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("MediaDecoder::AddOutputStream this=%p aStream=%p!",
|
||||
this, aStream));
|
||||
LOG(PR_LOG_DEBUG, ("MediaDecoder::AddOutputStream this=%p aStream=%p!",
|
||||
this, aStream));
|
||||
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
@ -459,7 +459,7 @@ nsresult MediaDecoder::OpenResource(nsIStreamListener** aStreamListener)
|
||||
|
||||
nsresult rv = mResource->Open(aStreamListener);
|
||||
if (NS_FAILED(rv)) {
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Failed to open stream!", this));
|
||||
LOG(PR_LOG_DEBUG, ("%p Failed to open stream!", this));
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
@ -476,7 +476,7 @@ nsresult MediaDecoder::Load(nsIStreamListener** aStreamListener,
|
||||
|
||||
mDecoderStateMachine = CreateStateMachine();
|
||||
if (!mDecoderStateMachine) {
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Failed to create state machine!", this));
|
||||
LOG(PR_LOG_DEBUG, ("%p Failed to create state machine!", this));
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@ -491,7 +491,7 @@ nsresult MediaDecoder::InitializeStateMachine(MediaDecoder* aCloneDonor)
|
||||
MediaDecoder* cloneDonor = static_cast<MediaDecoder*>(aCloneDonor);
|
||||
if (NS_FAILED(mDecoderStateMachine->Init(cloneDonor ?
|
||||
cloneDonor->mDecoderStateMachine : nullptr))) {
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Failed to init state machine!", this));
|
||||
LOG(PR_LOG_DEBUG, ("%p Failed to init state machine!", this));
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
{
|
||||
@ -1252,7 +1252,7 @@ void MediaDecoder::DurationChanged()
|
||||
UpdatePlaybackRate();
|
||||
|
||||
if (mOwner && oldDuration != mDuration && !IsInfinite()) {
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p duration changed to %lld", this, mDuration));
|
||||
LOG(PR_LOG_DEBUG, ("%p duration changed to %lld", this, mDuration));
|
||||
mOwner->DispatchEvent(NS_LITERAL_STRING("durationchange"));
|
||||
}
|
||||
}
|
||||
|
@ -36,14 +36,14 @@ static_assert(PlanarYCbCrImage::MAX_DIMENSION < UINT32_MAX / PlanarYCbCrImage::M
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
extern PRLogModuleInfo* gMediaDecoderLog;
|
||||
#define DECODER_LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg)
|
||||
#define LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg)
|
||||
#ifdef SEEK_LOGGING
|
||||
#define SEEK_LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg)
|
||||
#else
|
||||
#define SEEK_LOG(type, msg)
|
||||
#endif
|
||||
#else
|
||||
#define DECODER_LOG(type, msg)
|
||||
#define LOG(type, msg)
|
||||
#define SEEK_LOG(type, msg)
|
||||
#endif
|
||||
|
||||
@ -487,7 +487,7 @@ VideoData* MediaDecoderReader::FindStartTime(int64_t& aOutStartTime)
|
||||
|
||||
nsresult MediaDecoderReader::DecodeToTarget(int64_t aTarget)
|
||||
{
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("MediaDecoderReader::DecodeToTarget(%lld) Begin", aTarget));
|
||||
LOG(PR_LOG_DEBUG, ("MediaDecoderReader::DecodeToTarget(%lld) Begin", aTarget));
|
||||
|
||||
// Decode forward to the target frame. Start with video, if we have it.
|
||||
if (HasVideo()) {
|
||||
@ -531,7 +531,7 @@ nsresult MediaDecoderReader::DecodeToTarget(int64_t aTarget)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("First video frame after decode is %lld", startTime));
|
||||
LOG(PR_LOG_DEBUG, ("First video frame after decode is %lld", startTime));
|
||||
}
|
||||
|
||||
if (HasAudio()) {
|
||||
@ -611,7 +611,7 @@ nsresult MediaDecoderReader::DecodeToTarget(int64_t aTarget)
|
||||
}
|
||||
}
|
||||
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("MediaDecoderReader::DecodeToTarget(%lld) End", aTarget));
|
||||
LOG(PR_LOG_DEBUG, ("MediaDecoderReader::DecodeToTarget(%lld) End", aTarget));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -38,9 +38,9 @@ using namespace mozilla::dom;
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
extern PRLogModuleInfo* gMediaDecoderLog;
|
||||
#define DECODER_LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg)
|
||||
#define LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg)
|
||||
#else
|
||||
#define DECODER_LOG(type, msg)
|
||||
#define LOG(type, msg)
|
||||
#endif
|
||||
|
||||
// Wait this number of seconds when buffering, then leave and play
|
||||
@ -287,7 +287,7 @@ void StateMachineTracker::CleanupGlobalStateMachine()
|
||||
"State machine ref count must be > 0");
|
||||
mStateMachineCount--;
|
||||
if (mStateMachineCount == 0) {
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("Destroying media state machine thread"));
|
||||
LOG(PR_LOG_DEBUG, ("Destroying media state machine thread"));
|
||||
NS_ASSERTION(mPending.GetSize() == 0, "Shouldn't all requests be handled by now?");
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(mMonitor);
|
||||
@ -506,7 +506,7 @@ void MediaDecoderStateMachine::DecodeThreadRun()
|
||||
NS_FAILED(DecodeMetadata())) {
|
||||
NS_ASSERTION(mState == DECODER_STATE_SHUTDOWN,
|
||||
"Should be in shutdown state if metadata loading fails.");
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("Decode metadata failed, shutting down decode thread"));
|
||||
LOG(PR_LOG_DEBUG, ("Decode metadata failed, shutting down decode thread"));
|
||||
}
|
||||
|
||||
while (mState != DECODER_STATE_SHUTDOWN &&
|
||||
@ -522,7 +522,7 @@ void MediaDecoderStateMachine::DecodeThreadRun()
|
||||
if (NS_FAILED(DecodeMetadata())) {
|
||||
NS_ASSERTION(mState == DECODER_STATE_SHUTDOWN,
|
||||
"Should be in shutdown state if metadata loading fails.");
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("Decode metadata failed, shutting down decode thread"));
|
||||
LOG(PR_LOG_DEBUG, ("Decode metadata failed, shutting down decode thread"));
|
||||
}
|
||||
} else if (mState == DECODER_STATE_WAIT_FOR_RESOURCES) {
|
||||
mDecoder->GetReentrantMonitor().Wait();
|
||||
@ -537,7 +537,7 @@ void MediaDecoderStateMachine::DecodeThreadRun()
|
||||
}
|
||||
|
||||
mDecodeThreadIdle = true;
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Decode thread finished", mDecoder.get()));
|
||||
LOG(PR_LOG_DEBUG, ("%p Decode thread finished", mDecoder.get()));
|
||||
}
|
||||
|
||||
mReader->OnDecodeThreadFinish();
|
||||
@ -567,8 +567,8 @@ void MediaDecoderStateMachine::SendStreamAudio(AudioData* aAudio,
|
||||
return;
|
||||
if (audioWrittenOffset.value() < frameOffset.value()) {
|
||||
// Write silence to catch up
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Decoder writing %d frames of silence to MediaStream",
|
||||
mDecoder.get(), int32_t(frameOffset.value() - audioWrittenOffset.value())));
|
||||
LOG(PR_LOG_DEBUG, ("%p Decoder writing %d frames of silence to MediaStream",
|
||||
mDecoder.get(), int32_t(frameOffset.value() - audioWrittenOffset.value())));
|
||||
AudioSegment silence;
|
||||
silence.InsertNullDataAtStart(frameOffset.value() - audioWrittenOffset.value());
|
||||
aStream->mAudioFramesWritten += silence.GetDuration();
|
||||
@ -597,8 +597,8 @@ void MediaDecoderStateMachine::SendStreamAudio(AudioData* aAudio,
|
||||
channels.AppendElement(bufferData + i*aAudio->mFrames + offset);
|
||||
}
|
||||
aOutput->AppendFrames(buffer.forget(), channels, aAudio->mFrames);
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Decoder writing %d frames of data to MediaStream for AudioData at %lld",
|
||||
mDecoder.get(), aAudio->mFrames - int32_t(offset), aAudio->mTime));
|
||||
LOG(PR_LOG_DEBUG, ("%p Decoder writing %d frames of data to MediaStream for AudioData at %lld",
|
||||
mDecoder.get(), aAudio->mFrames - int32_t(offset), aAudio->mTime));
|
||||
aStream->mAudioFramesWritten += aAudio->mFrames - int32_t(offset);
|
||||
}
|
||||
|
||||
@ -684,9 +684,9 @@ void MediaDecoderStateMachine::SendStreamData()
|
||||
for (uint32_t i = 0; i < video.Length(); ++i) {
|
||||
VideoData* v = video[i];
|
||||
if (stream->mNextVideoTime + mStartTime < v->mTime) {
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Decoder writing last video to MediaStream %p for %lld ms",
|
||||
mDecoder.get(), mediaStream,
|
||||
v->mTime - (stream->mNextVideoTime + mStartTime)));
|
||||
LOG(PR_LOG_DEBUG, ("%p Decoder writing last video to MediaStream %p for %lld ms",
|
||||
mDecoder.get(), mediaStream,
|
||||
v->mTime - (stream->mNextVideoTime + mStartTime)));
|
||||
// Write last video frame to catch up. mLastVideoImage can be null here
|
||||
// which is fine, it just means there's no video.
|
||||
WriteVideoToMediaStream(stream->mLastVideoImage,
|
||||
@ -695,9 +695,9 @@ void MediaDecoderStateMachine::SendStreamData()
|
||||
stream->mNextVideoTime = v->mTime - mStartTime;
|
||||
}
|
||||
if (stream->mNextVideoTime + mStartTime < v->GetEndTime()) {
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Decoder writing video frame %lld to MediaStream %p for %lld ms",
|
||||
mDecoder.get(), v->mTime, mediaStream,
|
||||
v->GetEndTime() - (stream->mNextVideoTime + mStartTime)));
|
||||
LOG(PR_LOG_DEBUG, ("%p Decoder writing video frame %lld to MediaStream %p for %lld ms",
|
||||
mDecoder.get(), v->mTime, mediaStream,
|
||||
v->GetEndTime() - (stream->mNextVideoTime + mStartTime)));
|
||||
WriteVideoToMediaStream(v->mImage,
|
||||
v->GetEndTime() - (stream->mNextVideoTime + mStartTime), v->mDisplay,
|
||||
&output);
|
||||
@ -705,8 +705,8 @@ void MediaDecoderStateMachine::SendStreamData()
|
||||
stream->mLastVideoImage = v->mImage;
|
||||
stream->mLastVideoImageDisplaySize = v->mDisplay;
|
||||
} else {
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Decoder skipping writing video frame %lld to MediaStream",
|
||||
mDecoder.get(), v->mTime));
|
||||
LOG(PR_LOG_DEBUG, ("%p Decoder skipping writing video frame %lld to MediaStream",
|
||||
mDecoder.get(), v->mTime));
|
||||
}
|
||||
}
|
||||
if (output.GetDuration() > 0) {
|
||||
@ -814,7 +814,7 @@ bool MediaDecoderStateMachine::HaveEnoughDecodedVideo()
|
||||
|
||||
void MediaDecoderStateMachine::DecodeLoop()
|
||||
{
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Start DecodeLoop()", mDecoder.get()));
|
||||
LOG(PR_LOG_DEBUG, ("%p Start DecodeLoop()", mDecoder.get()));
|
||||
|
||||
AssertCurrentThreadInMonitor();
|
||||
NS_ASSERTION(OnDecodeThread(), "Should be on decode thread.");
|
||||
@ -889,7 +889,7 @@ void MediaDecoderStateMachine::DecodeLoop()
|
||||
!HasLowUndecodedData())
|
||||
{
|
||||
skipToNextKeyframe = true;
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Skipping video decode to the next keyframe", mDecoder.get()));
|
||||
LOG(PR_LOG_DEBUG, ("%p Skipping video decode to the next keyframe", mDecoder.get()));
|
||||
}
|
||||
|
||||
// Video decode.
|
||||
@ -922,9 +922,9 @@ void MediaDecoderStateMachine::DecodeLoop()
|
||||
std::min(THRESHOLD_FACTOR * DurationToUsecs(decodeTime), AMPLE_AUDIO_USECS);
|
||||
ampleAudioThreshold = std::max(THRESHOLD_FACTOR * lowAudioThreshold,
|
||||
ampleAudioThreshold);
|
||||
DECODER_LOG(PR_LOG_DEBUG,
|
||||
("Slow video decode, set lowAudioThreshold=%lld ampleAudioThreshold=%lld",
|
||||
lowAudioThreshold, ampleAudioThreshold));
|
||||
LOG(PR_LOG_DEBUG,
|
||||
("Slow video decode, set lowAudioThreshold=%lld ampleAudioThreshold=%lld",
|
||||
lowAudioThreshold, ampleAudioThreshold));
|
||||
}
|
||||
}
|
||||
|
||||
@ -990,7 +990,7 @@ void MediaDecoderStateMachine::DecodeLoop()
|
||||
ScheduleStateMachine();
|
||||
}
|
||||
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Exiting DecodeLoop", mDecoder.get()));
|
||||
LOG(PR_LOG_DEBUG, ("%p Exiting DecodeLoop", mDecoder.get()));
|
||||
}
|
||||
|
||||
bool MediaDecoderStateMachine::IsPlaying()
|
||||
@ -1026,7 +1026,7 @@ static void WriteSilence(AudioStream* aStream, uint32_t aFrames)
|
||||
void MediaDecoderStateMachine::AudioLoop()
|
||||
{
|
||||
NS_ASSERTION(OnAudioThread(), "Should be on audio thread.");
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Begun audio thread/loop", mDecoder.get()));
|
||||
LOG(PR_LOG_DEBUG, ("%p Begun audio thread/loop", mDecoder.get()));
|
||||
int64_t audioDuration = 0;
|
||||
int64_t audioStartTime = -1;
|
||||
uint32_t channels, rate;
|
||||
@ -1164,8 +1164,8 @@ void MediaDecoderStateMachine::AudioLoop()
|
||||
// hardware so that the next audio chunk begins playback at the correct
|
||||
// time.
|
||||
missingFrames = std::min<int64_t>(UINT32_MAX, missingFrames.value());
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Decoder playing %d frames of silence",
|
||||
mDecoder.get(), int32_t(missingFrames.value())));
|
||||
LOG(PR_LOG_DEBUG, ("%p Decoder playing %d frames of silence",
|
||||
mDecoder.get(), int32_t(missingFrames.value())));
|
||||
framesWritten = PlaySilence(static_cast<uint32_t>(missingFrames.value()),
|
||||
channels, playedFrames.value());
|
||||
} else {
|
||||
@ -1220,7 +1220,7 @@ void MediaDecoderStateMachine::AudioLoop()
|
||||
}
|
||||
}
|
||||
}
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Reached audio stream end.", mDecoder.get()));
|
||||
LOG(PR_LOG_DEBUG, ("%p Reached audio stream end.", mDecoder.get()));
|
||||
{
|
||||
// Must hold lock while shutting down and anulling the audio stream to prevent
|
||||
// state machine thread trying to use it while we're destroying it.
|
||||
@ -1236,7 +1236,7 @@ void MediaDecoderStateMachine::AudioLoop()
|
||||
}
|
||||
}
|
||||
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Audio stream finished playing, audio thread exit", mDecoder.get()));
|
||||
LOG(PR_LOG_DEBUG, ("%p Audio stream finished playing, audio thread exit", mDecoder.get()));
|
||||
}
|
||||
|
||||
uint32_t MediaDecoderStateMachine::PlaySilence(uint32_t aFrames,
|
||||
@ -1271,8 +1271,8 @@ uint32_t MediaDecoderStateMachine::PlayFromAudioQueue(uint64_t aFrameOffset,
|
||||
int64_t offset = -1;
|
||||
uint32_t frames = 0;
|
||||
if (!PR_GetEnv("MOZ_QUIET")) {
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Decoder playing %d frames of data to stream for AudioData at %lld",
|
||||
mDecoder.get(), audio->mFrames, audio->mTime));
|
||||
LOG(PR_LOG_DEBUG, ("%p Decoder playing %d frames of data to stream for AudioData at %lld",
|
||||
mDecoder.get(), audio->mFrames, audio->mTime));
|
||||
}
|
||||
mAudioStream->Write(audio->mAudioData,
|
||||
audio->mFrames);
|
||||
@ -1303,7 +1303,7 @@ nsresult MediaDecoderStateMachine::Init(MediaDecoderStateMachine* aCloneDonor)
|
||||
|
||||
void MediaDecoderStateMachine::StopPlayback()
|
||||
{
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p StopPlayback()", mDecoder.get()));
|
||||
LOG(PR_LOG_DEBUG, ("%p StopPlayback()", mDecoder.get()));
|
||||
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
@ -1321,7 +1321,7 @@ void MediaDecoderStateMachine::StopPlayback()
|
||||
|
||||
void MediaDecoderStateMachine::StartPlayback()
|
||||
{
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p StartPlayback()", mDecoder.get()));
|
||||
LOG(PR_LOG_DEBUG, ("%p StartPlayback()", mDecoder.get()));
|
||||
|
||||
NS_ASSERTION(!IsPlaying(), "Shouldn't be playing when StartPlayback() is called");
|
||||
AssertCurrentThreadInMonitor();
|
||||
@ -1535,7 +1535,7 @@ void MediaDecoderStateMachine::Shutdown()
|
||||
|
||||
// Change state before issuing shutdown request to threads so those
|
||||
// threads can start exiting cleanly during the Shutdown call.
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Changed state to SHUTDOWN", mDecoder.get()));
|
||||
LOG(PR_LOG_DEBUG, ("%p Changed state to SHUTDOWN", mDecoder.get()));
|
||||
ScheduleStateMachine();
|
||||
mState = DECODER_STATE_SHUTDOWN;
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
@ -1577,7 +1577,7 @@ void MediaDecoderStateMachine::Play()
|
||||
// when the state machine notices the decoder's state change to PLAYING.
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
if (mState == DECODER_STATE_BUFFERING) {
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Changed state from BUFFERING to DECODING", mDecoder.get()));
|
||||
LOG(PR_LOG_DEBUG, ("%p Changed state from BUFFERING to DECODING", mDecoder.get()));
|
||||
mState = DECODER_STATE_DECODING;
|
||||
mDecodeStartTime = TimeStamp::Now();
|
||||
}
|
||||
@ -1652,7 +1652,7 @@ void MediaDecoderStateMachine::Seek(double aTime)
|
||||
mSeekTime = std::min(mSeekTime, mEndTime);
|
||||
mSeekTime = std::max(mStartTime, mSeekTime);
|
||||
mBasePosition = mSeekTime - mStartTime;
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Changed state to SEEKING (to %f)", mDecoder.get(), aTime));
|
||||
LOG(PR_LOG_DEBUG, ("%p Changed state to SEEKING (to %f)", mDecoder.get(), aTime));
|
||||
mState = DECODER_STATE_SEEKING;
|
||||
if (mDecoder->GetDecodedStream()) {
|
||||
mDecoder->RecreateDecodedStream(mSeekTime - mStartTime);
|
||||
@ -1675,7 +1675,7 @@ void MediaDecoderStateMachine::StopDecodeThread()
|
||||
mStopDecodeThread = true;
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
if (mDecodeThread) {
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Shutdown decode thread", mDecoder.get()));
|
||||
LOG(PR_LOG_DEBUG, ("%p Shutdown decode thread", mDecoder.get()));
|
||||
{
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
mDecodeThread->Shutdown();
|
||||
@ -1704,7 +1704,7 @@ void MediaDecoderStateMachine::StopAudioThread()
|
||||
mStopAudioThread = true;
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
if (mAudioThread) {
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Shutdown audio thread", mDecoder.get()));
|
||||
LOG(PR_LOG_DEBUG, ("%p Shutdown audio thread", mDecoder.get()));
|
||||
{
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
mAudioThread->Shutdown();
|
||||
@ -1801,7 +1801,7 @@ MediaDecoderStateMachine::StartAudioThread()
|
||||
nullptr,
|
||||
MEDIA_THREAD_STACK_SIZE);
|
||||
if (NS_FAILED(rv)) {
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Changed state to SHUTDOWN because failed to create audio thread", mDecoder.get()));
|
||||
LOG(PR_LOG_DEBUG, ("%p Changed state to SHUTDOWN because failed to create audio thread", mDecoder.get()));
|
||||
mState = DECODER_STATE_SHUTDOWN;
|
||||
return rv;
|
||||
}
|
||||
@ -1884,7 +1884,7 @@ nsresult MediaDecoderStateMachine::DecodeMetadata()
|
||||
NS_ASSERTION(mState == DECODER_STATE_DECODING_METADATA,
|
||||
"Only call when in metadata decoding state");
|
||||
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Decoding Media Headers", mDecoder.get()));
|
||||
LOG(PR_LOG_DEBUG, ("%p Decoding Media Headers", mDecoder.get()));
|
||||
nsresult res;
|
||||
MediaInfo info;
|
||||
MetadataTags* tags;
|
||||
@ -1935,10 +1935,10 @@ nsresult MediaDecoderStateMachine::DecodeMetadata()
|
||||
"Active seekable media should have end time");
|
||||
MOZ_ASSERT(!(mMediaSeekable && mTransportSeekable) ||
|
||||
GetDuration() != -1, "Seekable media should have duration");
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Media goes from %lld to %lld (duration %lld)"
|
||||
" transportSeekable=%d, mediaSeekable=%d",
|
||||
mDecoder.get(), mStartTime, mEndTime, GetDuration(),
|
||||
mTransportSeekable, mMediaSeekable));
|
||||
LOG(PR_LOG_DEBUG, ("%p Media goes from %lld to %lld (duration %lld)"
|
||||
" transportSeekable=%d, mediaSeekable=%d",
|
||||
mDecoder.get(), mStartTime, mEndTime, GetDuration(),
|
||||
mTransportSeekable, mMediaSeekable));
|
||||
|
||||
// Inform the element that we've loaded the metadata and the first frame,
|
||||
// setting the default framebuffer size for audioavailable events. Also,
|
||||
@ -1963,7 +1963,7 @@ nsresult MediaDecoderStateMachine::DecodeMetadata()
|
||||
NS_DispatchToMainThread(metadataLoadedEvent, NS_DISPATCH_NORMAL);
|
||||
|
||||
if (mState == DECODER_STATE_DECODING_METADATA) {
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Changed state from DECODING_METADATA to DECODING", mDecoder.get()));
|
||||
LOG(PR_LOG_DEBUG, ("%p Changed state from DECODING_METADATA to DECODING", mDecoder.get()));
|
||||
StartDecoding();
|
||||
}
|
||||
|
||||
@ -2068,8 +2068,8 @@ void MediaDecoderStateMachine::DecodeSeek()
|
||||
}
|
||||
|
||||
// Try to decode another frame to detect if we're at the end...
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Seek completed, mCurrentFrameTime=%lld\n",
|
||||
mDecoder.get(), mCurrentFrameTime));
|
||||
LOG(PR_LOG_DEBUG, ("%p Seek completed, mCurrentFrameTime=%lld\n",
|
||||
mDecoder.get(), mCurrentFrameTime));
|
||||
|
||||
// Change state to DECODING or COMPLETED now. SeekingStopped will
|
||||
// call MediaDecoderStateMachine::Seek to reset our state to SEEKING
|
||||
@ -2081,13 +2081,13 @@ void MediaDecoderStateMachine::DecodeSeek()
|
||||
// Seeked to end of media, move to COMPLETED state. Note we don't do
|
||||
// this if we're playing a live stream, since the end of media will advance
|
||||
// once we download more data!
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Changed state from SEEKING (to %lld) to COMPLETED",
|
||||
mDecoder.get(), seekTime));
|
||||
LOG(PR_LOG_DEBUG, ("%p Changed state from SEEKING (to %lld) to COMPLETED",
|
||||
mDecoder.get(), seekTime));
|
||||
stopEvent = NS_NewRunnableMethod(mDecoder, &MediaDecoder::SeekingStoppedAtEnd);
|
||||
mState = DECODER_STATE_COMPLETED;
|
||||
} else {
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Changed state from SEEKING (to %lld) to DECODING",
|
||||
mDecoder.get(), seekTime));
|
||||
LOG(PR_LOG_DEBUG, ("%p Changed state from SEEKING (to %lld) to DECODING",
|
||||
mDecoder.get(), seekTime));
|
||||
stopEvent = NS_NewRunnableMethod(mDecoder, &MediaDecoder::SeekingStopped);
|
||||
StartDecoding();
|
||||
}
|
||||
@ -2278,19 +2278,19 @@ nsresult MediaDecoderStateMachine::RunStateMachine()
|
||||
!mDecoder->IsDataCachedToEndOfResource() &&
|
||||
!resource->IsSuspended())
|
||||
{
|
||||
DECODER_LOG(PR_LOG_DEBUG,
|
||||
("%p Buffering: wait %ds, timeout in %.3lfs %s",
|
||||
mDecoder.get(),
|
||||
mBufferingWait,
|
||||
mBufferingWait - elapsed.ToSeconds(),
|
||||
(mQuickBuffering ? "(quick exit)" : "")));
|
||||
LOG(PR_LOG_DEBUG,
|
||||
("%p Buffering: wait %ds, timeout in %.3lfs %s",
|
||||
mDecoder.get(),
|
||||
mBufferingWait,
|
||||
mBufferingWait - elapsed.ToSeconds(),
|
||||
(mQuickBuffering ? "(quick exit)" : "")));
|
||||
ScheduleStateMachine(USECS_PER_S);
|
||||
return NS_OK;
|
||||
} else {
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Changed state from BUFFERING to DECODING", mDecoder.get()));
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Buffered for %.3lfs",
|
||||
mDecoder.get(),
|
||||
(now - mBufferingStart).ToSeconds()));
|
||||
LOG(PR_LOG_DEBUG, ("%p Changed state from BUFFERING to DECODING", mDecoder.get()));
|
||||
LOG(PR_LOG_DEBUG, ("%p Buffered for %.3lfs",
|
||||
mDecoder.get(),
|
||||
(now - mBufferingStart).ToSeconds()));
|
||||
StartDecoding();
|
||||
}
|
||||
|
||||
@ -2377,8 +2377,8 @@ void MediaDecoderStateMachine::RenderVideoFrame(VideoData* aData,
|
||||
}
|
||||
|
||||
if (!PR_GetEnv("MOZ_QUIET")) {
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Decoder playing video frame %lld",
|
||||
mDecoder.get(), aData->mTime));
|
||||
LOG(PR_LOG_DEBUG, ("%p Decoder playing video frame %lld",
|
||||
mDecoder.get(), aData->mTime));
|
||||
}
|
||||
|
||||
VideoFrameContainer* container = mDecoder->GetVideoFrameContainer();
|
||||
@ -2487,10 +2487,10 @@ void MediaDecoderStateMachine::AdvanceFrame()
|
||||
currentFrame = frame;
|
||||
#ifdef PR_LOGGING
|
||||
if (!PR_GetEnv("MOZ_QUIET")) {
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Decoder discarding video frame %lld", mDecoder.get(), frame->mTime));
|
||||
LOG(PR_LOG_DEBUG, ("%p Decoder discarding video frame %lld", mDecoder.get(), frame->mTime));
|
||||
if (droppedFrames++) {
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Decoder discarding video frame %lld (%d so far)",
|
||||
mDecoder.get(), frame->mTime, droppedFrames - 1));
|
||||
LOG(PR_LOG_DEBUG, ("%p Decoder discarding video frame %lld (%d so far)",
|
||||
mDecoder.get(), frame->mTime, droppedFrames - 1));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -2632,7 +2632,7 @@ VideoData* MediaDecoderStateMachine::FindStartTime()
|
||||
// first actual audio frame we have, we'll inject silence during playback
|
||||
// to ensure the audio starts at the correct time.
|
||||
mAudioStartTime = mStartTime;
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Media start time is %lld", mDecoder.get(), mStartTime));
|
||||
LOG(PR_LOG_DEBUG, ("%p Media start time is %lld", mDecoder.get(), mStartTime));
|
||||
return v;
|
||||
}
|
||||
|
||||
@ -2693,15 +2693,15 @@ void MediaDecoderStateMachine::StartBuffering()
|
||||
// the element we're buffering or not.
|
||||
UpdateReadyState();
|
||||
mState = DECODER_STATE_BUFFERING;
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Changed state from DECODING to BUFFERING, decoded for %.3lfs",
|
||||
mDecoder.get(), decodeDuration.ToSeconds()));
|
||||
LOG(PR_LOG_DEBUG, ("%p Changed state from DECODING to BUFFERING, decoded for %.3lfs",
|
||||
mDecoder.get(), decodeDuration.ToSeconds()));
|
||||
#ifdef PR_LOGGING
|
||||
MediaDecoder::Statistics stats = mDecoder->GetStatistics();
|
||||
#endif
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p Playback rate: %.1lfKB/s%s download rate: %.1lfKB/s%s",
|
||||
mDecoder.get(),
|
||||
stats.mPlaybackRate/1024, stats.mPlaybackRateReliable ? "" : " (unreliable)",
|
||||
stats.mDownloadRate/1024, stats.mDownloadRateReliable ? "" : " (unreliable)"));
|
||||
LOG(PR_LOG_DEBUG, ("%p Playback rate: %.1lfKB/s%s download rate: %.1lfKB/s%s",
|
||||
mDecoder.get(),
|
||||
stats.mPlaybackRate/1024, stats.mPlaybackRateReliable ? "" : " (unreliable)",
|
||||
stats.mDownloadRate/1024, stats.mDownloadRateReliable ? "" : " (unreliable)"));
|
||||
}
|
||||
|
||||
nsresult MediaDecoderStateMachine::GetBuffered(dom::TimeRanges* aBuffered) {
|
||||
|
@ -33,13 +33,13 @@
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
PRLogModuleInfo* gMediaResourceLog;
|
||||
#define RESOURCE_LOG(msg, ...) PR_LOG(gMediaResourceLog, PR_LOG_DEBUG, \
|
||||
(msg, ##__VA_ARGS__))
|
||||
#define LOG(msg, ...) PR_LOG(gMediaResourceLog, PR_LOG_DEBUG, \
|
||||
(msg, ##__VA_ARGS__))
|
||||
// Debug logging macro with object pointer and class name.
|
||||
#define CMLOG(msg, ...) \
|
||||
RESOURCE_LOG("%p [ChannelMediaResource]: " msg, this, ##__VA_ARGS__)
|
||||
LOG("%p [ChannelMediaResource]: " msg, this, ##__VA_ARGS__)
|
||||
#else
|
||||
#define RESOURCE_LOG(msg, ...)
|
||||
#define LOG(msg, ...)
|
||||
#define CMLOG(msg, ...)
|
||||
#endif
|
||||
|
||||
@ -475,10 +475,10 @@ ChannelMediaResource::CopySegmentToCache(nsIInputStream *aInStream,
|
||||
closure->mResource->mDecoder->NotifyDataArrived(aFromSegment, aCount, closure->mResource->mOffset);
|
||||
|
||||
// Keep track of where we're up to.
|
||||
RESOURCE_LOG("%p [ChannelMediaResource]: CopySegmentToCache at mOffset [%lld] add "
|
||||
"[%d] bytes for decoder[%p]",
|
||||
closure->mResource, closure->mResource->mOffset, aCount,
|
||||
closure->mResource->mDecoder);
|
||||
LOG("%p [ChannelMediaResource]: CopySegmentToCache at mOffset [%lld] add "
|
||||
"[%d] bytes for decoder[%p]",
|
||||
closure->mResource, closure->mResource->mOffset, aCount,
|
||||
closure->mResource->mDecoder);
|
||||
closure->mResource->mOffset += aCount;
|
||||
|
||||
closure->mResource->mCacheStream.NotifyDataReceived(aCount, aFromSegment,
|
||||
|
@ -32,9 +32,9 @@ namespace mozilla {
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
PRLogModuleInfo* gMediaStreamGraphLog;
|
||||
#define STREAM_LOG(type, msg) PR_LOG(gMediaStreamGraphLog, type, msg)
|
||||
#define LOG(type, msg) PR_LOG(gMediaStreamGraphLog, type, msg)
|
||||
#else
|
||||
#define STREAM_LOG(type, msg)
|
||||
#define LOG(type, msg)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -46,7 +46,7 @@ MediaStreamGraphImpl::~MediaStreamGraphImpl()
|
||||
{
|
||||
NS_ASSERTION(IsEmpty(),
|
||||
"All streams should have been destroyed by messages from the main thread");
|
||||
STREAM_LOG(PR_LOG_DEBUG, ("MediaStreamGraph %p destroyed", this));
|
||||
LOG(PR_LOG_DEBUG, ("MediaStreamGraph %p destroyed", this));
|
||||
}
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@ MediaStreamGraphImpl::FinishStream(MediaStream* aStream)
|
||||
{
|
||||
if (aStream->mFinished)
|
||||
return;
|
||||
STREAM_LOG(PR_LOG_DEBUG, ("MediaStream %p will finish", aStream));
|
||||
LOG(PR_LOG_DEBUG, ("MediaStream %p will finish", aStream));
|
||||
aStream->mFinished = true;
|
||||
// Force at least one more iteration of the control loop, since we rely
|
||||
// on UpdateCurrentTime to notify our listeners once the stream end
|
||||
@ -76,7 +76,7 @@ MediaStreamGraphImpl::AddStream(MediaStream* aStream)
|
||||
{
|
||||
aStream->mBufferStartTime = mCurrentTime;
|
||||
*mStreams.AppendElement() = already_AddRefed<MediaStream>(aStream);
|
||||
STREAM_LOG(PR_LOG_DEBUG, ("Adding media stream %p to the graph", aStream));
|
||||
LOG(PR_LOG_DEBUG, ("Adding media stream %p to the graph", aStream));
|
||||
}
|
||||
|
||||
void
|
||||
@ -97,7 +97,7 @@ MediaStreamGraphImpl::RemoveStream(MediaStream* aStream)
|
||||
// This unrefs the stream, probably destroying it
|
||||
mStreams.RemoveElement(aStream);
|
||||
|
||||
STREAM_LOG(PR_LOG_DEBUG, ("Removing media stream %p from the graph", aStream));
|
||||
LOG(PR_LOG_DEBUG, ("Removing media stream %p from the graph", aStream));
|
||||
}
|
||||
|
||||
void
|
||||
@ -131,16 +131,16 @@ MediaStreamGraphImpl::ExtractPendingInput(SourceMediaStream* aStream,
|
||||
StreamTime t =
|
||||
GraphTimeToStreamTime(aStream, mStateComputedTime) +
|
||||
(aDesiredUpToTime - mStateComputedTime);
|
||||
STREAM_LOG(PR_LOG_DEBUG+1, ("Calling NotifyPull aStream=%p t=%f current end=%f", aStream,
|
||||
MediaTimeToSeconds(t),
|
||||
MediaTimeToSeconds(aStream->mBuffer.GetEnd())));
|
||||
LOG(PR_LOG_DEBUG+1, ("Calling NotifyPull aStream=%p t=%f current end=%f", aStream,
|
||||
MediaTimeToSeconds(t),
|
||||
MediaTimeToSeconds(aStream->mBuffer.GetEnd())));
|
||||
if (t > aStream->mBuffer.GetEnd()) {
|
||||
*aEnsureNextIteration = true;
|
||||
#ifdef DEBUG
|
||||
if (aStream->mListeners.Length() == 0) {
|
||||
STREAM_LOG(PR_LOG_ERROR, ("No listeners in NotifyPull aStream=%p desired=%f current end=%f",
|
||||
aStream, MediaTimeToSeconds(t),
|
||||
MediaTimeToSeconds(aStream->mBuffer.GetEnd())));
|
||||
LOG(PR_LOG_ERROR, ("No listeners in NotifyPull aStream=%p desired=%f current end=%f",
|
||||
aStream, MediaTimeToSeconds(t),
|
||||
MediaTimeToSeconds(aStream->mBuffer.GetEnd())));
|
||||
aStream->DumpTrackInfo();
|
||||
}
|
||||
#endif
|
||||
@ -166,9 +166,9 @@ MediaStreamGraphImpl::ExtractPendingInput(SourceMediaStream* aStream,
|
||||
}
|
||||
if (data->mCommands & SourceMediaStream::TRACK_CREATE) {
|
||||
MediaSegment* segment = data->mData.forget();
|
||||
STREAM_LOG(PR_LOG_DEBUG, ("SourceMediaStream %p creating track %d, rate %d, start %lld, initial end %lld",
|
||||
aStream, data->mID, data->mRate, int64_t(data->mStart),
|
||||
int64_t(segment->GetDuration())));
|
||||
LOG(PR_LOG_DEBUG, ("SourceMediaStream %p creating track %d, rate %d, start %lld, initial end %lld",
|
||||
aStream, data->mID, data->mRate, int64_t(data->mStart),
|
||||
int64_t(segment->GetDuration())));
|
||||
aStream->mBuffer.AddTrack(data->mID, data->mRate, data->mStart, segment);
|
||||
// The track has taken ownership of data->mData, so let's replace
|
||||
// data->mData with an empty clone.
|
||||
@ -176,10 +176,10 @@ MediaStreamGraphImpl::ExtractPendingInput(SourceMediaStream* aStream,
|
||||
data->mCommands &= ~SourceMediaStream::TRACK_CREATE;
|
||||
} else if (data->mData->GetDuration() > 0) {
|
||||
MediaSegment* dest = aStream->mBuffer.FindTrack(data->mID)->GetSegment();
|
||||
STREAM_LOG(PR_LOG_DEBUG+1, ("SourceMediaStream %p track %d, advancing end from %lld to %lld",
|
||||
aStream, data->mID,
|
||||
int64_t(dest->GetDuration()),
|
||||
int64_t(dest->GetDuration() + data->mData->GetDuration())));
|
||||
LOG(PR_LOG_DEBUG+1, ("SourceMediaStream %p track %d, advancing end from %lld to %lld",
|
||||
aStream, data->mID,
|
||||
int64_t(dest->GetDuration()),
|
||||
int64_t(dest->GetDuration() + data->mData->GetDuration())));
|
||||
dest->AppendFrom(data->mData);
|
||||
}
|
||||
if (data->mCommands & SourceMediaStream::TRACK_END) {
|
||||
@ -333,27 +333,27 @@ MediaStreamGraphImpl::UpdateCurrentTime()
|
||||
SecondsToMediaTime((now - mCurrentTimeStamp).ToSeconds()) + mCurrentTime;
|
||||
|
||||
mCurrentTimeStamp = now;
|
||||
STREAM_LOG(PR_LOG_DEBUG+1, ("Updating current time to %f (real %f, mStateComputedTime %f)",
|
||||
MediaTimeToSeconds(nextCurrentTime),
|
||||
(now - mInitialTimeStamp).ToSeconds(),
|
||||
MediaTimeToSeconds(mStateComputedTime)));
|
||||
LOG(PR_LOG_DEBUG+1, ("Updating current time to %f (real %f, mStateComputedTime %f)",
|
||||
MediaTimeToSeconds(nextCurrentTime),
|
||||
(now - mInitialTimeStamp).ToSeconds(),
|
||||
MediaTimeToSeconds(mStateComputedTime)));
|
||||
} else {
|
||||
prevCurrentTime = mCurrentTime;
|
||||
nextCurrentTime = mCurrentTime + MEDIA_GRAPH_TARGET_PERIOD_MS;
|
||||
STREAM_LOG(PR_LOG_DEBUG+1, ("Updating offline current time to %f (mStateComputedTime %f)",
|
||||
MediaTimeToSeconds(nextCurrentTime),
|
||||
MediaTimeToSeconds(mStateComputedTime)));
|
||||
LOG(PR_LOG_DEBUG+1, ("Updating offline current time to %f (mStateComputedTime %f)",
|
||||
MediaTimeToSeconds(nextCurrentTime),
|
||||
MediaTimeToSeconds(mStateComputedTime)));
|
||||
}
|
||||
|
||||
if (mStateComputedTime < nextCurrentTime) {
|
||||
STREAM_LOG(PR_LOG_WARNING, ("Media graph global underrun detected"));
|
||||
LOG(PR_LOG_WARNING, ("Media graph global underrun detected"));
|
||||
nextCurrentTime = mStateComputedTime;
|
||||
}
|
||||
|
||||
if (prevCurrentTime >= nextCurrentTime) {
|
||||
NS_ASSERTION(prevCurrentTime == nextCurrentTime, "Time can't go backwards!");
|
||||
// This could happen due to low clock resolution, maybe?
|
||||
STREAM_LOG(PR_LOG_DEBUG, ("Time did not advance"));
|
||||
LOG(PR_LOG_DEBUG, ("Time did not advance"));
|
||||
// There's not much left to do here, but the code below that notifies
|
||||
// listeners that streams have ended still needs to run.
|
||||
}
|
||||
@ -397,9 +397,9 @@ MediaStreamGraphImpl::UpdateCurrentTime()
|
||||
if (stream->mFinished && !stream->mNotifiedFinished) {
|
||||
streamsReadyToFinish.AppendElement(stream);
|
||||
}
|
||||
STREAM_LOG(PR_LOG_DEBUG+1, ("MediaStream %p bufferStartTime=%f blockedTime=%f",
|
||||
stream, MediaTimeToSeconds(stream->mBufferStartTime),
|
||||
MediaTimeToSeconds(blockedTime)));
|
||||
LOG(PR_LOG_DEBUG+1, ("MediaStream %p bufferStartTime=%f blockedTime=%f",
|
||||
stream, MediaTimeToSeconds(stream->mBufferStartTime),
|
||||
MediaTimeToSeconds(blockedTime)));
|
||||
}
|
||||
|
||||
mCurrentTime = nextCurrentTime;
|
||||
@ -433,19 +433,19 @@ MediaStreamGraphImpl::WillUnderrun(MediaStream* aStream, GraphTime aTime,
|
||||
INCLUDE_TRAILING_BLOCKED_INTERVAL);
|
||||
#ifdef DEBUG
|
||||
if (bufferEnd < mCurrentTime) {
|
||||
STREAM_LOG(PR_LOG_ERROR, ("MediaStream %p underrun, "
|
||||
"bufferEnd %f < mCurrentTime %f (%lld < %lld), Streamtime %lld",
|
||||
aStream, MediaTimeToSeconds(bufferEnd), MediaTimeToSeconds(mCurrentTime),
|
||||
bufferEnd, mCurrentTime, aStream->GetBufferEnd()));
|
||||
LOG(PR_LOG_ERROR, ("MediaStream %p underrun, "
|
||||
"bufferEnd %f < mCurrentTime %f (%lld < %lld), Streamtime %lld",
|
||||
aStream, MediaTimeToSeconds(bufferEnd), MediaTimeToSeconds(mCurrentTime),
|
||||
bufferEnd, mCurrentTime, aStream->GetBufferEnd()));
|
||||
aStream->DumpTrackInfo();
|
||||
NS_ASSERTION(bufferEnd >= mCurrentTime, "Buffer underran");
|
||||
}
|
||||
#endif
|
||||
// We should block after bufferEnd.
|
||||
if (bufferEnd <= aTime) {
|
||||
STREAM_LOG(PR_LOG_DEBUG+1, ("MediaStream %p will block due to data underrun, "
|
||||
"bufferEnd %f",
|
||||
aStream, MediaTimeToSeconds(bufferEnd)));
|
||||
LOG(PR_LOG_DEBUG+1, ("MediaStream %p will block due to data underrun, "
|
||||
"bufferEnd %f",
|
||||
aStream, MediaTimeToSeconds(bufferEnd)));
|
||||
return true;
|
||||
}
|
||||
// We should keep blocking if we're currently blocked and we don't have
|
||||
@ -454,9 +454,9 @@ MediaStreamGraphImpl::WillUnderrun(MediaStream* aStream, GraphTime aTime,
|
||||
// but we might as well remain unblocked and play the data we've got while
|
||||
// we can.
|
||||
if (bufferEnd <= aEndBlockingDecisions && aStream->mBlocked.GetBefore(aTime)) {
|
||||
STREAM_LOG(PR_LOG_DEBUG+1, ("MediaStream %p will block due to speculative data underrun, "
|
||||
"bufferEnd %f",
|
||||
aStream, MediaTimeToSeconds(bufferEnd)));
|
||||
LOG(PR_LOG_DEBUG+1, ("MediaStream %p will block due to speculative data underrun, "
|
||||
"bufferEnd %f",
|
||||
aStream, MediaTimeToSeconds(bufferEnd)));
|
||||
return true;
|
||||
}
|
||||
// Reconsider decisions at bufferEnd
|
||||
@ -584,8 +584,8 @@ MediaStreamGraphImpl::RecomputeBlocking(GraphTime aEndBlockingDecisions)
|
||||
{
|
||||
bool blockingDecisionsWillChange = false;
|
||||
|
||||
STREAM_LOG(PR_LOG_DEBUG+1, ("Media graph %p computing blocking for time %f",
|
||||
this, MediaTimeToSeconds(mStateComputedTime)));
|
||||
LOG(PR_LOG_DEBUG+1, ("Media graph %p computing blocking for time %f",
|
||||
this, MediaTimeToSeconds(mStateComputedTime)));
|
||||
for (uint32_t i = 0; i < mStreams.Length(); ++i) {
|
||||
MediaStream* stream = mStreams[i];
|
||||
if (!stream->mInBlockingSet) {
|
||||
@ -611,9 +611,9 @@ MediaStreamGraphImpl::RecomputeBlocking(GraphTime aEndBlockingDecisions)
|
||||
blockingDecisionsWillChange = true;
|
||||
}
|
||||
}
|
||||
STREAM_LOG(PR_LOG_DEBUG+1, ("Media graph %p computed blocking for interval %f to %f",
|
||||
this, MediaTimeToSeconds(mStateComputedTime),
|
||||
MediaTimeToSeconds(aEndBlockingDecisions)));
|
||||
LOG(PR_LOG_DEBUG+1, ("Media graph %p computed blocking for interval %f to %f",
|
||||
this, MediaTimeToSeconds(mStateComputedTime),
|
||||
MediaTimeToSeconds(aEndBlockingDecisions)));
|
||||
mStateComputedTime = aEndBlockingDecisions;
|
||||
|
||||
if (blockingDecisionsWillChange) {
|
||||
@ -687,15 +687,15 @@ MediaStreamGraphImpl::RecomputeBlockingAt(const nsTArray<MediaStream*>& aStreams
|
||||
if (stream->mFinished) {
|
||||
GraphTime endTime = StreamTimeToGraphTime(stream, stream->GetBufferEnd());
|
||||
if (endTime <= aTime) {
|
||||
STREAM_LOG(PR_LOG_DEBUG+1, ("MediaStream %p is blocked due to being finished", stream));
|
||||
LOG(PR_LOG_DEBUG+1, ("MediaStream %p is blocked due to being finished", stream));
|
||||
// We'll block indefinitely
|
||||
MarkStreamBlocking(stream);
|
||||
*aEnd = aEndBlockingDecisions;
|
||||
continue;
|
||||
} else {
|
||||
STREAM_LOG(PR_LOG_DEBUG+1, ("MediaStream %p is finished, but not blocked yet (end at %f, with blocking at %f)",
|
||||
stream, MediaTimeToSeconds(stream->GetBufferEnd()),
|
||||
MediaTimeToSeconds(endTime)));
|
||||
LOG(PR_LOG_DEBUG+1, ("MediaStream %p is finished, but not blocked yet (end at %f, with blocking at %f)",
|
||||
stream, MediaTimeToSeconds(stream->GetBufferEnd()),
|
||||
MediaTimeToSeconds(endTime)));
|
||||
*aEnd = std::min(*aEnd, endTime);
|
||||
}
|
||||
}
|
||||
@ -704,7 +704,7 @@ MediaStreamGraphImpl::RecomputeBlockingAt(const nsTArray<MediaStream*>& aStreams
|
||||
bool explicitBlock = stream->mExplicitBlockerCount.GetAt(aTime, &end) > 0;
|
||||
*aEnd = std::min(*aEnd, end);
|
||||
if (explicitBlock) {
|
||||
STREAM_LOG(PR_LOG_DEBUG+1, ("MediaStream %p is blocked due to explicit blocker", stream));
|
||||
LOG(PR_LOG_DEBUG+1, ("MediaStream %p is blocked due to explicit blocker", stream));
|
||||
MarkStreamBlocking(stream);
|
||||
continue;
|
||||
}
|
||||
@ -844,8 +844,8 @@ MediaStreamGraphImpl::PlayAudio(MediaStream* aStream,
|
||||
TimeToTicksRoundDown(track->GetRate(), audioOutput.mBlockedAudioTime);
|
||||
|
||||
output.InsertNullDataAtStart(endTicks - startTicks);
|
||||
STREAM_LOG(PR_LOG_DEBUG+1, ("MediaStream %p writing blocking-silence samples for %f to %f",
|
||||
aStream, MediaTimeToSeconds(t), MediaTimeToSeconds(end)));
|
||||
LOG(PR_LOG_DEBUG+1, ("MediaStream %p writing blocking-silence samples for %f to %f",
|
||||
aStream, MediaTimeToSeconds(t), MediaTimeToSeconds(end)));
|
||||
} else {
|
||||
TrackTicks startTicks =
|
||||
track->TimeToTicksRoundDown(GraphTimeToStreamTime(aStream, t));
|
||||
@ -865,9 +865,9 @@ MediaStreamGraphImpl::PlayAudio(MediaStream* aStream,
|
||||
NS_ASSERTION(endTicks == sliceEnd || track->IsEnded(),
|
||||
"Ran out of data but track not ended?");
|
||||
output.ApplyVolume(volume);
|
||||
STREAM_LOG(PR_LOG_DEBUG+1, ("MediaStream %p writing samples for %f to %f (samples %lld to %lld)",
|
||||
aStream, MediaTimeToSeconds(t), MediaTimeToSeconds(end),
|
||||
startTicks, endTicks));
|
||||
LOG(PR_LOG_DEBUG+1, ("MediaStream %p writing samples for %f to %f (samples %lld to %lld)",
|
||||
aStream, MediaTimeToSeconds(t), MediaTimeToSeconds(end),
|
||||
startTicks, endTicks));
|
||||
}
|
||||
// Need unique id for stream & track - and we want it to match the inserter
|
||||
output.WriteTo(LATENCY_STREAM_ID(aStream, track->GetID()),
|
||||
@ -923,9 +923,9 @@ MediaStreamGraphImpl::PlayVideo(MediaStream* aStream)
|
||||
if (!frame || *frame == aStream->mLastPlayedVideoFrame)
|
||||
return;
|
||||
|
||||
STREAM_LOG(PR_LOG_DEBUG+1, ("MediaStream %p writing video frame %p (%dx%d)",
|
||||
aStream, frame->GetImage(), frame->GetIntrinsicSize().width,
|
||||
frame->GetIntrinsicSize().height));
|
||||
LOG(PR_LOG_DEBUG+1, ("MediaStream %p writing video frame %p (%dx%d)",
|
||||
aStream, frame->GetImage(), frame->GetIntrinsicSize().width,
|
||||
frame->GetIntrinsicSize().height));
|
||||
GraphTime startTime = StreamTimeToGraphTime(aStream,
|
||||
track->TicksToTimeRoundDown(start), INCLUDE_TRAILING_BLOCKED_INTERVAL);
|
||||
TimeStamp targetTime = mCurrentTimeStamp +
|
||||
@ -1231,7 +1231,7 @@ MediaStreamGraphImpl::RunThread()
|
||||
if (finalUpdate) {
|
||||
// Enter shutdown mode. The stable-state handler will detect this
|
||||
// and complete shutdown. Destroy any streams immediately.
|
||||
STREAM_LOG(PR_LOG_DEBUG, ("MediaStreamGraph %p waiting for main thread cleanup", this));
|
||||
LOG(PR_LOG_DEBUG, ("MediaStreamGraph %p waiting for main thread cleanup", this));
|
||||
// Commit to shutting down this graph object.
|
||||
mLifecycleState = LIFECYCLE_WAITING_FOR_MAIN_THREAD_CLEANUP;
|
||||
// No need to Destroy streams here. The main-thread owner of each
|
||||
@ -1251,17 +1251,17 @@ MediaStreamGraphImpl::RunThread()
|
||||
// least once a minute, if we need to wake up at all
|
||||
timeoutMS = std::max<int64_t>(0, std::min<int64_t>(timeoutMS, 60*1000));
|
||||
timeout = PR_MillisecondsToInterval(uint32_t(timeoutMS));
|
||||
STREAM_LOG(PR_LOG_DEBUG+1, ("Waiting for next iteration; at %f, timeout=%f",
|
||||
(now - mInitialTimeStamp).ToSeconds(), timeoutMS/1000.0));
|
||||
LOG(PR_LOG_DEBUG+1, ("Waiting for next iteration; at %f, timeout=%f",
|
||||
(now - mInitialTimeStamp).ToSeconds(), timeoutMS/1000.0));
|
||||
mWaitState = WAITSTATE_WAITING_FOR_NEXT_ITERATION;
|
||||
} else {
|
||||
mWaitState = WAITSTATE_WAITING_INDEFINITELY;
|
||||
}
|
||||
if (timeout > 0) {
|
||||
mMonitor.Wait(timeout);
|
||||
STREAM_LOG(PR_LOG_DEBUG+1, ("Resuming after timeout; at %f, elapsed=%f",
|
||||
(TimeStamp::Now() - mInitialTimeStamp).ToSeconds(),
|
||||
(TimeStamp::Now() - now).ToSeconds()));
|
||||
LOG(PR_LOG_DEBUG+1, ("Resuming after timeout; at %f, elapsed=%f",
|
||||
(TimeStamp::Now() - mInitialTimeStamp).ToSeconds(),
|
||||
(TimeStamp::Now() - now).ToSeconds()));
|
||||
}
|
||||
}
|
||||
mWaitState = WAITSTATE_RUNNING;
|
||||
@ -1300,7 +1300,7 @@ MediaStreamGraphImpl::ShutdownThreads()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Must be called on main thread");
|
||||
// mGraph's thread is not running so it's OK to do whatever here
|
||||
STREAM_LOG(PR_LOG_DEBUG, ("Stopping threads for MediaStreamGraph %p", this));
|
||||
LOG(PR_LOG_DEBUG, ("Stopping threads for MediaStreamGraph %p", this));
|
||||
|
||||
if (mThread) {
|
||||
mThread->Shutdown();
|
||||
@ -1312,7 +1312,7 @@ void
|
||||
MediaStreamGraphImpl::ForceShutDown()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Must be called on main thread");
|
||||
STREAM_LOG(PR_LOG_DEBUG, ("MediaStreamGraph %p ForceShutdown", this));
|
||||
LOG(PR_LOG_DEBUG, ("MediaStreamGraph %p ForceShutdown", this));
|
||||
{
|
||||
MonitorAutoLock lock(mMonitor);
|
||||
mForceShutDown = true;
|
||||
@ -1486,7 +1486,7 @@ MediaStreamGraphImpl::RunInStableState()
|
||||
if (mLifecycleState == LIFECYCLE_WAITING_FOR_MAIN_THREAD_CLEANUP && IsEmpty()) {
|
||||
// Complete shutdown. First, ensure that this graph is no longer used.
|
||||
// A new graph graph will be created if one is needed.
|
||||
STREAM_LOG(PR_LOG_DEBUG, ("Disconnecting MediaStreamGraph %p", this));
|
||||
LOG(PR_LOG_DEBUG, ("Disconnecting MediaStreamGraph %p", this));
|
||||
if (this == gGraph) {
|
||||
// null out gGraph if that's the graph being shut down
|
||||
gGraph = nullptr;
|
||||
@ -2207,8 +2207,8 @@ SourceMediaStream::GetBufferedTicks(TrackID aID)
|
||||
void
|
||||
MediaInputPort::Init()
|
||||
{
|
||||
STREAM_LOG(PR_LOG_DEBUG, ("Adding MediaInputPort %p (from %p to %p) to the graph",
|
||||
this, mSource, mDest));
|
||||
LOG(PR_LOG_DEBUG, ("Adding MediaInputPort %p (from %p to %p) to the graph",
|
||||
this, mSource, mDest));
|
||||
mSource->AddConsumer(this);
|
||||
mDest->AddInput(this);
|
||||
// mPortCount decremented via MediaInputPort::Destroy's message
|
||||
@ -2426,7 +2426,7 @@ MediaStreamGraph::GetInstance()
|
||||
}
|
||||
|
||||
gGraph = new MediaStreamGraphImpl(true);
|
||||
STREAM_LOG(PR_LOG_DEBUG, ("Starting up MediaStreamGraph %p", gGraph));
|
||||
LOG(PR_LOG_DEBUG, ("Starting up MediaStreamGraph %p", gGraph));
|
||||
}
|
||||
|
||||
return gGraph;
|
||||
|
@ -18,13 +18,13 @@
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
PRLogModuleInfo* gRtspMediaResourceLog;
|
||||
#define RTSP_LOG(msg, ...) PR_LOG(gRtspMediaResourceLog, PR_LOG_DEBUG, \
|
||||
(msg, ##__VA_ARGS__))
|
||||
#define LOG(msg, ...) PR_LOG(gRtspMediaResourceLog, PR_LOG_DEBUG, \
|
||||
(msg, ##__VA_ARGS__))
|
||||
// Debug logging macro with object pointer and class name.
|
||||
#define RTSPMLOG(msg, ...) \
|
||||
RTSP_LOG("%p [RtspMediaResource]: " msg, this, ##__VA_ARGS__)
|
||||
LOG("%p [RtspMediaResource]: " msg, this, ##__VA_ARGS__)
|
||||
#else
|
||||
#define RTSP_LOG(msg, ...)
|
||||
#define LOG(msg, ...)
|
||||
#define RTSPMLOG(msg, ...)
|
||||
#endif
|
||||
|
||||
|
@ -11,23 +11,23 @@ namespace mozilla {
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
extern PRLogModuleInfo* gMediaStreamGraphLog;
|
||||
#define STREAM_LOG(type, msg) PR_LOG(gMediaStreamGraphLog, type, msg)
|
||||
#define LOG(type, msg) PR_LOG(gMediaStreamGraphLog, type, msg)
|
||||
#else
|
||||
#define STREAM_LOG(type, msg)
|
||||
#define LOG(type, msg)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
StreamBuffer::DumpTrackInfo() const
|
||||
{
|
||||
STREAM_LOG(PR_LOG_ALWAYS, ("DumpTracks: mTracksKnownTime %lld", mTracksKnownTime));
|
||||
LOG(PR_LOG_ALWAYS, ("DumpTracks: mTracksKnownTime %lld", mTracksKnownTime));
|
||||
for (uint32_t i = 0; i < mTracks.Length(); ++i) {
|
||||
Track* track = mTracks[i];
|
||||
if (track->IsEnded()) {
|
||||
STREAM_LOG(PR_LOG_ALWAYS, ("Track[%d] %d: ended", i, track->GetID()));
|
||||
LOG(PR_LOG_ALWAYS, ("Track[%d] %d: ended", i, track->GetID()));
|
||||
} else {
|
||||
STREAM_LOG(PR_LOG_ALWAYS, ("Track[%d] %d: %lld", i, track->GetID(),
|
||||
track->GetEndTimeRoundDown()));
|
||||
LOG(PR_LOG_ALWAYS, ("Track[%d] %d: %lld", i, track->GetID(),
|
||||
track->GetEndTimeRoundDown()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,9 +12,9 @@
|
||||
namespace mozilla {
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
#define STREAM_LOG(type, msg) PR_LOG(gMediaStreamGraphLog, type, msg)
|
||||
#define LOG(type, msg) PR_LOG(gMediaStreamGraphLog, type, msg)
|
||||
#else
|
||||
#define STREAM_LOG(type, msg)
|
||||
#define LOG(type, msg)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -178,9 +178,9 @@ protected:
|
||||
segment->AppendNullData(outputStart);
|
||||
StreamBuffer::Track* track =
|
||||
&mBuffer.AddTrack(id, rate, outputStart, segment.forget());
|
||||
STREAM_LOG(PR_LOG_DEBUG, ("TrackUnionStream %p adding track %d for input stream %p track %d, start ticks %lld",
|
||||
this, id, aPort->GetSource(), aTrack->GetID(),
|
||||
(long long)outputStart));
|
||||
LOG(PR_LOG_DEBUG, ("TrackUnionStream %p adding track %d for input stream %p track %d, start ticks %lld",
|
||||
this, id, aPort->GetSource(), aTrack->GetID(),
|
||||
(long long)outputStart));
|
||||
|
||||
TrackMapEntry* map = mTrackMap.AppendElement();
|
||||
map->mEndOfConsumedInputTicks = 0;
|
||||
@ -253,8 +253,8 @@ protected:
|
||||
if (interval.mInputIsBlocked) {
|
||||
// Maybe the input track ended?
|
||||
segment->AppendNullData(ticks);
|
||||
STREAM_LOG(PR_LOG_DEBUG+1, ("TrackUnionStream %p appending %lld ticks of null data to track %d",
|
||||
this, (long long)ticks, outputTrack->GetID()));
|
||||
LOG(PR_LOG_DEBUG+1, ("TrackUnionStream %p appending %lld ticks of null data to track %d",
|
||||
this, (long long)ticks, outputTrack->GetID()));
|
||||
} else {
|
||||
// Figuring out which samples to use from the input stream is tricky
|
||||
// because its start time and our start time may differ by a fraction
|
||||
@ -322,9 +322,9 @@ protected:
|
||||
std::min(inputTrackEndPoint, inputStartTicks),
|
||||
std::min(inputTrackEndPoint, inputEndTicks));
|
||||
}
|
||||
STREAM_LOG(PR_LOG_DEBUG+1, ("TrackUnionStream %p appending %lld ticks of input data to track %d",
|
||||
this, (long long)(std::min(inputTrackEndPoint, inputEndTicks) - std::min(inputTrackEndPoint, inputStartTicks)),
|
||||
outputTrack->GetID()));
|
||||
LOG(PR_LOG_DEBUG+1, ("TrackUnionStream %p appending %lld ticks of input data to track %d",
|
||||
this, (long long)(std::min(inputTrackEndPoint, inputEndTicks) - std::min(inputTrackEndPoint, inputStartTicks)),
|
||||
outputTrack->GetID()));
|
||||
}
|
||||
ApplyTrackDisabling(outputTrack->GetID(), segment);
|
||||
for (uint32_t j = 0; j < mListeners.Length(); ++j) {
|
||||
|
@ -30,9 +30,9 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(WebVTTListener)
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
PRLogModuleInfo* gTextTrackLog;
|
||||
# define VTT_LOG(...) PR_LOG(gTextTrackLog, PR_LOG_DEBUG, (__VA_ARGS__))
|
||||
# define LOG(...) PR_LOG(gTextTrackLog, PR_LOG_DEBUG, (__VA_ARGS__))
|
||||
#else
|
||||
# define VTT_LOG(msg)
|
||||
# define LOG(msg)
|
||||
#endif
|
||||
|
||||
WebVTTListener::WebVTTListener(HTMLTrackElement* aElement)
|
||||
@ -44,12 +44,12 @@ WebVTTListener::WebVTTListener(HTMLTrackElement* aElement)
|
||||
gTextTrackLog = PR_NewLogModule("TextTrack");
|
||||
}
|
||||
#endif
|
||||
VTT_LOG("WebVTTListener created.");
|
||||
LOG("WebVTTListener created.");
|
||||
}
|
||||
|
||||
WebVTTListener::~WebVTTListener()
|
||||
{
|
||||
VTT_LOG("WebVTTListener destroyed.");
|
||||
LOG("WebVTTListener destroyed.");
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -124,7 +124,7 @@ WebVTTListener::ParseChunk(nsIInputStream* aInStream, void* aClosure,
|
||||
WebVTTListener* listener = static_cast<WebVTTListener*>(aClosure);
|
||||
|
||||
if (NS_FAILED(listener->mParserWrapper->Parse(buffer))) {
|
||||
VTT_LOG("Unable to parse chunk of WEBVTT text. Aborting.");
|
||||
LOG("Unable to parse chunk of WEBVTT text. Aborting.");
|
||||
*aWriteCount = 0;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ EXPORTS.mozilla.dom += [
|
||||
'VideoStreamTrack.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
SOURCES += [
|
||||
'AudioAvailableEventManager.cpp',
|
||||
'AudioChannelFormat.cpp',
|
||||
'AudioNodeEngine.cpp',
|
||||
@ -114,6 +114,7 @@ UNIFIED_SOURCES += [
|
||||
'AudioStream.cpp',
|
||||
'AudioStreamTrack.cpp',
|
||||
'BufferDecoder.cpp',
|
||||
'DecoderTraits.cpp',
|
||||
'DOMMediaStream.cpp',
|
||||
'EncodedBufferCache.cpp',
|
||||
'FileBlockCache.cpp',
|
||||
@ -143,11 +144,6 @@ UNIFIED_SOURCES += [
|
||||
'WebVTTListener.cpp',
|
||||
]
|
||||
|
||||
# DecoderTraits.cpp needs to be built separately because of Mac OS X headers.
|
||||
SOURCES += [
|
||||
'DecoderTraits.cpp',
|
||||
]
|
||||
|
||||
FAIL_ON_WARNINGS = True
|
||||
|
||||
if CONFIG['CPU_ARCH'] == 'arm' and CONFIG['BUILD_ARM_NEON']:
|
||||
|
Loading…
Reference in New Issue
Block a user