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

Video codec error in exoplayer version 2.18.5 in android 10 #11158

Open
hafiz013 opened this issue May 11, 2023 · 1 comment
Open

Video codec error in exoplayer version 2.18.5 in android 10 #11158

hafiz013 opened this issue May 11, 2023 · 1 comment
Assignees
Labels

Comments

@hafiz013
Copy link

Bug

Below here details about this error :

Video codec error com.google.android.exoplayer2.mediacodec.MediaCodecRenderer$DecoderInitializationException: Decoder init failed: OMX.bcm.vdec.avc, Format(2, null, null, video/avc, avc1.64001F, -1, null, [1280, 720, 24.0], [-1, -1]) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(MediaCodecRenderer.java:1013) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodecOrBypass(MediaCodecRenderer.java:537) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onInputFormatChanged(MediaCodecRenderer.java:1445) at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.onInputFormatChanged(MediaCodecVideoRenderer.java:917) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.readSourceOmittingSampleData(MediaCodecRenderer.java:946) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:761) at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1007) at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:502) at android.os.Handler.dispatchMessage(Handler.java:103) at android.os.Looper.loop(Looper.java:214) at android.os.HandlerThread.run(HandlerThread.java:67) Caused by: android.media.MediaCodec$CodecException: Failed to initialize OMX.bcm.vdec.avc, error 0xfffffff4 at android.media.MediaCodec.native_setup(Native Method) at android.media.MediaCodec.<init>(MediaCodec.java:1865) at android.media.MediaCodec.createByCodecName(MediaCodec.java:1843) at com.google.android.exoplayer2.mediacodec.SynchronousMediaCodecAdapter$Factory.createCodec(SynchronousMediaCodecAdapter.java:74) at com.google.android.exoplayer2.mediacodec.SynchronousMediaCodecAdapter$Factory.createAdapter(SynchronousMediaCodecAdapter.java:49) at com.google.android.exoplayer2.mediacodec.DefaultMediaCodecAdapterFactory.createAdapter(DefaultMediaCodecAdapterFactory.java:113) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.initCodec(MediaCodecRenderer.java:1091) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(MediaCodecRenderer.java:1002) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodecOrBypass(MediaCodecRenderer.java:537)  at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onInputFormatChanged(MediaCodecRenderer.java:1445)  at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.onInputFormatChanged(MediaCodecVideoRenderer.java:917)  at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.readSourceOmittingSampleData(MediaCodecRenderer.java:946)  at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:761)  at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1007)  at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:502)  at android.os.Handler.dispatchMessage(Handler.java:103)  at android.os.Looper.loop(Looper.java:214)  at android.os.HandlerThread.run(HandlerThread.java:67) 

below here sample that I use MediaCodecVideoRenderer to get type of render media code:

`
override fun buildVideoRenderers(
context: Context,
extensionRendererMode: Int, // @ExtensionRendererMode extensionRendererMode: Int,
mediaCodecSelector: MediaCodecSelector,
enableDecoderFallback: Boolean,
eventHandler: Handler,
eventListener: VideoRendererEventListener,
allowedVideoJoiningTimeMs: Long,
out: ArrayList
) {

    out.add(
        XaafMediaCodecVideoRenderer(
            context,
            MediaCodecSelector.DEFAULT,
            allowedVideoJoiningTimeMs,
            enableDecoderFallback,
            eventHandler,
            eventListener,
            MAX_DROPPED_VIDEO_FRAME_COUNT_TO_NOTIFY,
            playerDecoderUsedListener
        )
    )


    if (extensionRendererMode == EXTENSION_RENDERER_MODE_OFF) {
        return
    }

    var extensionRendererIndex = out.size
    if (extensionRendererMode == EXTENSION_RENDERER_MODE_PREFER) {
        extensionRendererIndex--
    }

    try {
        // Full class names used for constructor args so the LINT rule triggers if any of them move.
        // LINT.IfChange
        val clazz = Class.forName("com.google.android.exoplayer2.ext.vp9.LibvpxVideoRenderer")
        val constructor = clazz.getConstructor(
            Boolean::class.javaPrimitiveType,
            Long::class.javaPrimitiveType,
            android.os.Handler::class.java,
            com.google.android.exoplayer2.video.VideoRendererEventListener::class.java,
            Int::class.javaPrimitiveType
        )
        // LINT.ThenChange(../../../../../../../proguard-rules.txt)
        val renderer = constructor.newInstance(
            true,
            allowedVideoJoiningTimeMs,
            eventHandler,
            eventListener,
            MAX_DROPPED_VIDEO_FRAME_COUNT_TO_NOTIFY
        ) as Renderer
        out.add(extensionRendererIndex++, renderer)
        logI("Loaded LibvpxVideoRenderer")
    } catch (e: ClassNotFoundException) {
        // Expected if the app was built without the extension.
    } catch (e: Exception) {
        // The extension is present, but instantiation failed.
        throw RuntimeException("Error instantiating VP9 extension", e)
    }
}

override fun getDecoderInfos(
mediaCodecSelector: MediaCodecSelector,
format: Format,
requiresSecureDecoder: Boolean
): MutableList {
val all = super.getDecoderInfos(mediaCodecSelector, format, requiresSecureDecoder)
if (!context.packageManager.hasSystemFeature(AMAZON_FEATURE_FIRE_TV) && !requiresSecureDecoder) {
val googleDecoder = ArrayList()
for (info in all) {
if (info.name.contains("google") || info.name.contains("android")) {
googleDecoder.add(info)
}
}
val decoderListToUse = googleDecoder.takeIf { it.isNotEmpty() } ?: all
reportDecoderUsed(decoderListToUse)

        return decoderListToUse
    }
    reportDecoderUsed(all)
    return all
}`
@microkatz
Copy link
Contributor

@hafiz013. Not sure what you are trying to do with just your code snippet but it seems that the decoder selected does not support the format of the media you are trying to play.

It would be helpful if you could provide a bug report with logs. Could you please provide complete information as requested in the issue template. The issue template can be found here. If you're unable to share bug reports or test content publicly, please send them to [email protected] using a subject in the format "Issue #11158". Please also update this issue to indicate you've done this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants