summaryrefslogtreecommitdiffstats
path: root/dom/media/ImageToI420.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/media/ImageToI420.cpp')
-rw-r--r--dom/media/ImageToI420.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/dom/media/ImageToI420.cpp b/dom/media/ImageToI420.cpp
index 8fc5198b4a..0f7976cb63 100644
--- a/dom/media/ImageToI420.cpp
+++ b/dom/media/ImageToI420.cpp
@@ -11,6 +11,7 @@
#include "mozilla/dom/ImageUtils.h"
#include "mozilla/gfx/Point.h"
#include "mozilla/RefPtr.h"
+#include "mozilla/Result.h"
#include "nsThreadUtils.h"
using mozilla::ImageFormat;
@@ -75,7 +76,12 @@ nsresult ConvertToI420(Image* aImage, uint8_t* aDestY, int aDestStrideY,
if (const PlanarYCbCrData* data = GetPlanarYCbCrData(aImage)) {
const ImageUtils imageUtils(aImage);
- switch (imageUtils.GetFormat()) {
+ Maybe<dom::ImageBitmapFormat> format = imageUtils.GetFormat();
+ if (format.isNothing()) {
+ MOZ_ASSERT_UNREACHABLE("YUV format conversion not implemented");
+ return NS_ERROR_NOT_IMPLEMENTED;
+ }
+ switch (format.value()) {
case ImageBitmapFormat::YUV420P:
return MapRv(libyuv::I420ToI420(
data->mYChannel, data->mYStride, data->mCbChannel,