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

Add a way to enable decoder fallback in CompositionPlayer #2028

Open
najam-amfnrh9 opened this issue Jan 8, 2025 · 6 comments
Open

Add a way to enable decoder fallback in CompositionPlayer #2028

najam-amfnrh9 opened this issue Jan 8, 2025 · 6 comments
Assignees
Labels
enhancement preview CompositionPlayer issues question

Comments

@najam-amfnrh9
Copy link

I'm working on CompositionPlayer could you provide me something regarding to Fallback rendererFactory,
because before implementing this I use Playlist or Mergers, there's multiple formats to be played, and this fallback == true, help me to get rid of many exceptions.

Currently CompositionPlayer Builder allowing GraphRenderFactory, I couldn't find someway to add fallback renderer factory to be added through Builder, and getting certain exceptions over input files some times are playing and some times throwing exception.

Could you provide me solution to add this to CompositionPlayer.

 ExoPlayer.Builder(context).setTrackSelector(DefaultTrackSelector(context)).setRenderersFactory(
                DefaultRenderersFactory(context).setEnableDecoderFallback(true)
            ).build()

Exception needs to be resolved:
Exception:1.

 
androidx.media3.common.PlaybackException: Error processing video frames at androidx.media3.transformer.CompositionPlayer.maybeUpdatePlaybackError(CompositionPlayer.java:915) at androidx.media3.transformer.CompositionPlayer.lambda$onError$1$androidx-media3-transformer-CompositionPlayer(CompositionPlayer.java:400)    at androidx.media3.transformer.CompositionPlayer$$ExternalSyntheticLambda0.run(Unknown Source:4)
   at android.os.Handler.handleCallback(Handler.java:958)
   at android.os.Handler.dispatchMessage(Handler.java:99)`

Exception:2.
[exoplayer2.ParserException: Invalid NAL length when playing .MP4 file](https://github.com/google/ExoPlayer/issues/8268#top)

@kim-vde
Copy link
Contributor

kim-vde commented Jan 9, 2025

If I understand correctly, you would like to have a method CompositionPlayer.Builder.setRenderersFactory(RenderersFactory), like in ExoPlayer. Is that correct?

Could you clarify what would your custom renderers be like? Would you only customize the video renderer? Would you wrap an ExoPlayer renderer?

@muhammad-najam-cmp
Copy link

Yes, I required
setRenderersFactory( DefaultRenderersFactory(context).setEnableDecoderFallback(true) )

for CompositionPlayer, I'm getting following exception when playing composition, Error processing video frames.
this error currently observed on .MOV file.

Furtherly, If i choose .MOV file after some .mp4 file then this excption couldn't triggered. If I choose this file at very first it throws above exception.

@kim-vde
Copy link
Contributor

kim-vde commented Jan 9, 2025

The error seems to occur when applying effects (not when decoding the frame), so using setEnableDecoderFallback() probably wouldn't help. Could you set DebugTraceUtil.enableTracing to true and provide a bug report?

Could you also provide the .mov file that is failing?

If you're unable to share bug reports
or test content publicly, please send them to [email protected] with the subject
Issue #1234. Please also update this issue to indicate you've done this.

Thanks

@muhammad-najam-cmp
Copy link

Here is the complete report, when Exception Generated:

10:34:37.788 ACodec                   E  [OMX.qcom.video.decoder.hevc] Now Loaded
10:34:37.800 MediaCodecRenderer       W  Failed to initialize decoder: OMX.qcom.video.decoder.hevc
                                           android.media.MediaCodec$CodecException: Error 0xfffffff4
                                               at android.media.MediaCodec.native_configure(Native Method)
                                               at android.media.MediaCodec.configure(MediaCodec.java:2023)
                                               at android.media.MediaCodec.configure(MediaCodec.java:1951)
                                               at androidx.media3.exoplayer.mediacodec.SynchronousMediaCodecAdapter$Factory.createAdapter(SynchronousMediaCodecAdapter.java:60)
                                               at androidx.media3.exoplayer.mediacodec.DefaultMediaCodecAdapterFactory.createAdapter(DefaultMediaCodecAdapterFactory.java:139)
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.initCodec(MediaCodecRenderer.java:1227)
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(MediaCodecRenderer.java:1139)
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecOrBypass(MediaCodecRenderer.java:587)
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.reinitializeCodec(MediaCodecRenderer.java:2320)
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.processEndOfStream(MediaCodecRenderer.java:2186)
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.drainOutputBuffer(MediaCodecRenderer.java:2021)
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:875)
                                               at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.render(MediaCodecVideoRenderer.java:1094)
                                               at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1138)
                                               at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:562)
                                               at android.os.Handler.dispatchMessage(Handler.java:103)
                                               at android.os.Looper.loop(Looper.java:214)
                                               at android.os.HandlerThread.run(HandlerThread.java:67)
10:34:37.803 MediaCodecVideoRenderer  E  Video codec error
                                           androidx.media3.exoplayer.mediacodec.MediaCodecRenderer$DecoderInitializationException: Decoder init failed: OMX.qcom.video.decoder.hevc, Format(1, null, null, video/hevc, hvc1.1.6.L153.B0, -1, null, [3840, 2160, 28.070644, ColorInfo(BT601, Limited range, SDR SMPTE 170M, false, 8bit Luma, 8bit Chroma)], [-1, -1])
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(MediaCodecRenderer.java:1146)
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecOrBypass(MediaCodecRenderer.java:587)
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.reinitializeCodec(MediaCodecRenderer.java:2320)
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.processEndOfStream(MediaCodecRenderer.java:2186)
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.drainOutputBuffer(MediaCodecRenderer.java:2021)
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:875)
                                               at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.render(MediaCodecVideoRenderer.java:1094)
                                               at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1138)
                                               at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:562)
                                               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: Error 0xfffffff4
                                               at android.media.MediaCodec.native_configure(Native Method)
                                               at android.media.MediaCodec.configure(MediaCodec.java:2023)
                                               at android.media.MediaCodec.configure(MediaCodec.java:1951)
                                               at androidx.media3.exoplayer.mediacodec.SynchronousMediaCodecAdapter$Factory.createAdapter(SynchronousMediaCodecAdapter.java:60)
                                               at androidx.media3.exoplayer.mediacodec.DefaultMediaCodecAdapterFactory.createAdapter(DefaultMediaCodecAdapterFactory.java:139)
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.initCodec(MediaCodecRenderer.java:1227)
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(MediaCodecRenderer.java:1139)
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecOrBypass(MediaCodecRenderer.java:587) 
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.reinitializeCodec(MediaCodecRenderer.java:2320) 
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.processEndOfStream(MediaCodecRenderer.java:2186) 
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.drainOutputBuffer(MediaCodecRenderer.java:2021) 
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:875) 
                                               at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.render(MediaCodecVideoRenderer.java:1094) 
                                               at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1138) 
                                               at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:562) 
                                               at android.os.Handler.dispatchMessage(Handler.java:103) 
                                               at android.os.Looper.loop(Looper.java:214) 
                                               at android.os.HandlerThread.run(HandlerThread.java:67) 
10:34:37.805 ExoPlayerImplInternal    E  Playback error
                                           androidx.media3.exoplayer.ExoPlaybackException: MediaCodecVideoRenderer error, index=1, format=Format(1, null, null, video/hevc, hvc1.1.6.L153.B0, -1, null, [3840, 2160, 28.070644, ColorInfo(BT601, Limited range, SDR SMPTE 170M, false, 8bit Luma, 8bit Chroma)], [-1, -1]), format_supported=YES
                                               at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:641)
                                               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: androidx.media3.exoplayer.mediacodec.MediaCodecRenderer$DecoderInitializationException: Decoder init failed: OMX.qcom.video.decoder.hevc, Format(1, null, null, video/hevc, hvc1.1.6.L153.B0, -1, null, [3840, 2160, 28.070644, ColorInfo(BT601, Limited range, SDR SMPTE 170M, false, 8bit Luma, 8bit Chroma)], [-1, -1])
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(MediaCodecRenderer.java:1146)
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecOrBypass(MediaCodecRenderer.java:587)
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.reinitializeCodec(MediaCodecRenderer.java:2320)
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.processEndOfStream(MediaCodecRenderer.java:2186)
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.drainOutputBuffer(MediaCodecRenderer.java:2021)
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:875)
                                               at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.render(MediaCodecVideoRenderer.java:1094)
                                               at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1138)
                                               at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:562)
                                               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: Error 0xfffffff4
                                               at android.media.MediaCodec.native_configure(Native Method)
                                               at android.media.MediaCodec.configure(MediaCodec.java:2023)
                                               at android.media.MediaCodec.configure(MediaCodec.java:1951)
                                               at androidx.media3.exoplayer.mediacodec.SynchronousMediaCodecAdapter$Factory.createAdapter(SynchronousMediaCodecAdapter.java:60)
                                               at androidx.media3.exoplayer.mediacodec.DefaultMediaCodecAdapterFactory.createAdapter(DefaultMediaCodecAdapterFactory.java:139)
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.initCodec(MediaCodecRenderer.java:1227)
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(MediaCodecRenderer.java:1139)
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecOrBypass(MediaCodecRenderer.java:587) 
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.reinitializeCodec(MediaCodecRenderer.java:2320) 
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.processEndOfStream(MediaCodecRenderer.java:2186) 
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.drainOutputBuffer(MediaCodecRenderer.java:2021) 
                                               at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:875) 
                                               at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.render(MediaCodecVideoRenderer.java:1094) 
                                               at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1138) 
                                               at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:562) 
                                               at android.os.Handler.dispatchMessage(Handler.java:103) 
                                               at android.os.Looper.loop(Looper.java:214) 
                                               at android.os.HandlerThread.run(HandlerThread.java:67) 
10:34:37.807 EventLogger              D  rendererReady [eventTime=10.39, mediaPos=8.99, window=0, period=4, rendererIndex=0, audio, false]
10:34:37.808 EventLogger              D  audioDisabled [eventTime=10.39, mediaPos=8.99, window=0, period=4]
10:34:37.808 EventLogger              D  rendererReady [eventTime=10.39, mediaPos=8.99, window=0, period=4, rendererIndex=1, video, false]
10:34:37.808 EventLogger              D  videoDisabled [eventTime=10.39, mediaPos=8.99, window=0, period=4]
10:34:37.809 EventLogger              D  videoSize [eventTime=10.39, mediaPos=8.99, window=0, period=4, 0, 0]
10:34:37.815 EventLogger              D  timeline [eventTime=10.40, mediaPos=9.30, window=0, period=4, periodCount=7, windowCount=1, reason=SOURCE_UPDATE
10:34:37.815 EventLogger              D    period [3.20]
10:34:37.815 EventLogger              D    period [2.30]
10:34:37.815 EventLogger              D    period [1.80]
10:34:37.815 EventLogger              D    ...
10:34:37.815 EventLogger              D    window [14.20, seekable=true, dynamic=false]
10:34:37.815 EventLogger              D  ]
10:34:37.816 EventLogger              D  positionDiscontinuity [eventTime=10.40, mediaPos=9.30, window=0, period=4, reason=AUTO_TRANSITION, PositionInfo:old [mediaItem=0, period=3, pos=9300], PositionInfo:new [mediaItem=0, period=4, pos=9300]]

@kim-vde kim-vde changed the title Composition Player, PlaybackException: Error processing video frames Add a way to enable decoder fallback in CompositionPlayer Jan 15, 2025
@kim-vde
Copy link
Contributor

kim-vde commented Jan 16, 2025

Hi,

I have marked this issue as an enhancement but we unfortunately don't have the capacity to add this feature at the moment.

@najam-amfnrh9
Copy link
Author

najam-amfnrh9 commented Jan 16, 2025 via email

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

No branches or pull requests

4 participants