зеркало из https://github.com/mozilla/gecko-dev.git
Bug 703379. Fire CacheClientNotifyDataEnded when we clone a decoder which has already reached the end of the download. r=doublec
This commit is contained in:
Родитель
627c55ddd7
Коммит
44a3728e0e
|
@ -1839,13 +1839,18 @@ nsMediaCacheStream::NotifyDataEnded(nsresult aStatus)
|
|||
mon.NotifyAll();
|
||||
}
|
||||
|
||||
nsMediaCache::ResourceStreamIterator iter(mResourceID);
|
||||
while (nsMediaCacheStream* stream = iter.Next()) {
|
||||
if (NS_SUCCEEDED(aStatus)) {
|
||||
// We read the whole stream, so remember the true length
|
||||
stream->mStreamLength = mChannelOffset;
|
||||
if (!mDidNotifyDataEnded) {
|
||||
nsMediaCache::ResourceStreamIterator iter(mResourceID);
|
||||
while (nsMediaCacheStream* stream = iter.Next()) {
|
||||
if (NS_SUCCEEDED(aStatus)) {
|
||||
// We read the whole stream, so remember the true length
|
||||
stream->mStreamLength = mChannelOffset;
|
||||
}
|
||||
NS_ASSERTION(!stream->mDidNotifyDataEnded, "Stream already ended!");
|
||||
stream->mDidNotifyDataEnded = true;
|
||||
stream->mNotifyDataEndedStatus = aStatus;
|
||||
stream->mClient->CacheClientNotifyDataEnded(aStatus);
|
||||
}
|
||||
stream->mClient->CacheClientNotifyDataEnded(aStatus);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2286,6 +2291,12 @@ nsMediaCacheStream::InitAsClone(nsMediaCacheStream* aOriginal)
|
|||
// initially for a clone.
|
||||
mCacheSuspended = true;
|
||||
|
||||
if (aOriginal->mDidNotifyDataEnded) {
|
||||
mNotifyDataEndedStatus = aOriginal->mNotifyDataEndedStatus;
|
||||
mDidNotifyDataEnded = true;
|
||||
mClient->CacheClientNotifyDataEnded(mNotifyDataEndedStatus);
|
||||
}
|
||||
|
||||
for (PRUint32 i = 0; i < aOriginal->mBlocks.Length(); ++i) {
|
||||
PRInt32 cacheBlockIndex = aOriginal->mBlocks[i];
|
||||
if (cacheBlockIndex < 0)
|
||||
|
|
|
@ -228,6 +228,7 @@ public:
|
|||
nsMediaCacheStream(nsMediaChannelStream* aClient)
|
||||
: mClient(aClient), mResourceID(0), mInitialized(false),
|
||||
mIsSeekable(false), mCacheSuspended(false),
|
||||
mDidNotifyDataEnded(false),
|
||||
mUsingNullPrincipal(false),
|
||||
mChannelOffset(0), mStreamLength(-1),
|
||||
mStreamOffset(0), mPlaybackBytesPerSecond(10000),
|
||||
|
@ -456,6 +457,8 @@ private:
|
|||
// full and the priority of the data that would be received is lower
|
||||
// than the priority of the data already in the cache
|
||||
bool mCacheSuspended;
|
||||
// True if CacheClientNotifyDataEnded has been called for this stream.
|
||||
bool mDidNotifyDataEnded;
|
||||
// True if mPrincipal is a null principal because we saw data from
|
||||
// multiple origins
|
||||
bool mUsingNullPrincipal;
|
||||
|
@ -486,6 +489,8 @@ private:
|
|||
// The number of times this stream has been Pinned without a
|
||||
// corresponding Unpin
|
||||
PRUint32 mPinCount;
|
||||
// The status used when we did CacheClientNotifyDataEnded
|
||||
nsresult mNotifyDataEndedStatus;
|
||||
// The last reported read mode
|
||||
ReadMode mCurrentMode;
|
||||
// True if some data in mPartialBlockBuffer has been read as metadata
|
||||
|
|
Загрузка…
Ссылка в новой задаче