Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Unified Diff: third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp

Issue 1962563002: Fix ImageDecoder::frameIsCompleteAtIndex - fully received instead of decoded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ASSERT if frameCount not called to parse before calling... Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp
diff --git a/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp
index fae908a78e567ec303b4b967a767735cffe0861c..ec052ebe3d0946004e9b9242179560d2916113bf 100644
--- a/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp
@@ -128,7 +128,6 @@ WEBPImageDecoder::WEBPImageDecoder(AlphaOption alphaOption, GammaAndColorProfile
, m_frameBackgroundHasAlpha(false)
, m_demux(0)
, m_demuxState(WEBP_DEMUX_PARSING_HEADER)
- , m_haveAlreadyParsedThisData(false)
, m_repetitionCount(cAnimationLoopOnce)
, m_decodedHeight(0)
{
@@ -156,24 +155,20 @@ void WEBPImageDecoder::clearDecoder()
m_frameBackgroundHasAlpha = false;
}
-void WEBPImageDecoder::onSetData(SegmentReader*)
-{
- m_haveAlreadyParsedThisData = false;
-}
-
int WEBPImageDecoder::repetitionCount() const
{
return failed() ? cAnimationLoopOnce : m_repetitionCount;
}
-bool WEBPImageDecoder::frameIsCompleteAtIndex(size_t index) const
+bool WEBPImageDecoder::frameIsFullyReceivedAtIndex(size_t index) const
{
- if (!m_demux || m_demuxState <= WEBP_DEMUX_PARSING_HEADER)
- return false;
+ ASSERT(m_haveUpdatedFrameCount);
if (!(m_formatFlags & ANIMATION_FLAG))
- return ImageDecoder::frameIsCompleteAtIndex(index);
- bool frameIsLoadedAtIndex = index < m_frameBufferCache.size();
- return frameIsLoadedAtIndex;
+ return ImageDecoder::frameIsFullyReceivedAtIndex(index);
+
+ // Multi-frame WebP frame gets added to m_frameBufferCache through
+ // initializeNewFrame() only when the frame data is fully received.
+ return index < m_frameBufferCache.size();
}
float WEBPImageDecoder::frameDurationAtIndex(size_t index) const
@@ -186,11 +181,6 @@ bool WEBPImageDecoder::updateDemuxer()
if (failed())
return false;
scroggo_chromium 2016/06/02 21:00:14 Don't you want to return if (haveUpdatedFrameCount
aleksandar.stojiljkovic 2016/06/03 19:33:57 Reverted this code - having ImageDecoder::haveUpda
- if (m_haveAlreadyParsedThisData)
- return true;
-
- m_haveAlreadyParsedThisData = true;
-
const unsigned webpHeaderSize = 30;
if (m_data->size() < webpHeaderSize)
return false; // Await VP8X header so WebPDemuxPartial succeeds.

Powered by Google App Engine
This is Rietveld 408576698