Bug 1707242 - part1 : use empty image in null video data. r=bryce

Using a non-null image can prevent element from changing its ready state incorrectly to `HAVE_METADATA`. See more detailed analysis in [1].

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1707242#c9

Differential Revision: https://phabricator.services.mozilla.com/D114005
This commit is contained in:
alwu 2021-05-03 21:12:01 +00:00
Родитель 7cd2790f31
Коммит 46b9e4daeb
1 изменённых файлов: 7 добавлений и 5 удалений

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

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "DummyMediaDataDecoder.h"
#include "ImageContainer.h"
namespace mozilla {
@ -13,12 +14,13 @@ class NullVideoDataCreator : public DummyDataCreator {
NullVideoDataCreator() = default;
already_AddRefed<MediaData> Create(MediaRawData* aSample) override {
// Create a dummy VideoData with no image. This gives us something to
// Create a dummy VideoData with an empty image. This gives us something to
// send to media streams if necessary.
RefPtr<VideoData> v(new VideoData(aSample->mOffset, aSample->mTime,
aSample->mDuration, aSample->mKeyframe,
aSample->mTimecode, gfx::IntSize(), 0));
return v.forget();
RefPtr<layers::PlanarYCbCrImage> image =
new layers::RecyclingPlanarYCbCrImage(new layers::BufferRecycleBin());
return VideoData::CreateFromImage(gfx::IntSize(), aSample->mOffset,
aSample->mTime, aSample->mDuration, image,
aSample->mKeyframe, aSample->mTimecode);
}
};