Skip to content

获取视频alignWidth和alignHeight失败导致动画出现黑色阴影 #408

Description

@itlgl

获取视频alignWidth和alignHeight失败导致动画出现黑色阴影

  1. 问题描述(重现路径):偶现,但是出现问题后后续所有动效都有黑色阴影,只能app杀死重启恢复,没有必现方式
    黑色阴影问题截图参考 部分机型 动画变形 并且有黑色阴影 #291

  2. 运行环境(手机型号,Android/iOS版本等):Android

  3. 相关日志通过ALog截取到关键日志,获取alignWidth和alignHeight失败后,导致视频无法对齐。

2025-08-14 14:16:23.039 25054-25054 AnimPlayer...eContainer I  FileContainer init
2025-08-14 14:16:23.043 25054-28930 AnimPlayer...figManager I  parseConfig cost=1ms enableVersion1=false result=true
2025-08-14 14:16:23.043 25054-28930 AnimPlayer...ginManager I  onConfigCreate
2025-08-14 14:16:23.044 25054-28930 AnimPlayer.AnimPlayer   I  parse AnimConfig(version=2, totalFrames=120, width=750, height=770, videoWidth=1504, videoHeight=784, orien=0, fps=30, isMix=false, alphaPointRect=PointRect(x=754, y=0, w=750, h=770), rgbPointRect=PointRect(x=0, y=0, w=750, h=770), isDefaultConfig=false)
2025-08-14 14:16:23.044 25054-28930 AnimPlayer.AnimView     E  onSizeChanged not called
2025-08-14 14:16:23.060 25054-25054 AnimPlayer.AnimView     I  onAttachedToWindow
2025-08-14 14:16:23.060 25054-25054 AnimPlayer.AnimView     E  is running can not start
2025-08-14 14:16:23.063 25054-25054 AnimPlayer.AnimView     I  onSizeChanged w=1077, h=1109
2025-08-14 14:16:23.068 25054-25054 AnimPlayer...leTypeUtil I  scaleType=FIT_CENTER
2025-08-14 14:16:23.081 25054-25054 AnimPlayer.AnimView     I  onSurfaceTextureAvailable width=0 height=0
2025-08-14 14:16:23.091 25054-28930 AnimPlayer.MediaUtil    I  Extractor selected track 0 (video/avc): {track-id=1, file-format=video/mp4, level=2048, mime=video/avc, frame-count=120, profile=2, language=, display-width=1504, csd-1=java.nio.HeapByteBuffer[pos=0 lim=9 cap=9], durationUs=4000000, display-height=784, width=1504, rotation-degrees=0, max-input-size=884353, frame-rate=30, height=784, csd-0=java.nio.HeapByteBuffer[pos=0 lim=28 cap=28]}
2025-08-14 14:16:23.093 25054-28930 AnimPlayer.HardDecoder  I  Video size is 1504 x 784
2025-08-14 14:16:23.093 25054-28930 AnimPlayer.Decoder      I  prepareRender
2025-08-14 14:16:23.097 25054-28930 AnimPlayer...ginManager I  onRenderCreate
2025-08-14 14:16:23.097 25054-28930 AnimPlayer...AnimPlugin I  mask render init
2025-08-14 14:16:23.098 25054-28930 AnimPlayer.HardDecoder  I  Video MIME is video/avc
2025-08-14 14:16:23.103 25054-28933 AnimPlayer.AudioPlayer  E  cannot find audio track
2025-08-14 14:16:23.179 25054-25054 AnimPlayer.AnimView     I  onSizeChanged w=1080, h=1109
2025-08-14 14:16:23.179 25054-25054 AnimPlayer.AnimView     I  onSurfaceTextureSizeChanged 1077 x 1105
2025-08-14 14:16:23.224 25054-28931 AnimPlayer.HardDecoder  E  java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
                                                               java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
                                                               	at android.media.MediaFormat.getInteger(MediaFormat.java:1182)
                                                               	at com.tencent.qgame.animplayer.HardDecoder.startDecode(HardDecoder.kt:261)
                                                               	at com.tencent.qgame.animplayer.HardDecoder.access$startDecode(HardDecoder.kt:27)
                                                               	at com.tencent.qgame.animplayer.HardDecoder$startPlay$$inlined$apply$lambda$1.run(HardDecoder.kt:183)
                                                               	at android.os.Handler.handleCallback(Handler.java:883)
                                                               	at android.os.Handler.dispatchMessage(Handler.java:100)
                                                               	at android.os.Looper.loop(Looper.java:224)
                                                               	at android.os.HandlerThread.run(HandlerThread.java:67)
2025-08-14 14:16:23.224 25054-28931 AnimPlayer.HardDecoder  I  decoder output format changed: {crop-right=1503, max-height=240, color-format=2130708361, mime=video/raw, color-standard=1, color-transfer=3, crop-bottom=783, max-width=320, crop-left=0, width=1504, color-range=2, crop-top=0, rotation-degrees=0, height=784}
2025-08-14 14:16:23.224 25054-28931 AnimPlayer.HardDecoder  E  videoWidth = 1504, videoHeight = 784
2025-08-14 14:16:23.224 25054-28931 AnimPlayer.HardDecoder  E  alignWidth = 1504, alignHeight = 784
2025-08-14 14:16:23.226 25054-28931 AnimPlayer.Decoder      I  onVideoStart
2025-08-14 14:16:27.227 25054-28931 AnimPlayer...ginManager I  onLoopStart
2025-08-14 14:16:27.231 25054-28931 AnimPlayer.HardDecoder  I  pause decode
2025-08-14 14:16:32.556 25054-25054 AnimPlayer.AnimView     I  onSurfaceTextureDestroyed
2025-08-14 14:16:32.556 25054-25054 AnimPlayer.HardDecoder  I  destroyInner
2025-08-14 14:16:32.556 25054-25054 AnimPlayer.AnimView     I  onDetachedFromWindow
2025-08-14 14:16:32.556 25054-25054 AnimPlayer.HardDecoder  I  destroyInner
2025-08-14 14:16:32.556 25054-25054 AnimPlayer.AudioPlayer  I  destroyThread
2025-08-14 14:16:32.558 25054-28930 AnimPlayer...ginManager I  onDestroy

下面是正常播放下ALog截取的日志:

2025-08-14 13:46:08.599 23206-23206 AnimPlayer...eContainer I  FileContainer init
2025-08-14 13:46:08.601 23206-24195 AnimPlayer...figManager I  parseConfig cost=1ms enableVersion1=false result=true
2025-08-14 13:46:08.601 23206-24195 AnimPlayer...ginManager I  onConfigCreate
2025-08-14 13:46:08.602 23206-24195 AnimPlayer.AnimPlayer   I  parse AnimConfig(version=2, totalFrames=120, width=750, height=770, videoWidth=1504, videoHeight=784, orien=0, fps=30, isMix=false, alphaPointRect=PointRect(x=754, y=0, w=750, h=770), rgbPointRect=PointRect(x=0, y=0, w=750, h=770), isDefaultConfig=false)
2025-08-14 13:46:08.602 23206-24195 AnimPlayer.AnimView     E  onSizeChanged not called
2025-08-14 13:46:08.605 23206-23206 AnimPlayer.AnimView     I  onAttachedToWindow
2025-08-14 13:46:08.605 23206-23206 AnimPlayer.AnimView     E  is running can not start
2025-08-14 13:46:08.608 23206-23206 AnimPlayer.AnimView     I  onSizeChanged w=1077, h=1109
2025-08-14 13:46:08.613 23206-23206 AnimPlayer...leTypeUtil I  scaleType=FIT_CENTER
2025-08-14 13:46:08.624 23206-23206 AnimPlayer.AnimView     I  onSurfaceTextureAvailable width=0 height=0
2025-08-14 13:46:08.634 23206-24195 AnimPlayer.MediaUtil    I  Extractor selected track 0 (video/avc): {track-id=1, file-format=video/mp4, level=2048, mime=video/avc, frame-count=120, profile=2, language=, display-width=1504, csd-1=java.nio.HeapByteBuffer[pos=0 lim=9 cap=9], durationUs=4000000, display-height=784, width=1504, rotation-degrees=0, max-input-size=884353, frame-rate=30, height=784, csd-0=java.nio.HeapByteBuffer[pos=0 lim=28 cap=28]}
2025-08-14 13:46:08.638 23206-24195 AnimPlayer.HardDecoder  I  Video size is 1504 x 784
2025-08-14 13:46:08.638 23206-24195 AnimPlayer.Decoder      I  prepareRender
2025-08-14 13:46:08.641 23206-24195 AnimPlayer...ginManager I  onRenderCreate
2025-08-14 13:46:08.641 23206-24195 AnimPlayer...AnimPlugin I  mask render init
2025-08-14 13:46:08.643 23206-24195 AnimPlayer.HardDecoder  I  Video MIME is video/avc
2025-08-14 13:46:08.648 23206-24197 AnimPlayer.AudioPlayer  E  cannot find audio track
2025-08-14 13:46:08.710 23206-24196 AnimPlayer.HardDecoder  I  decoder output format changed: {crop-right=1503, color-format=2141391878, slice-height=800, mime=video/raw, hdr-static-info=java.nio.HeapByteBuffer[pos=0 lim=25 cap=25], stride=1536, color-standard=1, color-transfer=3, crop-bottom=783, crop-left=0, width=1504, color-range=2, crop-top=0, height=784}
2025-08-14 13:46:08.710 23206-24196 AnimPlayer.HardDecoder  E  videoWidth = 1504, videoHeight = 784
2025-08-14 13:46:08.710 23206-24196 AnimPlayer.HardDecoder  E  alignWidth = 1536, alignHeight = 800
2025-08-14 13:46:08.712 23206-24196 AnimPlayer.Decoder      I  onVideoStart
2025-08-14 13:46:12.714 23206-24196 AnimPlayer...ginManager I  onLoopStart
2025-08-14 13:46:16.711 23206-24195 AnimPlayer.HardDecoder  I  release
2025-08-14 13:46:16.746 23206-24195 AnimPlayer...ginManager I  onRelease
2025-08-14 13:46:16.749 23206-24195 AnimPlayer.Decoder      I  onVideoComplete
2025-08-14 13:46:16.751 23206-23206 AnimPlayer.AnimView     I  onSurfaceTextureDestroyed
2025-08-14 13:46:16.751 23206-23206 AnimPlayer.HardDecoder  I  destroyInner
2025-08-14 13:46:16.752 23206-24195 AnimPlayer...ginManager I  onDestroy
2025-08-14 13:46:16.755 23206-24195 AnimPlayer.Decoder      I  onVideoDestroy

问题发生在HardDecoder类内。

  1. 播放错误的文件(可选)
    所有动效文件都有可能出现,不局限于某个动效

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions