зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1348381 - Handle VideoFrame::CreateBlackImage returning nullptr. r=jesup
MozReview-Commit-ID: LWon0cx5hAK --HG-- extra : rebase_source : 76db5d68bbfd5ec207ee72fd357f08bcc564fab0
This commit is contained in:
Родитель
c8c613c355
Коммит
06cde897a7
|
@ -50,7 +50,6 @@ VideoFrame::CreateBlackImage(const gfx::IntSize& aSize)
|
|||
LayerManager::CreateImageContainer(ImageContainer::ASYNCHRONOUS);
|
||||
RefPtr<PlanarYCbCrImage> image = container->CreatePlanarYCbCrImage();
|
||||
if (!image) {
|
||||
MOZ_ASSERT(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -82,7 +81,6 @@ VideoFrame::CreateBlackImage(const gfx::IntSize& aSize)
|
|||
|
||||
// Copies data, so we can free data.
|
||||
if (!image->CopyData(data)) {
|
||||
MOZ_ASSERT(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -347,7 +347,11 @@ nsresult VP8TrackEncoder::PrepareRawFrame(VideoChunk &aChunk)
|
|||
if (aChunk.mFrame.GetForceBlack() || aChunk.IsNull()) {
|
||||
if (!mMuteFrame) {
|
||||
mMuteFrame = VideoFrame::CreateBlackImage(gfx::IntSize(mFrameWidth, mFrameHeight));
|
||||
MOZ_ASSERT(mMuteFrame);
|
||||
}
|
||||
if (!mMuteFrame) {
|
||||
VP8LOG(LogLevel::Warning, "Failed to allocate black image of size %dx%d",
|
||||
mFrameWidth, mFrameHeight);
|
||||
return NS_OK;
|
||||
}
|
||||
img = mMuteFrame;
|
||||
} else {
|
||||
|
|
|
@ -128,11 +128,8 @@ CaptureTask::SetCurrentFrames(const VideoSegment& aSegment)
|
|||
RefPtr<CaptureTask> mTask;
|
||||
};
|
||||
|
||||
VideoSegment::ConstChunkIterator iter(aSegment);
|
||||
|
||||
|
||||
|
||||
while (!iter.IsEnded()) {
|
||||
for (VideoSegment::ConstChunkIterator iter(aSegment);
|
||||
!iter.IsEnded(); iter.Next()) {
|
||||
VideoChunk chunk = *iter;
|
||||
|
||||
// Extract the first valid video frame.
|
||||
|
@ -145,7 +142,10 @@ CaptureTask::SetCurrentFrames(const VideoSegment& aSegment)
|
|||
} else {
|
||||
image = chunk.mFrame.GetImage();
|
||||
}
|
||||
MOZ_ASSERT(image);
|
||||
if (!image) {
|
||||
MOZ_ASSERT(image);
|
||||
continue;
|
||||
}
|
||||
mImageGrabbedOrTrackEnd = true;
|
||||
|
||||
// Encode image.
|
||||
|
@ -163,7 +163,6 @@ CaptureTask::SetCurrentFrames(const VideoSegment& aSegment)
|
|||
}
|
||||
return;
|
||||
}
|
||||
iter.Next();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче