google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.74k stars 6.03k forks source link

InsufficientCapacityException: Buffer too small (4177920 < 4845595) #11116

Closed sundaylol closed 1 year ago

sundaylol commented 1 year ago

When I try to play a 4K video with the following format on the rk3566 platform, I get a "buffer too small" error log which sometimes prevents playback. However, after seeing an "ACodec onOutputFormatChanged" log, the video can play normally. How can I solve this issue?

image

2023-03-16 04:32:40.134 30475-31261 MediaCodecVideoRenderer com.okra.video E Video codec error com.google.android.exoplayer2.decoder.DecoderInputBuffer$InsufficientCapacityException: Buffer too small (4177920 < 5601850) at com.google.android.exoplayer2.decoder.DecoderInputBuffer.createReplacementByteBuffer(DecoderInputBuffer.java:241) at com.google.android.exoplayer2.decoder.DecoderInputBuffer.ensureSpaceForWrite(DecoderInputBuffer.java:192) at com.google.android.exoplayer2.source.SampleDataQueue.readSampleData(SampleDataQueue.java:292) at com.google.android.exoplayer2.source.SampleDataQueue.readToBuffer(SampleDataQueue.java:130) at com.google.android.exoplayer2.source.SampleQueue.read(SampleQueue.java:435) at com.google.android.exoplayer2.source.ProgressiveMediaPeriod.readData(ProgressiveMediaPeriod.java:487) at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$SampleStreamImpl.readData(ProgressiveMediaPeriod.java:945) at com.google.android.exoplayer2.BaseRenderer.readSource(BaseRenderer.java:425) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:1227) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:776) 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:102) at android.os.Looper.loop(Looper.java:223) at android.os.HandlerThread.run(HandlerThread.java:67) 2023-03-16 04:32:40.265 30475-31261 MediaCodecVideoRenderer com.okra.video E Video codec error com.google.android.exoplayer2.decoder.DecoderInputBuffer$InsufficientCapacityException: Buffer too small (4177920 < 5164653) at com.google.android.exoplayer2.decoder.DecoderInputBuffer.createReplacementByteBuffer(DecoderInputBuffer.java:241) at com.google.android.exoplayer2.decoder.DecoderInputBuffer.ensureSpaceForWrite(DecoderInputBuffer.java:192) at com.google.android.exoplayer2.source.SampleDataQueue.readSampleData(SampleDataQueue.java:292) at com.google.android.exoplayer2.source.SampleDataQueue.readToBuffer(SampleDataQueue.java:130) at com.google.android.exoplayer2.source.SampleQueue.read(SampleQueue.java:435) at com.google.android.exoplayer2.source.ProgressiveMediaPeriod.readData(ProgressiveMediaPeriod.java:487) at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$SampleStreamImpl.readData(ProgressiveMediaPeriod.java:945) at com.google.android.exoplayer2.BaseRenderer.readSource(BaseRenderer.java:425) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:1227) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:776) 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:102) at android.os.Looper.loop(Looper.java:223) at android.os.HandlerThread.run(HandlerThread.java:67) 2023-03-16 04:32:40.431 30475-31261 MediaCodecVideoRenderer com.okra.video E Video codec error com.google.android.exoplayer2.decoder.DecoderInputBuffer$InsufficientCapacityException: Buffer too small (4177920 < 5296570) at com.google.android.exoplayer2.decoder.DecoderInputBuffer.createReplacementByteBuffer(DecoderInputBuffer.java:241) at com.google.android.exoplayer2.decoder.DecoderInputBuffer.ensureSpaceForWrite(DecoderInputBuffer.java:192) at com.google.android.exoplayer2.source.SampleDataQueue.readSampleData(SampleDataQueue.java:292) at com.google.android.exoplayer2.source.SampleDataQueue.readToBuffer(SampleDataQueue.java:130) at com.google.android.exoplayer2.source.SampleQueue.read(SampleQueue.java:435) at com.google.android.exoplayer2.source.ProgressiveMediaPeriod.readData(ProgressiveMediaPeriod.java:487) at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$SampleStreamImpl.readData(ProgressiveMediaPeriod.java:945) at com.google.android.exoplayer2.BaseRenderer.readSource(BaseRenderer.java:425) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:1227) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:776) 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:102) at android.os.Looper.loop(Looper.java:223) at android.os.HandlerThread.run(HandlerThread.java:67) 2023-03-16 04:32:40.450 30475-30494 com.okra.video com.okra.video I Background concurrent copying GC freed 40304(2535KB) AllocSpace objects, 16(1152KB) LOS objects, 43% free, 31MB/55MB, paused 139us total 139.309ms 2023-03-16 04:32:40.586 30475-31261 MediaCodecVideoRenderer com.okra.video E Video codec error com.google.android.exoplayer2.decoder.DecoderInputBuffer$InsufficientCapacityException: Buffer too small (4177920 < 5203666) at com.google.android.exoplayer2.decoder.DecoderInputBuffer.createReplacementByteBuffer(DecoderInputBuffer.java:241) at com.google.android.exoplayer2.decoder.DecoderInputBuffer.ensureSpaceForWrite(DecoderInputBuffer.java:192) at com.google.android.exoplayer2.source.SampleDataQueue.readSampleData(SampleDataQueue.java:292) at com.google.android.exoplayer2.source.SampleDataQueue.readToBuffer(SampleDataQueue.java:130) at com.google.android.exoplayer2.source.SampleQueue.read(SampleQueue.java:435) at com.google.android.exoplayer2.source.ProgressiveMediaPeriod.readData(ProgressiveMediaPeriod.java:487) at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$SampleStreamImpl.readData(ProgressiveMediaPeriod.java:945) at com.google.android.exoplayer2.BaseRenderer.readSource(BaseRenderer.java:425) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:1227) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:776) 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:102) at android.os.Looper.loop(Looper.java:223) at android.os.HandlerThread.run(HandlerThread.java:67) 2023-03-16 04:32:40.840 30475-31261 MediaCodecVideoRenderer com.okra.video E Video codec error com.google.android.exoplayer2.decoder.DecoderInputBuffer$InsufficientCapacityException: Buffer too small (4177920 < 5223140) at com.google.android.exoplayer2.decoder.DecoderInputBuffer.createReplacementByteBuffer(DecoderInputBuffer.java:241) at com.google.android.exoplayer2.decoder.DecoderInputBuffer.ensureSpaceForWrite(DecoderInputBuffer.java:192) at com.google.android.exoplayer2.source.SampleDataQueue.readSampleData(SampleDataQueue.java:292) at com.google.android.exoplayer2.source.SampleDataQueue.readToBuffer(SampleDataQueue.java:130) at com.google.android.exoplayer2.source.SampleQueue.read(SampleQueue.java:435) at com.google.android.exoplayer2.source.ProgressiveMediaPeriod.readData(ProgressiveMediaPeriod.java:487) at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$SampleStreamImpl.readData(ProgressiveMediaPeriod.java:945) at com.google.android.exoplayer2.BaseRenderer.readSource(BaseRenderer.java:425) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:1227) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:776) 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:102) at android.os.Looper.loop(Looper.java:223) at android.os.HandlerThread.run(HandlerThread.java:67) 2023-03-16 04:32:40.983 30475-31261 MediaCodecVideoRenderer com.okra.video E Video codec error com.google.android.exoplayer2.decoder.DecoderInputBuffer$InsufficientCapacityException: Buffer too small (4177920 < 5310493) at com.google.android.exoplayer2.decoder.DecoderInputBuffer.createReplacementByteBuffer(DecoderInputBuffer.java:241) at com.google.android.exoplayer2.decoder.DecoderInputBuffer.ensureSpaceForWrite(DecoderInputBuffer.java:192) at com.google.android.exoplayer2.source.SampleDataQueue.readSampleData(SampleDataQueue.java:292) at com.google.android.exoplayer2.source.SampleDataQueue.readToBuffer(SampleDataQueue.java:130) at com.google.android.exoplayer2.source.SampleQueue.read(SampleQueue.java:435) at com.google.android.exoplayer2.source.ProgressiveMediaPeriod.readData(ProgressiveMediaPeriod.java:487) at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$SampleStreamImpl.readData(ProgressiveMediaPeriod.java:945) at com.google.android.exoplayer2.BaseRenderer.readSource(BaseRenderer.java:425) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:1227) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:776) 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:102) at android.os.Looper.loop(Looper.java:223) at android.os.HandlerThread.run(HandlerThread.java:67) 2023-03-16 04:32:41.135 30475-31261 MediaCodecVideoRenderer com.okra.video E Video codec error com.google.android.exoplayer2.decoder.DecoderInputBuffer$InsufficientCapacityException: Buffer too small (4177920 < 5138638) at com.google.android.exoplayer2.decoder.DecoderInputBuffer.createReplacementByteBuffer(DecoderInputBuffer.java:241) at com.google.android.exoplayer2.decoder.DecoderInputBuffer.ensureSpaceForWrite(DecoderInputBuffer.java:192) at com.google.android.exoplayer2.source.SampleDataQueue.readSampleData(SampleDataQueue.java:292) at com.google.android.exoplayer2.source.SampleDataQueue.readToBuffer(SampleDataQueue.java:130) at com.google.android.exoplayer2.source.SampleQueue.read(SampleQueue.java:435) at com.google.android.exoplayer2.source.ProgressiveMediaPeriod.readData(ProgressiveMediaPeriod.java:487) at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$SampleStreamImpl.readData(ProgressiveMediaPeriod.java:945) at com.google.android.exoplayer2.BaseRenderer.readSource(BaseRenderer.java:425) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:1227) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:776) 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:102) at android.os.Looper.loop(Looper.java:223) at android.os.HandlerThread.run(HandlerThread.java:67) 2023-03-16 04:32:41.282 30475-31261 MediaCodecVideoRenderer com.okra.video E Video codec error com.google.android.exoplayer2.decoder.DecoderInputBuffer$InsufficientCapacityException: Buffer too small (4177920 < 4845595) at com.google.android.exoplayer2.decoder.DecoderInputBuffer.createReplacementByteBuffer(DecoderInputBuffer.java:241) at com.google.android.exoplayer2.decoder.DecoderInputBuffer.ensureSpaceForWrite(DecoderInputBuffer.java:192) at com.google.android.exoplayer2.source.SampleDataQueue.readSampleData(SampleDataQueue.java:292) at com.google.android.exoplayer2.source.SampleDataQueue.readToBuffer(SampleDataQueue.java:130) at com.google.android.exoplayer2.source.SampleQueue.read(SampleQueue.java:435) at com.google.android.exoplayer2.source.ProgressiveMediaPeriod.readData(ProgressiveMediaPeriod.java:487) at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$SampleStreamImpl.readData(ProgressiveMediaPeriod.java:945) at com.google.android.exoplayer2.BaseRenderer.readSource(BaseRenderer.java:425) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:1227) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:776) 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:102) at android.os.Looper.loop(Looper.java:223) at android.os.HandlerThread.run(HandlerThread.java:67) 2023-03-16 04:32:41.454 30475-31261 MediaCodecVideoRenderer com.okra.video E Video codec error com.google.android.exoplayer2.decoder.DecoderInputBuffer$InsufficientCapacityException: Buffer too small (4177920 < 4464248) at com.google.android.exoplayer2.decoder.DecoderInputBuffer.createReplacementByteBuffer(DecoderInputBuffer.java:241) at com.google.android.exoplayer2.decoder.DecoderInputBuffer.ensureSpaceForWrite(DecoderInputBuffer.java:192) at com.google.android.exoplayer2.source.SampleDataQueue.readSampleData(SampleDataQueue.java:292) at com.google.android.exoplayer2.source.SampleDataQueue.readToBuffer(SampleDataQueue.java:130) at com.google.android.exoplayer2.source.SampleQueue.read(SampleQueue.java:435) at com.google.android.exoplayer2.source.ProgressiveMediaPeriod.readData(ProgressiveMediaPeriod.java:487) at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$SampleStreamImpl.readData(ProgressiveMediaPeriod.java:945) at com.google.android.exoplayer2.BaseRenderer.readSource(BaseRenderer.java:425) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:1227) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:776) 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:102) at android.os.Looper.loop(Looper.java:223) at android.os.HandlerThread.run(HandlerThread.java:67) 2023-03-16 04:32:41.474 30475-30494 com.okra.video com.okra.video I Background concurrent copying GC freed 84(32KB) AllocSpace objects, 0(0B) LOS objects, 20% free, 94MB/118MB, paused 152us total 103.317ms 2023-03-16 04:32:41.730 30475-31293 ACodec com.okra.video W [OMX.rk.video_decoder.avc] BAD CODEC: Output format changed unexpectedly from (diff) AMessage(what = 0x00000000) = { int32_t color-standard = 6 int32_t android._dataspace = 281411584 } to (diff) AMessage(what = 0x00000000) = { int32_t color-standard = 1 int32_t android._dataspace = 260 } 2023-03-16 04:32:41.743 30475-30475 EventLogger com.okra.video D videoSize [eventTime=2.60, mediaPos=0.00, window=0, period=0, 3840, 2160] 2023-03-16 04:32:41.750 30475-30475 EventLogger com.okra.video D renderedFirstFrame [eventTime=2.61, mediaPos=0.00, window=0, period=0, Surface(name=null)/@0x686ef32] 2023-03-16 04:32:41.782 30475-31261 AudioTrack com.okra.video D getTimestamp_l(21): device stall time corrected using current time 6823977190221 2023-03-16 04:32:41.804 30475-31261 AudioTrack com.okra.video W getTimestamp_l(21): retrograde timestamp time corrected, 6823862271793 < 6823987274597 2023-03-16 04:32:41.811 30475-30475 EventLogger com.okra.video D state [eventTime=2.66, mediaPos=0.02, window=0, period=0, READY] 2023-03-16 04:32:41.816 30475-30475 EventLogger com.okra.video D isPlaying [eventTime=2.67, mediaPos=0.02, window=0, period=0, true] 2023-03-16 04:32:42.407 30475-30475 FragmentNavigator com.okra.video I Ignoring popBackStack() call: FragmentManager has already saved its state 2023-03-16 04:32:42.407 30475-30475 chatty com.okra.video I uid=1000(system) com.okra.video identical 2 lines 2023-03-16 04:32:42.407 30475-30475 FragmentNavigator com.okra.video I Ignoring popBackStack() call: FragmentManager has already saved its state 2023-03-16 04:32:42.439 30475-30475 TAG34 com.okra.video I mediaFragment onDestroy 2023-03-16 04:32:42.473 30475-30475 EventLogger com.okra.video D loading [eventTime=3.33, mediaPos=0.62, window=0, period=0, false] 2023-03-16 04:32:42.496 30475-30494 com.okra.video com.okra.video I Background concurrent copying GC freed 551(102KB) AllocSpace objects, 0(0B) LOS objects, 13% free, 153MB/177MB, paused 412us total 110.207ms 2023-03-16 04:32:42.609 30475-30475 EventLogger com.okra.video D loading [eventTime=3.47, mediaPos=0.75, window=0, period=0, true] 2023-03-16 04:32:42.633 30475-30475 EventLogger com.okra.video D loading [eventTime=3.49, mediaPos=0.77, window=0, period=0, false] 2023-03-16 04:32:42.818 30475-30475 EventLogger com.okra.video D loading [eventTime=3.68, mediaPos=0.95, window=0, period=0, true] 2023-03-16 04:32:42.840 30475-30475 EventLogger com.okra.video D loading [eventTime=3.70, mediaPos=0.97, window=0, period=0, false] 2023-03-16 04:32:42.892 30475-30475 EventLogger com.okra.video D loading [eventTime=3.75, mediaPos=1.02, window=0, period=0, true] 2023-03-16 04:32:42.984 30475-30475 EventLogger com.okra.video D loading [eventTime=3.84, mediaPos=1.11, window=0, period=0, false] 2023-03-16 04:32:43.258 30475-30475 EventLogger com.okra.video D loading [eventTime=4.12, mediaPos=1.39, window=0, period=0, true] 2023-03-16 04:32:43.283 30475-30475 EventLogger com.okra.video D loading [eventTime=4.14, mediaPos=1.41, window=0, period=0, false] 2023-03-16 04:32:43.524 30475-30475 EventLogger com.okra.video D loading [eventTime=4.38, mediaPos=1.65, window=0, period=0, true] 2023-03-16 04:32:43.546 30475-30475 EventLogger com.okra.video D loading [eventTime=4.41, mediaPos=1.67, window=0, period=0, false] 2023-03-16 04:32:43.720 30475-30475 EventLogger com.okra.video D loading [eventTime=4.58, mediaPos=1.85, window=0, period=0, true] 2023-03-16 04:32:43.741 30475-30475 EventLogger com.okra.video D loading [eventTime=4.60, mediaPos=1.87, window=0, period=0, false] 2023-03-16 04:32:43.858 30475-30475 EventLogger com.okra.video D loading [eventTime=4.72, mediaPos=1.99, window=0, period=0, true] 2023-03-16 04:32:43.942 30475-30475 EventLogger com.okra.video D loading [eventTime=4.80, mediaPos=2.07, window=0, period=0, false] 2023-03-16 04:32:44.028 30475-30475 EventLogger com.okra.video D loading [eventTime=4.89, mediaPos=2.15, window=0, period=0, true] 2023-03-16 04:32:44.039 30475-30475 EventLogger com.okra.video D loading [eventTime=4.90, mediaPos=2.17, window=0, period=0, false] 2023-03-16 04:32:44.487 30475-30475 EventLogger com.okra.video D loading [eventTime=5.35, mediaPos=2.62, window=0, period=0, true] 2023-03-16 04:32:44.509 30475-30475 EventLogger com.okra.video D loading [eventTime=5.37, mediaPos=2.64, window=0, period=0, false] 2023-03-16 04:32:44.725 30475-30475 EventLogger com.okra.video D loading [eventTime=5.58, mediaPos=2.85, window=0, period=0, true] 2023-03-16 04:32:44.745 30475-30475 EventLogger com.okra.video D loading [eventTime=5.60, mediaPos=2.87, window=0, period=0, false] 2023-03-16 04:32:44.823 30475-30475 EventLogger com.okra.video D loading [eventTime=5.68, mediaPos=2.95, window=0, period=0, true] 2023-03-16 04:32:44.887 30475-30475 EventLogger com.okra.video D loading [eventTime=5.75, mediaPos=3.01, window=0, period=0, false] 2023-03-16 04:32:45.253 30475-30475 EventLogger com.okra.video D loading [eventTime=6.11, mediaPos=3.38, window=0, period=0, true]

icbaker commented 1 year ago

Does it only happen on the stated device, or also on other devices (e.g. a phone)?

Please provide media we can use to reproduce this issue. Please either upload it here or send to dev.exoplayer@gmail.com using the subject Issue #11116. Please also update this issue to indicate you’ve done this.

sundaylol commented 1 year ago

Does it only happen on the stated device, or also on other devices (e.g. a phone)?

Please provide media we can use to reproduce this issue. Please either upload it here or send to dev.exoplayer@gmail.com using the subject Issue #11116. Please also update this issue to indicate you’ve done this.

It only happen on the rk3566 platform .Attach is the AvCodec.cpp ,and I have send the Video with email .The video file is very large, and because I used Permute3 to crop it, the video bitrate and resolution changed, so I can only send the original video. AvCodec.txt

christosts commented 1 year ago

Thank you for sharing the file us. Unfortunately, downloading was very slow and eventually failed due to network errors. Would you be able to host the file on some server and give us a direct link which we can pass directly to the player?

Aside, the error shows that MediaCodec is offering input buffers with size of approximately 4MB whereas the video has bigger samples. The player configures the max sample size when it creates the MediaCodec either based on the file, if the file headers specifies one, or using an approximation logic based on codec and resolution. From my experience though, devices do not necessarily follow the configuration and may decide to allocate either more or less space for each buffer.

I cannot tell at the moment which of the following happen in your case:

If we can try out the file, we can verify or eliminate the first two options. If you cannot share the file, I'll ask you to do some debugging to get to the bottom of this. Note that if it turns out that this is a device issue, there's not much that we do on the player side.

sundaylol commented 1 year ago

Thank you for sharing the file us. Unfortunately, downloading was very slow and eventually failed due to network errors. Would you be able to host the file on some server and give us a direct link which we can pass directly to the player?

Aside, the error shows that MediaCodec is offering input buffers with size of approximately 4MB whereas the video has bigger samples. The player configures the max sample size when it creates the MediaCodec either based on the file, if the file headers specifies one, or using an approximation logic based on codec and resolution. From my experience though, devices do not necessarily follow the configuration and may decide to allocate either more or less space for each buffer.

I cannot tell at the moment which of the following happen in your case:

  • the file specifies a max sample size that is incorrect, or
  • the player makes a calculation of max input size that is incorrect, or
  • the MediaCodec implementation on the device is not respecting the player parameters.

If we can try out the file, we can verify or eliminate the first two options. If you cannot share the file, I'll ask you to do some debugging to get to the bottom of this. Note that if it turns out that this is a device issue, there's not much that we do on the player side.

Thank you for your response. I have uploaded the original video to the cloud drive. https://drive.google.com/file/d/1-zRtCuweia35otM1rWaVbqETQmIAFxJi/view?usp=share_link Today, I tried several other devices such as mobile phones and tablets, but the problem did not occur on those devices. However, it is strange that when I use VideoView to play the video directly on the Rk3566 platform where the problem occurs, there is no such issue. Could you please help me to investigate the problem? Thank you very much.

christosts commented 1 year ago

Thank you for uploading the file. From the file itself, ExoPlayer picks that the maximum sample size is over 5MB and then ExoPlayer configures the codec with a higher max sample size, around 6MB. On a Pixel device, MediaCodec's input buffers are 7MB. I believe the problem you're facing is device specific and the device does not allocate big enough buffers for this content.

At this point, I think it will be more beneficial if you contact the device OEM and report this issue.

sundaylol commented 1 year ago

Thank you for uploading the file. From the file itself, ExoPlayer picks that the maximum sample size is over 5MB and then ExoPlayer configures the codec with a higher max sample size, around 6MB. On a Pixel device, MediaCodec's input buffers are 7MB. I believe the problem you're facing is device specific and the device does not allocate big enough buffers for this content.

At this point, I think it will be more beneficial if you contact the device OEM and report this issue.

Thank you for your response.