Skip to content

android用硬解码播放器切后台恢复问题 #1324

Closed
@gnwell

Description

@gnwell

需求: 需要实现播放器切后台暂停,恢复前台从暂停位置继续播放的基本功能。
问题:使用硬解码时,后台恢复后出现只播放声音,画面黑屏持续几秒(黑屏时间长短不固定)后画面才能显示。应该是surfaceview重建后重新绑定到player后导致的现象,有遇到过此问题的朋友么?

Activity

bbcallen

bbcallen commented on May 19, 2016

@bbcallen
Contributor

It's a known issue, and no good solution, for now.

gnwell

gnwell commented on May 19, 2016

@gnwell
Author

@bbcallen 请教下,视频黑屏持续期间
SDL_AMediaCodecFake_dequeueOutputBuffer 返回AMEDIACODEC__INFO_TRY_AGAIN_LATER,也就说现在MediaCodec一直没有输出数据对吧?可不可以理解次Surface发生变化都会导致codec reconfigure,重新设置后就会导致解码器输出延时的情况,这是AMEDIACODEC 的问题了?

bbcallen

bbcallen commented on May 19, 2016

@bbcallen
Contributor

No, actually, it's player's issue.
But for MediaCodec, it's a little difficult to workaround.

gnwell

gnwell commented on May 19, 2016

@gnwell
Author

@bbcallen 您指的player问题,是说在这种情况下,不应该创建新的codec么?即使surface重新建立了,也可以继续使用原来的codec?

bbcallen

bbcallen commented on May 19, 2016

@bbcallen
Contributor

Do not recreate MediaCodec is the best practice in theory. You can take a look at github.com/google/grafika for this idea ('Double decode' section). But in real world, it may be broken on some vendor devices.

So, the only option left is that, the player should feed the correct data. This need some H264 knowledges.

gnwell

gnwell commented on May 19, 2016

@gnwell
Author

@bbcallen ,very appreciate for your help!!:)

gnwell

gnwell commented on May 19, 2016

@gnwell
Author

@bbcallen come back again. 看了下bilibili的应用,采用硬件解码,切后台回来后好像codec没有重新建立?还是用的以前的codec是么?

bbcallen

bbcallen commented on May 19, 2016

@bbcallen
Contributor

Sorry, I don't have any authority to talk about the detail of the application in public.

gnwell

gnwell commented on May 19, 2016

@gnwell
Author

@bbcallen thanks a lot though:)

AliveingSoul

AliveingSoul commented on May 19, 2016

@AliveingSoul

@bbcallen 我遇到的情况是开启硬解码后,后台切换回来播放会花屏几秒,然后正常,也是跟楼主一样的原因吗?
qq 20160519195510

gnwell

gnwell commented on May 19, 2016

@gnwell
Author

maybe codec requries idr frame when renew.

gnwell

gnwell commented on May 19, 2016

@gnwell
Author

maybe codec requries idr frame when renew.

AliveingSoul

AliveingSoul commented on May 19, 2016

@AliveingSoul

@gnwell But when I turn off the screen then turn on again ,It's not have this problem , Their life cycle should be no different

gnwell

gnwell commented on May 19, 2016

@gnwell
Author

check log whether the decoder is configured with your operations. i have tried the ideas mentioned by bbcallen github.com/google/grafika for this idea ('Double decode' section). it works.

gnwell

gnwell commented on May 19, 2016

@gnwell
Author

check log whether the decoder is configured with your operations. i have tried the ideas mentioned by bbcallen github.com/google/grafika for this idea ('Double decode' section). it works.

35 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @bbcallen@dourgulf@bingxuebage@teddyla@lgengsy

        Issue actions

          android用硬解码播放器切后台恢复问题 · Issue #1324 · bilibili/ijkplayer