зеркало из https://github.com/mozilla/gecko-dev.git
Bug 687972. More logging.
This commit is contained in:
Родитель
0eb913e126
Коммит
23c74606fc
|
@ -644,8 +644,10 @@ void nsBuiltinDecoder::NotifySuspendedStatusChanged()
|
|||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
if (!mStream)
|
||||
return;
|
||||
bool suspended = mStream->IsSuspendedByCache();
|
||||
printf("*** nsBuiltinDecoder::NotifySuspendedStatusChanged(%p), suspended=%d\n", this, suspended);
|
||||
nsMediaStream* activeStream;
|
||||
bool suspended = mStream->IsSuspendedByCache(&activeStream);
|
||||
|
||||
printf("*** nsBuiltinDecoder::NotifySuspendedStatusChanged(%p), suspended=%d, active-stream=%p\n", this, suspended, activeStream);
|
||||
if (suspended && mElement) {
|
||||
// if this is an autoplay element, we need to kick off its autoplaying
|
||||
// now so we consume data and hopefully free up cache space
|
||||
|
|
|
@ -1908,13 +1908,20 @@ nsMediaCacheStream::IsSeekable()
|
|||
}
|
||||
|
||||
bool
|
||||
nsMediaCacheStream::AreAllStreamsForResourceSuspended()
|
||||
nsMediaCacheStream::AreAllStreamsForResourceSuspended(nsMediaStream** aActiveStream)
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
|
||||
nsMediaCache::ResourceStreamIterator iter(mResourceID);
|
||||
while (nsMediaCacheStream* stream = iter.Next()) {
|
||||
if (!stream->mCacheSuspended && !stream->mChannelEnded)
|
||||
if (!stream->mCacheSuspended && !stream->mChannelEnded) {
|
||||
if (aActiveStream) {
|
||||
*aActiveStream = stream->mClient;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (aActiveStream) {
|
||||
*aActiveStream = nsnull;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,9 @@
|
|||
#include "nsIPrincipal.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsMediaStream;
|
||||
class nsByteRange;
|
||||
|
||||
namespace mozilla {
|
||||
class ReentrantMonitorAutoEnter;
|
||||
}
|
||||
|
@ -354,7 +356,9 @@ public:
|
|||
|
||||
// Returns true when all streams for this resource are suspended or their
|
||||
// channel has ended.
|
||||
bool AreAllStreamsForResourceSuspended();
|
||||
// If aActiveStream is non-null, fills it with a pointer to a stream
|
||||
// for this resource that is not suspended or ended.
|
||||
bool AreAllStreamsForResourceSuspended(nsMediaStream** aActiveStream);
|
||||
|
||||
// These methods must be called on a different thread from the main
|
||||
// thread. They should always be called on the same thread for a given
|
||||
|
|
|
@ -831,9 +831,9 @@ nsMediaChannelStream::EnsureCacheUpToDate()
|
|||
}
|
||||
|
||||
bool
|
||||
nsMediaChannelStream::IsSuspendedByCache()
|
||||
nsMediaChannelStream::IsSuspendedByCache(nsMediaStream** aActiveStream)
|
||||
{
|
||||
return mCacheStream.AreAllStreamsForResourceSuspended();
|
||||
return mCacheStream.AreAllStreamsForResourceSuspended(aActiveStream);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -949,7 +949,13 @@ public:
|
|||
}
|
||||
virtual PRInt64 GetCachedDataEnd(PRInt64 aOffset) { return NS_MAX(aOffset, mSize); }
|
||||
virtual bool IsDataCachedToEndOfStream(PRInt64 aOffset) { return true; }
|
||||
virtual bool IsSuspendedByCache() { return false; }
|
||||
virtual bool IsSuspendedByCache(nsMediaStream** aActiveStream)
|
||||
{
|
||||
if (aActiveStream) {
|
||||
*aActiveStream = nsnull;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
virtual bool IsSuspended() { return false; }
|
||||
|
||||
nsresult GetCachedRanges(nsTArray<nsByteRange>& aRanges);
|
||||
|
|
|
@ -272,7 +272,9 @@ public:
|
|||
// changes.
|
||||
// For resources using the media cache, this returns true only when all
|
||||
// streams for the same resource are all suspended.
|
||||
virtual bool IsSuspendedByCache() = 0;
|
||||
// If aActiveStream is non-null, fills it with a pointer to a stream
|
||||
// for this resource that is not suspended or ended.
|
||||
virtual bool IsSuspendedByCache(nsMediaStream** aActiveStream) = 0;
|
||||
// Returns true if this stream has been suspended.
|
||||
virtual bool IsSuspended() = 0;
|
||||
// Reads only data which is cached in the media cache. If you try to read
|
||||
|
@ -404,7 +406,7 @@ public:
|
|||
virtual PRInt64 GetNextCachedData(PRInt64 aOffset);
|
||||
virtual PRInt64 GetCachedDataEnd(PRInt64 aOffset);
|
||||
virtual bool IsDataCachedToEndOfStream(PRInt64 aOffset);
|
||||
virtual bool IsSuspendedByCache();
|
||||
virtual bool IsSuspendedByCache(nsMediaStream** aActiveStream);
|
||||
virtual bool IsSuspended();
|
||||
|
||||
class Listener : public nsIStreamListener,
|
||||
|
|
Загрузка…
Ссылка в новой задаче