Bug 1746905: dom/media misc cleanup r=bryce

Differential Revision: https://phabricator.services.mozilla.com/D134302
This commit is contained in:
Randell Jesup 2021-12-21 17:49:12 +00:00
Родитель b0196a432d
Коммит 37df566280
5 изменённых файлов: 21 добавлений и 9 удалений

Просмотреть файл

@ -9,6 +9,7 @@
#include "DecoderDoctorLogger.h"
#include "Intervals.h"
#include "mozilla/Monitor.h"
#include "mozilla/Result.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/dom/MediaDebugInfoBinding.h"
@ -27,7 +28,6 @@ namespace mozilla {
class ChannelMediaResource;
typedef media::IntervalSet<int64_t> MediaByteRangeSet;
class MediaResource;
class MonitorAutoLock;
/**
* Media applications want fast, "on demand" random access to media data,

Просмотреть файл

@ -53,10 +53,10 @@ void MediaTimer::Destroy() {
{
MonitorAutoLock lock(mMonitor);
Reject();
}
// Cancel the timer if necessary.
CancelTimerIfArmed();
// Cancel the timer if necessary.
CancelTimerIfArmed();
}
delete this;
}

Просмотреть файл

@ -220,14 +220,18 @@ void VideoFrameContainer::ClearFutureFrames(TimeStamp aNow) {
}
void VideoFrameContainer::ClearCachedResources() {
MutexAutoLock lock(mMutex);
mImageContainer->ClearCachedResources();
}
ImageContainer* VideoFrameContainer::GetImageContainer() {
// Note - you'll need the lock to manipulate this. The pointer is not
// modified from multiple threads, just the data pointed to by it.
return mImageContainer;
}
double VideoFrameContainer::GetFrameDelay() {
MutexAutoLock lock(mMutex);
return mImageContainer->GetPaintDelay().ToSeconds();
}

Просмотреть файл

@ -86,6 +86,7 @@ class VideoFrameContainer {
void ForgetElement() { mOwner = nullptr; }
uint32_t GetDroppedImageCount() {
MutexAutoLock lock(mMutex);
return mImageContainer->GetDroppedImageCount();
}
@ -94,7 +95,7 @@ class VideoFrameContainer {
const gfx::IntSize& aIntrinsicSize,
const nsTArray<ImageContainer::NonOwningImage>& aImages);
// Non-addreffed pointer to the owner. The ownenr calls ForgetElement
// Non-addreffed pointer to the owner. The owner calls ForgetElement
// to clear this reference when the owner is destroyed.
MediaDecoderOwner* mOwner;
RefPtr<ImageContainer> mImageContainer;

Просмотреть файл

@ -746,10 +746,17 @@ void TrackBuffersManager::RemoveAllCodedFrames() {
}
UpdateBufferedRanges();
MOZ_ASSERT(mAudioBufferedRanges.IsEmpty(),
"Should have no buffered video ranges after evicting everything.");
MOZ_ASSERT(mVideoBufferedRanges.IsEmpty(),
"Should have no buffered video ranges after evicting everything.");
#ifdef DEBUG
{
MutexAutoLock lock(mMutex);
MOZ_ASSERT(
mAudioBufferedRanges.IsEmpty(),
"Should have no buffered video ranges after evicting everything.");
MOZ_ASSERT(
mVideoBufferedRanges.IsEmpty(),
"Should have no buffered video ranges after evicting everything.");
}
#endif
mSizeSourceBuffer = mVideoTracks.mSizeBuffer + mAudioTracks.mSizeBuffer;
MOZ_ASSERT(mSizeSourceBuffer == 0,
"Buffer should be empty after evicting everything!");