Skip to content

Commit dce820b

Browse files
committed
Log decoding errors
1 parent 2c3b737 commit dce820b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

static-avif/src/main/java/com/facebook/avifsupport/AvifDecoder.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.facebook.avifsupport
22

33
import android.graphics.Bitmap
4+
import android.util.Log
5+
import com.facebook.common.logging.FLog
46
import com.facebook.imagepipeline.common.ImageDecodeOptions
57
import com.facebook.imagepipeline.decoder.ImageDecoder
68
import com.facebook.imagepipeline.image.CloseableImage
@@ -24,16 +26,17 @@ class AvifDecoder(private val bitmapPool: BitmapPool) : ImageDecoder {
2426

2527
val info = Info()
2628
if (!AvifDecoder.getInfo(byteBuffer, length, info)) {
29+
FLog.e(TAG, "Error when getting Info from AvifDecoder")
2730
return null
2831
}
2932

3033
val bitmap = getBitmap(info.width, info.height, options.bitmapConfig)
3134

3235
if (!AvifDecoder.decode(byteBuffer, byteBuffer.remaining(), bitmap)) {
36+
FLog.e(TAG, "Error while decoding")
3337
return null
3438
}
3539

36-
3740
return CloseableStaticBitmap.of(
3841
bitmap,
3942
bitmapPool::release,
@@ -48,4 +51,8 @@ class AvifDecoder(private val bitmapPool: BitmapPool) : ImageDecoder {
4851
bitmap.reconfigure(width, height, config)
4952
}
5053
}
54+
55+
companion object {
56+
private const val TAG = "AvifDecoder"
57+
}
5158
}

0 commit comments

Comments
 (0)