Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When I use exo play video,then switch video,sometimes,screen turn black #3535

Closed
hysbtr opened this issue Dec 2, 2017 · 14 comments
Closed

Comments

@hysbtr
Copy link

hysbtr commented Dec 2, 2017

this bug happened in some specific device,i develop tv app in china.

Issue description

when I switch video,sometimes,the screen is black,but has voice

Reproduction steps

use exoplayer play a video,then stop video ,release video,new an exoplayer,play next one

Link to test content

any video

Version of ExoPlayer being used

2.6.0

Device(s) and version(s) of Android being used

Xiaomi MiTV3S Android 6.0.1

A full bug report captured from the device

12-02 10:45:48.113 8282-8527/com.dangbei.health.fitness W/MediaPlayer: info/warning (701, 0)
12-02 10:45:48.129 8282-8294/com.dangbei.health.fitness W/MediaPlayer: info/warning (702, 100)
12-02 10:45:49.113 8282-8282/com.dangbei.health.fitness D/AudioManager: preDispatchKeyEvent 22
12-02 10:45:49.120 8282-8326/com.dangbei.health.fitness D/awcn.DefaultHeartbeatImpl:  heartbeat session:Session@[umeng:59c325c56e27a47395000020.AWCN1_1|http2_0rtt_acs]
12-02 10:45:49.120 8282-8326/com.dangbei.health.fitness D/awcn.TnetSpdySession: |[seq:umeng:59c325c56e27a47395000020.AWCN1_1] ping host:https://umengacs.m.taobao.com thread:AWCN Scheduler1
12-02 10:45:49.121 8282-8326/com.dangbei.health.fitness D/awcn.TnetSpdySession: |[seq:umeng:59c325c56e27a47395000020.AWCN1_1] https://umengacs.m.taobao.com submit ping ms:45051 force:true
12-02 10:45:49.132 8282-8317/com.dangbei.health.fitness I/awcn.TnetSpdySession: |[seq:umeng:59c325c56e27a47395000020.AWCN1_1] ping receive Host:https://umengacs.m.taobao.com id:1
12-02 10:45:49.378 8282-8282/com.dangbei.health.fitness D/AudioManager: preDispatchKeyEvent 22
12-02 10:45:49.713 8282-8282/com.dangbei.health.fitness I/ExoPlayerImpl: Release 915e7df [ExoPlayerLib/2.6.0] [pulpfiction, MiTV3S, xiaomi, 23] [goog.exo.core]
12-02 10:45:49.714 8282-8282/com.dangbei.health.fitness I/ExoPlayerImpl: Init ed384c4 [ExoPlayerLib/2.6.0] [pulpfiction, MiTV3S, xiaomi, 23]
12-02 10:45:49.718 8282-8282/com.dangbei.health.fitness I/ExoPlayer: idle
12-02 10:45:49.749 8282-8664/com.dangbei.health.fitness I/OMXClient: Using client-side OMX mux.
12-02 10:45:49.769 8282-8282/com.dangbei.health.fitness I/ExoPlayer: buffering
12-02 10:45:49.772 8282-8663/com.dangbei.health.fitness I/MediaCodec: [OMX.amlogic.avc.decoder.awesome] setting surface generation to 8480772
12-02 10:45:49.782 8282-8664/com.dangbei.health.fitness E/ACodec: [OMX.amlogic.avc.decoder.awesome] storeMetaDataInBuffers failed w/ err -2147483648
12-02 10:45:49.789 8282-8664/com.dangbei.health.fitness D/SurfaceUtils: set up nativeWindow 0xeee1a008 for 1920x1088, color 0x11, rotation 0, usage 0x5002900
12-02 10:45:49.790 8282-8664/com.dangbei.health.fitness W/ACodec: [OMX.amlogic.avc.decoder.awesome] setting nBufferCountActual to 9 failed: -1010
12-02 10:45:49.790 8282-8664/com.dangbei.health.fitness W/ACodec: [OMX.amlogic.avc.decoder.awesome] setting nBufferCountActual to 8 failed: -1010
12-02 10:45:49.790 8282-8664/com.dangbei.health.fitness W/ACodec: [OMX.amlogic.avc.decoder.awesome] setting nBufferCountActual to 7 failed: -1010
12-02 10:45:49.798 8282-8358/com.dangbei.health.fitness W/MediaPlayer: info/warning (701, 0)
12-02 10:45:49.811 8282-8402/com.dangbei.health.fitness W/MediaPlayer: info/warning (702, 100)
12-02 10:45:49.811 8282-8282/com.dangbei.health.fitness I/ExoPlayer: ready
12-02 10:45:49.812 8282-8663/com.dangbei.health.fitness I/MediaCodec: [OMX.amlogic.avc.decoder.awesome] setting surface generation to 8480773
12-02 10:45:49.813 8282-8664/com.dangbei.health.fitness D/SurfaceUtils: set up nativeWindow 0xf0f1bc08 for 1920x1088, color 0x11, rotation 0, usage 0x2002900
12-02 10:45:49.814 8282-8664/com.dangbei.health.fitness W/ACodec: cannot change usage from 0x5002900 to 0x2002900
12-02 10:45:49.814 8282-8660/com.dangbei.health.fitness E/ExoPlayerImplInternal: Internal runtime error.
                                                                                 java.lang.IllegalArgumentException
                                                                                     at android.media.MediaCodec.native_setSurface(Native Method)
                                                                                     at android.media.MediaCodec.setOutputSurface(MediaCodec.java:1797)
                                                                                     at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.setOutputSurfaceV23(MediaCodecVideoRenderer.java:841)
                                                                                     at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.setSurface(MediaCodecVideoRenderer.java:369)
                                                                                     at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.handleMessage(MediaCodecVideoRenderer.java:336)
                                                                                     at com.google.android.exoplayer2.ExoPlayerImplInternal.sendMessagesInternal(ExoPlayerImplInternal.java:839)
                                                                                     at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:342)
                                                                                     at android.os.Handler.dispatchMessage(Handler.java:98)
                                                                                     at android.os.Looper.loop(Looper.java:148)
                                                                                     at android.os.HandlerThread.run(HandlerThread.java:61)
12-02 10:45:49.869 8282-8282/com.dangbei.health.fitness I/ExoPlayer: idle
12-02 10:45:50.800 8282-8358/com.dangbei.health.fitness W/MediaPlayer: info/warning (901, 0)
12-02 10:45:51.618 8282-8402/com.dangbei.health.fitness W/MediaPlayer: info/warning (701, 0)
12-02 10:45:51.634 8282-8294/com.dangbei.health.fitness W/MediaPlayer: info/warning (702, 100)
12-02 10:45:52.626 8282-8527/com.dangbei.health.fitness W/MediaPlayer: info/warning (901, 0)
12-02 10:45:57.612 8282-8358/com.dangbei.health.fitness W/MediaPlayer: info/warning (701, 0)
12-02 10:45:57.625 8282-8527/com.dangbei.health.fitness W/MediaPlayer: info/warning (702, 100)
12-02 10:46:00.112 8282-8358/com.dangbei.health.fitness W/MediaPlayer: info/warning (701, 0)
12-02 10:46:00.120 8282-8527/com.dangbei.health.fitness W/MediaPlayer: info/warning (702, 100)
12-02 10:46:00.134 8282-8293/com.dangbei.health.fitness W/MediaPlayer: info/warning (901, 0)
12-02 10:46:05.086 8282-8282/com.dangbei.health.fitness E/MediaPlayer: stop called in state 1
12-02 10:46:05.086 8282-8282/com.dangbei.health.fitness E/MediaPlayer: error (-38, 0)
12-02 10:46:05.098 8282-8527/com.dangbei.health.fitness W/MediaPlayer: info/warning (701, 0)
@botaydotcom
Copy link
Contributor

HI @hysbtr ,
Can you reproduce this issue using ExoPlayer's demo app or just your own app? If you have access to a physical Xiaomi MiTV3S Android 6.0.1 device, please try to reproduce the issue using ExoPlayer's demo app and capture the full bug report as required by our template (i.e. the output of adb bugreport captured whilst reproducing the problem). Only in that case can we investigate and make progress. Thank you very much.

@bakua
Copy link

bakua commented Dec 16, 2017

Hello,

we've found the same crash in our logs.

Non-fatal Exception: com.google.android.exoplayer2.ExoPlaybackException
       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:404)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:203)
       at android.os.HandlerThread.run(HandlerThread.java:61)
Caused by java.lang.IllegalArgumentException
       at android.media.MediaCodec.native_setSurface(MediaCodec.java)
       at android.media.MediaCodec.setOutputSurface(MediaCodec.java:1914)
       at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.setOutputSurfaceV23(MediaCodecVideoRenderer.java:743)
       at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.setSurface(MediaCodecVideoRenderer.java:360)
       at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.handleMessage(MediaCodecVideoRenderer.java:327)
       at com.google.android.exoplayer2.ExoPlayerImplInternal.sendMessagesInternal(ExoPlayerImplInternal.java:854)
       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:386)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:203)
       at android.os.HandlerThread.run(HandlerThread.java:61)

At the moment we are not able to replicate the failure ourselves, but it happens regularly to our users on many different devices. Android 6 and 7 only.

@andrewlewis
Copy link
Collaborator

W/ACodec: cannot change usage from 0x5002900 to 0x2002900 looks suspicious. Could you give a bit more detail about what the surface is changing from/to?

@bakua
Copy link

bakua commented Jan 29, 2018

Sorry for the delay, I was onto something else.

In our app, we have a single SurfaceView instance for whole activity life. We create and keep SimpleExoPlayer instance in onStart() and release it in onStop(). In next onStart() we create new SimpleExoPlayer and connect it to already existing surface.

We have wrapped surface into custom layout as seen below (pls ignore unnecessary layout nesting)

class PlayerSurfaceView : FrameLayout {
    constructor(context: Context?) : super(context)
    constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
    constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)

    private val contentFrame: AspectRatioFrameLayout
    private val surfaceView: SurfaceView
    private val subscriptions = CompositeSubscription()

    init {
        descendantFocusability = ViewGroup.FOCUS_AFTER_DESCENDANTS
        keepScreenOn = true

        contentFrame = AspectRatioFrameLayout(context)
        contentFrame.layoutParams = FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT
        ).apply {
            gravity = Gravity.CENTER
        }
        contentFrame.resizeMode = AspectRatioFrameLayout.RESIZE_MODE_FIT

        surfaceView = SurfaceView(context)
        surfaceView.layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
        contentFrame.addView(surfaceView)
        addView(contentFrame)
    }

    var player: Player? = null
        set(value) {
            if (field === value) return
            field?.clearVideoSurfaceView(surfaceView)
            field = value
            subscriptions.clear()
            value?.let {
                it.onVideoSizeChange.subscribe {
                    contentFrame.setAspectRatio(
                        if (it.height == 0) 1f
                        else it.width * it.pixelWidthHeightRatio / it.height
                    )
                }.addTo(subscriptions)

                it.setVideoSurfaceView(surfaceView)
            }
        }
}

I'm still not able to pinpoint an origin of this issue. It happens in HLS AES encrypted live stream.

It looks like to me that it happens at MediaCodec.cpp#1047 because codec->setSurface() returns err BAD_VALUE. But that is a vild guess.

@chaichuanfa
Copy link

I met the same issue. Is there any solution?

@Nikonov
Copy link

Nikonov commented Feb 1, 2018

Tested on v2.6.1. Issue reproduced. Workaround?

@andrewlewis andrewlewis assigned ojw28 and unassigned andrewlewis Feb 1, 2018
@green-nick
Copy link

Hi guys.
We have same issue. Reproduced on different devices, but randomly. Can't found steps to reproduce.
Use TextureView, player init and release called in onResume/onPause.
lib version: 2.7.0

@idyuzheva
Copy link

idyuzheva commented Mar 21, 2018

Hey guys,
the same for me, please look at logs, may be i'll help to find out what is going on

getSlotFromBufferLocked: unknown buffer: 0x7f8ae21ae0
 mGraphicBuffer is NULL in BufferInfo (0x7f783a7e18); skip this round.
 mGraphicBuffer is NULL in BufferInfo (0x7f783a7e50); skip this round.
 getSlotFromBufferLocked: unknown buffer: 0x7f8ae21cc0
 getSlotFromBufferLocked: unknown buffer: 0x7f760751c0
 new surface holds onto more buffers (2) than planned for (1)
Internal runtime error.
java.lang.IllegalArgumentException
	at android.media.MediaCodec.native_setSurface(Native Method)
	at android.media.MediaCodec.setOutputSurface(MediaCodec.java:1810)
	at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.setOutputSurfaceV23(MediaCodecVideoRenderer.java:841)
	at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.setSurface(MediaCodecVideoRenderer.java:369)
	at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.handleMessage(MediaCodecVideoRenderer.java:336)
	at com.google.android.exoplayer2.ExoPlayerImplInternal.sendMessagesInternal(ExoPlayerImplInternal.java:839)
	at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:342)
	at android.os.Handler.dispatchMessage(Handler.java:107)
	at android.os.Looper.loop(Looper.java:207)
	at android.os.HandlerThread.run(HandlerThread.java:61)
02-12 14:01:37.799  9519  9551 E Surface : getSlotFromBufferLocked: unknown buffer: 0x7f77c19ac0
 ExoPlayer error occurred: 
 com.google.android.exoplayer2.ExoPlaybackException
 	at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:360)
 	at android.os.Handler.dispatchMessage(Handler.java:107)
 	at android.os.Looper.loop(Looper.java:207)
 	at android.os.HandlerThread.run(HandlerThread.java:61)
 Caused by: java.lang.IllegalArgumentException
 	at android.media.MediaCodec.native_setSurface(Native Method)
 	at android.media.MediaCodec.setOutputSurface(MediaCodec.java:1810)
 	at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.setOutputSurfaceV23(MediaCodecVideoRenderer.java:841)
 	at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.setSurface(MediaCodecVideoRenderer.java:369)
 	at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.handleMessage(MediaCodecVideoRenderer.java:336)
 	at com.google.android.exoplayer2.ExoPlayerImplInternal.sendMessagesInternal(ExoPlayerImplInternal.java:839)
 	at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:342)
 	... 3 more
 playerFailed [1.23]
 com.google.android.exoplayer2.ExoPlaybackException
 	at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:360)
 	at android.os.Handler.dispatchMessage(Handler.java:107)
 	at android.os.Looper.loop(Looper.java:207)
 	at android.os.HandlerThread.run(HandlerThread.java:61)
 Caused by: java.lang.IllegalArgumentException
 	at android.media.MediaCodec.native_setSurface(Native Method)
 	at android.media.MediaCodec.setOutputSurface(MediaCodec.java:1810)
 	at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.setOutputSurfaceV23(MediaCodecVideoRenderer.java:841)
 	at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.setSurface(MediaCodecVideoRenderer.java:369)
 	at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.handleMessage(MediaCodecVideoRenderer.java:336)
 	at com.google.android.exoplayer2.ExoPlayerImplInternal.sendMessagesInternal(ExoPlayerImplInternal.java:839)
 	at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:342)
 	... 3 more
 getSlotFromBufferLocked: unknown buffer: 0x7f76076200
 new surface holds onto more buffers (2) than planned for (1)

@MrDizzle
Copy link

I get this error on Android when switching videos after transferring the ExoPlayer from one parent view to another. Worryingly this breaks all instances of Exoplayer in my app and makes them display black screen, even though they are complete discreet instances with no connecting logic..

 Caused by: com.google.android.exoplayer2.mediacodec.MediaCodecRenderer$DecoderInitializationException: Decoder init failed: OMX.qcom.video.decoder.avc, Format(1, null, video/avc, -1, null, [480, 480, -1.0], [-1, -1])
    at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodec(MediaCodecRenderer.java:428) 
    at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onInputFormatChanged(MediaCodecRenderer.java:920) 
    at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.onInputFormatChanged(MediaCodecVideoRenderer.java:503) 
    at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:557) 
    at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:518) 
    at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:301) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:193) 
    at android.os.HandlerThread.run(HandlerThread.java:65) 
 Caused by: android.media.MediaCodec$CodecException: Failed to initialize OMX.qcom.video.decoder.avc, error 0xfffffff4

@antonkrasov
Copy link

Hey guys, same issue here, device - HUAWEI Mate 20 Pro

Exception: java.lang.IllegalArgumentException
       at android.media.MediaCodec.native_setSurface(MediaCodec.java)
       at android.media.MediaCodec.setOutputSurface(MediaCodec.java:1986)
       at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.supportsFormat(Unknown Source:64)
       at com.google.android.exoplayer2.ExoPlayerImplInternal.maybeNotifyPlaybackInfoChanged(Unknown Source:14)
       at com.google.android.exoplayer2.ExoPlayerImplInternal.onTrackSelectionsInvalidated(Unknown Source:14)
       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(Unknown Source:122)
       at android.os.Handler.dispatchMessage(Handler.java:105)
       at android.os.Looper.loop(Looper.java:207)
       at android.os.HandlerThread.run(HandlerThread.java:65)```

@vinodkputta
Copy link

Hello,
We are also facing this issue. Mostly on Android OS 6 and 7.
Model : Micromax Q4261, K9 Kavach 4G
Non-fatal Exception: java.lang.IllegalArgumentException at android.media.MediaCodec.native_setSurface(MediaCodec.java) at android.media.MediaCodec.setOutputSurface(MediaCodec.java:1810) at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.setOutputSurfaceV23(Unknown Source:1014) at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.setSurface(Unknown Source:422) at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.handleMessage(Unknown Source:387) at com.google.android.exoplayer2.ExoPlayerImplInternal.deliverMessage(Unknown Source:871) at com.google.android.exoplayer2.ExoPlayerImplInternal.sendMessageToTarget(Unknown Source:842) at com.google.android.exoplayer2.ExoPlayerImplInternal.sendMessageInternal(Unknown Source:824) at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(Unknown Source:333) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:207) at android.os.HandlerThread.run(HandlerThread.java:61)

@ojw28 Can you please look into this issue?

@dmitrybilko
Copy link

dmitrybilko commented Feb 8, 2019

Got the error just minimizing an app while playing a 1080p video, isn't reproduced for the 720p videos.

Version: 2.9.0
Model: MIBOX3 (TV)
OS: 8.0.0
View: PlayerView

     Caused by: java.lang.IllegalArgumentException
        at android.media.MediaCodec.native_setSurface(Native Method)
        at android.media.MediaCodec.setOutputSurface(MediaCodec.java:1954)
        at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.setOutputSurfaceV23(MediaCodecVideoRenderer.java:1014)
        at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.setSurface(MediaCodecVideoRenderer.java:422)
        at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.handleMessage(MediaCodecVideoRenderer.java:387)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.deliverMessage(ExoPlayerImplInternal.java:871)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.sendMessageToTarget(ExoPlayerImplInternal.java:842)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.sendMessageInternal(ExoPlayerImplInternal.java:824)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:333)
        at android.os.Handler.dispatchMessage(Handler.java:101) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.os.HandlerThread.run(HandlerThread.java:65) 

@tonihei
Copy link
Collaborator

tonihei commented May 7, 2019

Closing because no full bug reports have been provided and this issue seems to be used for many similarly looking problems. Please open a new issue including all requested information so that we can take a look.

@tonihei tonihei closed this as completed May 7, 2019
@Xigong93

This comment has been minimized.

@google google locked and limited conversation to collaborators Sep 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests