Loading media/libheif/HeifDecoderImpl.cpp +8 −2 Original line number Original line Diff line number Diff line Loading @@ -32,6 +32,7 @@ #include <private/media/VideoFrame.h> #include <private/media/VideoFrame.h> #include <utils/Log.h> #include <utils/Log.h> #include <utils/RefBase.h> #include <utils/RefBase.h> #include <algorithm> #include <vector> #include <vector> HeifDecoder* createHeifDecoder() { HeifDecoder* createHeifDecoder() { Loading @@ -42,7 +43,10 @@ namespace android { void initFrameInfo(HeifFrameInfo *info, const VideoFrame *videoFrame) { void initFrameInfo(HeifFrameInfo *info, const VideoFrame *videoFrame) { info->mWidth = videoFrame->mDisplayWidth; info->mWidth = videoFrame->mDisplayWidth; info->mHeight = videoFrame->mDisplayHeight; // Number of scanlines is mDisplayHeight. Clamp it to mHeight to guard // against malformed streams claiming that mDisplayHeight is greater than // mHeight. info->mHeight = std::min(videoFrame->mDisplayHeight, videoFrame->mHeight); info->mRotationAngle = videoFrame->mRotationAngle; info->mRotationAngle = videoFrame->mRotationAngle; info->mBytesPerPixel = videoFrame->mBytesPerPixel; info->mBytesPerPixel = videoFrame->mBytesPerPixel; info->mDurationUs = videoFrame->mDurationUs; info->mDurationUs = videoFrame->mDurationUs; Loading Loading @@ -746,7 +750,9 @@ bool HeifDecoderImpl::getScanlineInner(uint8_t* dst) { (videoFrame->mRowBytes * (mCurScanline + videoFrame->mDisplayTop)) + (videoFrame->mRowBytes * (mCurScanline + videoFrame->mDisplayTop)) + (videoFrame->mBytesPerPixel * videoFrame->mDisplayLeft); (videoFrame->mBytesPerPixel * videoFrame->mDisplayLeft); mCurScanline++; mCurScanline++; memcpy(dst, src, videoFrame->mBytesPerPixel * videoFrame->mDisplayWidth); // Do not try to copy more than |videoFrame->mWidth| pixels. uint32_t width = std::min(videoFrame->mDisplayWidth, videoFrame->mWidth); memcpy(dst, src, videoFrame->mBytesPerPixel * width); return true; return true; } } Loading media/libstagefright/FrameDecoder.cpp +0 −7 Original line number Original line Diff line number Diff line Loading @@ -102,13 +102,6 @@ sp<IMemory> allocVideoFrame(const sp<MetaData>& trackMeta, displayTop = 0; displayTop = 0; } } } } if (displayWidth > width) { displayWidth = width; } if (displayHeight > height) { displayHeight = height; } if (allocRotated) { if (allocRotated) { if (rotationAngle == 90 || rotationAngle == 270) { if (rotationAngle == 90 || rotationAngle == 270) { Loading Loading
media/libheif/HeifDecoderImpl.cpp +8 −2 Original line number Original line Diff line number Diff line Loading @@ -32,6 +32,7 @@ #include <private/media/VideoFrame.h> #include <private/media/VideoFrame.h> #include <utils/Log.h> #include <utils/Log.h> #include <utils/RefBase.h> #include <utils/RefBase.h> #include <algorithm> #include <vector> #include <vector> HeifDecoder* createHeifDecoder() { HeifDecoder* createHeifDecoder() { Loading @@ -42,7 +43,10 @@ namespace android { void initFrameInfo(HeifFrameInfo *info, const VideoFrame *videoFrame) { void initFrameInfo(HeifFrameInfo *info, const VideoFrame *videoFrame) { info->mWidth = videoFrame->mDisplayWidth; info->mWidth = videoFrame->mDisplayWidth; info->mHeight = videoFrame->mDisplayHeight; // Number of scanlines is mDisplayHeight. Clamp it to mHeight to guard // against malformed streams claiming that mDisplayHeight is greater than // mHeight. info->mHeight = std::min(videoFrame->mDisplayHeight, videoFrame->mHeight); info->mRotationAngle = videoFrame->mRotationAngle; info->mRotationAngle = videoFrame->mRotationAngle; info->mBytesPerPixel = videoFrame->mBytesPerPixel; info->mBytesPerPixel = videoFrame->mBytesPerPixel; info->mDurationUs = videoFrame->mDurationUs; info->mDurationUs = videoFrame->mDurationUs; Loading Loading @@ -746,7 +750,9 @@ bool HeifDecoderImpl::getScanlineInner(uint8_t* dst) { (videoFrame->mRowBytes * (mCurScanline + videoFrame->mDisplayTop)) + (videoFrame->mRowBytes * (mCurScanline + videoFrame->mDisplayTop)) + (videoFrame->mBytesPerPixel * videoFrame->mDisplayLeft); (videoFrame->mBytesPerPixel * videoFrame->mDisplayLeft); mCurScanline++; mCurScanline++; memcpy(dst, src, videoFrame->mBytesPerPixel * videoFrame->mDisplayWidth); // Do not try to copy more than |videoFrame->mWidth| pixels. uint32_t width = std::min(videoFrame->mDisplayWidth, videoFrame->mWidth); memcpy(dst, src, videoFrame->mBytesPerPixel * width); return true; return true; } } Loading
media/libstagefright/FrameDecoder.cpp +0 −7 Original line number Original line Diff line number Diff line Loading @@ -102,13 +102,6 @@ sp<IMemory> allocVideoFrame(const sp<MetaData>& trackMeta, displayTop = 0; displayTop = 0; } } } } if (displayWidth > width) { displayWidth = width; } if (displayHeight > height) { displayHeight = height; } if (allocRotated) { if (allocRotated) { if (rotationAngle == 90 || rotationAngle == 270) { if (rotationAngle == 90 || rotationAngle == 270) { Loading