From 1b5e2b4ca7a9accc7eb070d652385dd1fd418d40 Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Wed, 23 Feb 2022 17:28:58 +0900 Subject: [PATCH] [Tizen] Fix issue when animated image loading fail Make works well if animate-image loading failed. Previous behaviour make mFrameCount = 0. And this can make many side effects. This patch make fast-cut when loading failed. Change-Id: Ia221ffba049e7f7b353b928d0d9c5caadeed5c8b Signed-off-by: Eunki, Hong --- .../rolling-animated-image-cache.cpp | 27 ++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.cpp b/dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.cpp index 2fdf71f..5bee46c 100644 --- a/dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.cpp +++ b/dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -97,12 +97,12 @@ TextureSet RollingAnimatedImageCache::Frame(uint32_t frameIndex) } TextureSet textureSet; - uint32_t batchFrameIndex = frameIndex; + uint32_t batchFrameIndex = frameIndex; // If we need to load new frame that are not stored in queue. // Load the frame synchronously. if(mIsSynchronousLoading && mQueue.IsEmpty()) { - textureSet = RequestFrameLoading(frameIndex, frameIndex == FIRST_FRAME_INDEX, true); + textureSet = RequestFrameLoading(frameIndex, frameIndex == FIRST_FRAME_INDEX, true); batchFrameIndex = (frameIndex + 1) % mFrameCount; } @@ -306,14 +306,6 @@ void RollingAnimatedImageCache::AnimatedImageUploadComplete(bool loadSuccess, in DALI_LOG_INFO(gAnimImgLogFilter, Debug::Concise, "AnimatedImageVisual::UploadComplete(textureId:%d) start\n", textureId); LOG_CACHE; - // Reset size of Queue according to the real frame count. - if(mFrameCount != frameCount) - { - mFrameCount = frameCount; - mImageUrls.resize(mFrameCount); - mIntervals.assign(mFrameCount, 0u); - } - if(loadSuccess) { mLoadState = TextureManager::LoadState::LOAD_FINISHED; @@ -321,12 +313,23 @@ void RollingAnimatedImageCache::AnimatedImageUploadComplete(bool loadSuccess, in else { mLoadState = TextureManager::LoadState::LOAD_FAILED; + // If load failed, send empty TextureSet handle so observer can notify that frame load failed. + mObserver.FrameReady(TextureSet(), 0u); + return; + } + + // Reset size of Queue according to the real frame count. + if(mFrameCount != frameCount) + { + mFrameCount = frameCount; + mImageUrls.resize(mFrameCount); + mIntervals.assign(mFrameCount, 0u); } bool frontFrameReady = IsFrontReady(); // Because only one frame is on loading and the others are in mLoadWaitingQueue, // mQueue.Back() is always the frame currently loaded. - mQueue.Back().mReady = true; + mQueue.Back().mReady = true; mIntervals[mQueue.Back().mFrameNumber] = interval; // Check whether currently loaded frame is front of queue or not. // If it is, notify frame ready to observer. -- 2.7.4