mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1876414 - Let SetVideoDataToImage return MediaResult r=media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D200568
This commit is contained in:
parent
9d206aa4a4
commit
af045ec3b4
@ -299,18 +299,24 @@ PlanarYCbCrData ConstructPlanarYCbCrData(const VideoInfo& aInfo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
bool VideoData::SetVideoDataToImage(PlanarYCbCrImage* aVideoImage,
|
MediaResult VideoData::SetVideoDataToImage(PlanarYCbCrImage* aVideoImage,
|
||||||
const VideoInfo& aInfo,
|
const VideoInfo& aInfo,
|
||||||
const YCbCrBuffer& aBuffer,
|
const YCbCrBuffer& aBuffer,
|
||||||
const IntRect& aPicture, bool aCopyData) {
|
const IntRect& aPicture,
|
||||||
|
bool aCopyData) {
|
||||||
MOZ_ASSERT(aVideoImage);
|
MOZ_ASSERT(aVideoImage);
|
||||||
|
|
||||||
PlanarYCbCrData data = ConstructPlanarYCbCrData(aInfo, aBuffer, aPicture);
|
PlanarYCbCrData data = ConstructPlanarYCbCrData(aInfo, aBuffer, aPicture);
|
||||||
|
|
||||||
if (aCopyData) {
|
if (aCopyData) {
|
||||||
return aVideoImage->CopyData(data);
|
// TODO: PlanarYCbCrImage::CopyData may return false on non out-of-memory
|
||||||
|
// failures.
|
||||||
|
return MediaResult(
|
||||||
|
aVideoImage->CopyData(data) ? NS_OK : NS_ERROR_OUT_OF_MEMORY,
|
||||||
|
RESULT_DETAIL("Failed to copy image data"));
|
||||||
}
|
}
|
||||||
return aVideoImage->AdoptData(data);
|
return MediaResult(aVideoImage->AdoptData(data) ? NS_OK : NS_ERROR_UNEXPECTED,
|
||||||
|
RESULT_DETAIL("Failed to adopt image data"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
@ -367,12 +373,10 @@ Result<already_AddRefed<VideoData>, MediaResult> VideoData::CreateAndCopyData(
|
|||||||
PlanarYCbCrImage* videoImage = v->mImage->AsPlanarYCbCrImage();
|
PlanarYCbCrImage* videoImage = v->mImage->AsPlanarYCbCrImage();
|
||||||
MOZ_ASSERT(videoImage);
|
MOZ_ASSERT(videoImage);
|
||||||
|
|
||||||
if (!VideoData::SetVideoDataToImage(videoImage, aInfo, aBuffer, aPicture,
|
if (MediaResult r = VideoData::SetVideoDataToImage(
|
||||||
true /* aCopyData */)) {
|
videoImage, aInfo, aBuffer, aPicture, true /* aCopyData */);
|
||||||
// TODO: VideoData::SetVideoDataToImage may return NULL on non out-of-memory
|
NS_FAILED(r)) {
|
||||||
// failures.
|
return Err(r);
|
||||||
return Err(MediaResult(NS_ERROR_OUT_OF_MEMORY,
|
|
||||||
"Failed to create a PlanarYCbCrImage"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
perfRecorder.Record();
|
perfRecorder.Record();
|
||||||
|
@ -520,10 +520,11 @@ class VideoData : public MediaData {
|
|||||||
|
|
||||||
// Initialize PlanarYCbCrImage. Only When aCopyData is true,
|
// Initialize PlanarYCbCrImage. Only When aCopyData is true,
|
||||||
// video data is copied to PlanarYCbCrImage.
|
// video data is copied to PlanarYCbCrImage.
|
||||||
static bool SetVideoDataToImage(PlanarYCbCrImage* aVideoImage,
|
static MediaResult SetVideoDataToImage(PlanarYCbCrImage* aVideoImage,
|
||||||
const VideoInfo& aInfo,
|
const VideoInfo& aInfo,
|
||||||
const YCbCrBuffer& aBuffer,
|
const YCbCrBuffer& aBuffer,
|
||||||
const IntRect& aPicture, bool aCopyData);
|
const IntRect& aPicture,
|
||||||
|
bool aCopyData);
|
||||||
|
|
||||||
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
|
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user