From 2afb46016f56f52f70b5cb272dcce3185fe47ce7 Mon Sep 17 00:00:00 2001 From: kean Date: Thu, 20 Jul 2023 18:04:44 -0400 Subject: [PATCH] Adjust GIF buffer limits --- .../Classes/Utility/Media/GIFPlaybackStrategy.swift | 9 --------- .../ViewRelated/Media/CachedAnimatedImageView.swift | 1 - 2 files changed, 10 deletions(-) diff --git a/WordPress/Classes/Utility/Media/GIFPlaybackStrategy.swift b/WordPress/Classes/Utility/Media/GIFPlaybackStrategy.swift index c2d6d670db75..fc697c51c66d 100644 --- a/WordPress/Classes/Utility/Media/GIFPlaybackStrategy.swift +++ b/WordPress/Classes/Utility/Media/GIFPlaybackStrategy.swift @@ -28,11 +28,6 @@ public protocol GIFPlaybackStrategy { /// var maxSize: Int { get } - /// The number of frames that should be buffered. A high number will result in more - /// memory usage and less CPU load, and vice versa. Default is 50. - /// - var frameBufferCount: Int { get } - /// Returns the coresponding GIFStrategy enum value. /// var gifStrategy: GIFStrategy { get } @@ -57,24 +52,20 @@ extension GIFPlaybackStrategy { // This is good for thumbnail GIFs used in a collection view class TinyGIFPlaybackStrategy: GIFPlaybackStrategy { var maxSize = 2_000_000 // in MB - var frameBufferCount = 5 var gifStrategy: GIFStrategy = .tinyGIFs } class SmallGIFPlaybackStrategy: GIFPlaybackStrategy { var maxSize = 8_000_000 // in MB - var frameBufferCount = 50 var gifStrategy: GIFStrategy = .smallGIFs } class MediumGIFPlaybackStrategy: GIFPlaybackStrategy { var maxSize = 20_000_000 // in MB - var frameBufferCount = 150 var gifStrategy: GIFStrategy = .mediumGIFs } class LargeGIFPlaybackStrategy: GIFPlaybackStrategy { var maxSize = 50_000_000 // in MB - var frameBufferCount = 300 var gifStrategy: GIFStrategy = .largeGIFs } diff --git a/WordPress/Classes/ViewRelated/Media/CachedAnimatedImageView.swift b/WordPress/Classes/ViewRelated/Media/CachedAnimatedImageView.swift index aea9a4e638bc..3ac0f5a8f67e 100644 --- a/WordPress/Classes/ViewRelated/Media/CachedAnimatedImageView.swift +++ b/WordPress/Classes/ViewRelated/Media/CachedAnimatedImageView.swift @@ -220,7 +220,6 @@ public class CachedAnimatedImageView: UIImageView, GIFAnimatable { private func animate(data: Data, success: (() -> Void)?) { animatedGifData = data DispatchQueue.main.async() { - self.setFrameBufferCount(self.gifPlaybackStrategy.frameBufferCount) self.animate(withGIFData: data) { success?() }