Tencent / Tencent/libpag

flush引发的anr问题

Open
#3,147 1 comment 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
5.8k
Forks
531
Avg merge
8d 55m
Merged PRs (30d)
17

Description

[

【版本信息】[

](https://github.com/Tencent/libpag/issues)
4.2.100

【平台信息】

Android 原生

【预期的表现】

加载pag后,能正常显示第一帧画面

【实际的情况】

引发了线上个别用户ANR
0 ANR_EXCEPTION: 1 org.libpag.PAGPlayer.flushAndFenceSync(Native Method) 2 org.libpag.PAGPlayer.flush(Unknown Source:1) 3 org.libpag.PAGView.flush(SourceFile:4) 4 cn.kuwo.ui.nowplay.widget.KwPAGView.flush(SourceFile:4)

测试发现,flush回调回触发2次

【Demo及附件】

线上问题引发代码:
pagFile.replaceImage(replaceIndex, PAGImage.FromBitmap(squareBitmap)) mPagView.composition = pagFile mPagView.progress = 0.1 mPagView.setRepeatCount(0) mPagView.setScaleMode(PAGScaleMode.Zoom) mPagView.flush()

后以为是调用progress和flush造成两次flush的冲突anr,改代码如下:
if(rid == mLastRid){ LogMgr.d("setCoverBitmap","SquareCoverShadowDelegate setCoverBitmap rid:$rid isSameRid") return } mLastRid = rid pagFile?.replaceImage(replaceIndex, PAGImage.FromBitmap(squareBitmap)) mPagView.composition = pagFile LogMgr.d("setCoverBitmap","SquareCoverShadowDelegate setCoverBitmap rid:$rid success ${mPagView}")

测试发现,flush和animtionupdate回调,还是会触发2次。

](https://github.com/Tencent/libpag/issues)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.