ExoPlayer icon indicating copy to clipboard operation
ExoPlayer copied to clipboard

After updating to Android 12, an ACodec: dequeueBuffer failed: NO_INIT(-19) error occurs.

Open jeonghyun-genesislab opened this issue 2 years ago • 17 comments

  • ExoPlayer version number = 2.16.1 , 2.17.0
  • Android version = 12 , API 31
  • Android device = Galaxy S10+

Hello. I am making an app related to video.

Instead of downloading it first, save it locally and then play it. As a test, I put the mp4 video into a raw file in Android Studio and play it first.

First, let's take a quick look at the logs. Under normal circumstances, the onPlaybackStateChanged listener will return as below.

Logs > Player.STATE_BUFFERING Log > Player.STATE_READY Log > setPlayWhenReady: true

However, if you try to play the video occasionally, the following log appears and the video cannot be played.

Logs > Player.STATE_BUFFERING Log > Player.STATE_READY Log > setPlayWhenReady: true Logs > Player.STATE_BUFFERING E/BufferQueueProducer: SurfaceTexture-1-9339-7 dequeueBuffer: No producer associated with BufferQueue. E/ACodec: dequeueBuffer failed: NO_INIT(-19).

After returning READY from the status listener, it returns BUFFERING again. I get an error with a message stating that there is no producer attached to the BufferQueue.

The funny thing is that this issue occurs when entering and exiting the video playback screen and looping multiple times, and in some cases the error occurs upon first entry.

Other models were also tested. In the case of the Galaxy Fold 3, no error occurred after repeating more than 15 times. There were no errors with the LG-V30 device.

For reference, the Galaxy Fold 3 version is 12, and the LG-V30 is version 9.

The Galaxy S10+ is currently the only one with the error. The difference is that the OS was recently updated.

Please check this issue. thank you

jeonghyun-genesislab avatar Mar 03 '22 12:03 jeonghyun-genesislab

I'll log it for a smoother answer.

This is the screen where the log of the onPlaybackStateChanged listener is recorded.

If the video is played normally, the log is recorded as shown below.

2022-03-07 10:59:53.215 18264-18264/com.sample.test E/[PSE framework]: LOG > Player.STATE_BUFFERING 2022-03-07 10:59:53.349 18264-18264/com.sample.test E/[PSE framework]: LOG > Player.STATE_READY 2022-03-07 10:59:53.338 18264-19050/com.sample.test E/Surface: freeAllBuffers: 5 buffers were freed while being dequeued! 2022-03-07 10:59:53.905 18264-18720/com.sample.test E/Surface: freeAllBuffers: 11 buffers were freed while being dequeued! 2022-03-07 10:59:59.247 18264-19050/com.sample.test E/Surface: freeAllBuffers: 11 buffers were freed while being dequeued! 2022-03-07 10:59:59.319 18264-18720/com.sample.test E/Surface: freeAllBuffers: 11 buffers were freed while being dequeued!

When an error occurs, the log is recorded as below.

2022-03-07 11:01:20.309 18264-18264/com.sample.test E/[PSE framework]: LOG > Player.STATE_BUFFERING 2022-03-07 11:01:20.388 18264-18264/com.sample.test E/[PSE framework]: LOG > Player.STATE_READY 2022-03-07 11:01:20.390 18264-19681/com.sample.test E/BufferQueueProducer: SurfaceTexture-1-18264-7 dequeueBuffer: BufferQueue has no connected producer 2022-03-07 11:01:20.390 18264-19681/com.sample.test E/ACodec: dequeueBuffer failed: NO_INIT(-19). 2022-03-07 11:01:20.392 18264-18264/com.sample.test E/[PSE framework]: LOG > Player.STATE_BUFFERING 2022-03-07 11:01:20.904 18264-18720/com.sample.test E/Surface: freeAllBuffers: 11 buffers were freed while being dequeued!

Please let me know if you need additional information.

jeonghyun-genesislab avatar Mar 07 '22 02:03 jeonghyun-genesislab

To summarise, if I understand the info correctly:

  • You observe the issue on a Samsung Galaxy S10+ running Android 12.
  • You don't observe the issue on a Samsung Galaxy Fold 3 running Android 12 or an LG V30 running Android Pie (9).

Based on this I'm marking this issue as device-specific - if it is truly Samsung-specific then you may well be better off reporting it directly to them.

Some follow-up questions:

  • Have you found any versions of ExoPlayer where the problematic content works on a Samsung Galaxy S10+ running Android 12?
  • Does the issue reproduce with all video content (including different codecs, e.g. h264, h265, VP8), or just specific content? If specific content, please share that with us so we can try and reproduce.
  • Does the issue reproduce in the ExoPlayer demo app? If so, please provide the output of adb bugreport taken immediately after reproducing the playback failure.

Please either upload bug reports and media here or send them [email protected] using a subject in the format Issue #1234 (where #1234 should be replaced with this issue number.) Please also update this issue to indicate you’ve done this.


Additional info:

  • The BufferQueue has no connected producer logging often doesn't indicate a real problem (internal b/140581935#comment7) - so I'm not sure it offers a useful signal here. The true root cause of the playback failure is probably elsewhere in the logs.

icbaker avatar Mar 14 '22 11:03 icbaker

After playing the issue in the demo app, we sent the file and further explanation as requested.

jeonghyun-genesislab avatar Mar 14 '22 16:03 jeonghyun-genesislab

I/ExoPlayerImpl: Init 15edefa [ExoPlayerLib/2.16.1] [beyond2, SM-G975N, samsung, 31]
D/EventLogger: state [eventTime=0.00, mediaPos=0.00, window=0, BUFFERING]
D/EventLogger: playWhenReady [eventTime=0.00, mediaPos=0.00, window=0, true, USER_REQUEST]
D/EventLogger: timeline [eventTime=0.01, mediaPos=0.00, window=0, period=0, periodCount=1, windowCount=1, reason=SOURCE_UPDATE
D/EventLogger:   period [?]
D/EventLogger:   window [?, seekable=false, dynamic=false]
D/EventLogger: ]
D/EventLogger: loading [eventTime=0.01, mediaPos=0.00, window=0, period=0, true]
D/EventLogger: surfaceSize [eventTime=0.05, mediaPos=0.00, window=0, period=0, 1080, 2047]
D/EventLogger: timeline [eventTime=0.05, mediaPos=0.00, window=0, period=0, periodCount=1, windowCount=1, reason=SOURCE_UPDATE
D/EventLogger:   period [9.62]
D/EventLogger:   window [9.62, seekable=true, dynamic=false]
D/EventLogger: ]
D/EventLogger: videoEnabled [eventTime=0.06, mediaPos=0.00, window=0, period=0]
D/EventLogger: audioEnabled [eventTime=0.06, mediaPos=0.00, window=0, period=0]
D/EventLogger: tracks [eventTime=0.06, mediaPos=0.00, window=0, period=0, []]
D/EventLogger: downstreamFormat [eventTime=0.06, mediaPos=0.00, window=0, period=0, id=1, mimeType=video/avc, codecs=avc1.640028, res=1080x1920, fps=24.0]
D/EventLogger: videoDecoderInitialized [eventTime=0.06, mediaPos=0.00, window=0, period=0, OMX.Exynos.avc.dec]
D/EventLogger: videoInputFormat [eventTime=0.06, mediaPos=0.00, window=0, period=0, id=1, mimeType=video/avc, codecs=avc1.640028, res=1080x1920, fps=24.0]
D/EventLogger: downstreamFormat [eventTime=0.06, mediaPos=0.00, window=0, period=0, id=2, mimeType=audio/mp4a-latm, codecs=mp4a.40.2, channels=2, sample_rate=48000, language=und]
D/EventLogger: audioDecoderInitialized [eventTime=0.09, mediaPos=0.00, window=0, period=0, c2.android.aac.decoder]
D/EventLogger: audioInputFormat [eventTime=0.09, mediaPos=0.00, window=0, period=0, id=2, mimeType=audio/mp4a-latm, codecs=mp4a.40.2, channels=2, sample_rate=48000, language=und]
D/EventLogger: state [eventTime=0.09, mediaPos=0.00, window=0, period=0, READY]
D/EventLogger: isPlaying [eventTime=0.10, mediaPos=0.00, window=0, period=0, true]
D/EventLogger: loading [eventTime=0.12, mediaPos=0.00, window=0, period=0, false]
D/EventLogger: videoSize [eventTime=0.23, mediaPos=0.00, window=0, period=0, 1080, 1920]
D/EventLogger: surfaceSize [eventTime=0.24, mediaPos=0.02, window=0, period=0, 1080, 1920]
D/EventLogger: renderedFirstFrame [eventTime=0.25, mediaPos=0.02, window=0, period=0, Surface(name=null)/@0x67fcbc5]
D/EventLogger: surfaceSize [eventTime=1.53, mediaPos=1.22, window=0, period=0, 0, 0]
D/EventLogger: timeline [eventTime=1.53, mediaPos=0.00, window=0, periodCount=0, windowCount=0, reason=PLAYLIST_CHANGED
D/EventLogger: ]
D/EventLogger: positionDiscontinuity [eventTime=1.53, mediaPos=0.00, window=0, reason=REMOVE, PositionInfo:old [mediaItem=0, period=0, pos=1230], PositionInfo:new [mediaItem=0, period=-1, pos=0]]
D/EventLogger: mediaItem [eventTime=1.53, mediaPos=0.00, window=0, reason=PLAYLIST_CHANGED]
D/EventLogger: tracks [eventTime=1.53, mediaPos=0.00, window=0, []]
D/EventLogger: state [eventTime=1.53, mediaPos=0.00, window=0, ENDED]
D/EventLogger: isPlaying [eventTime=1.53, mediaPos=0.00, window=0, false]
I/ExoPlayerImpl: Release 15edefa [ExoPlayerLib/2.16.1] [beyond2, SM-G975N, samsung, 31] [goog.exo.core, goog.exo.ui, goog.exo.decoder, goog.exo.exoplayer, goog.exo.datasource, goog.exo.extractor]
D/EventLogger: videoDisabled [eventTime=1.57, mediaPos=0.00, window=0, period=0]
D/EventLogger: audioDisabled [eventTime=1.57, mediaPos=0.00, window=0, period=0]
D/EventLogger: videoDecoderReleased [eventTime=1.57, mediaPos=0.00, window=0, period=0, OMX.Exynos.avc.dec]
D/EventLogger: audioDecoderReleased [eventTime=1.57, mediaPos=0.00, window=0, period=0, c2.android.aac.decoder]
I/ExoPlayerImpl: Init cda5880 [ExoPlayerLib/2.16.1] [beyond2, SM-G975N, samsung, 31]
D/EventLogger: state [eventTime=0.00, mediaPos=0.00, window=0, BUFFERING]
D/EventLogger: playWhenReady [eventTime=0.00, mediaPos=0.00, window=0, true, USER_REQUEST]
D/EventLogger: timeline [eventTime=0.01, mediaPos=0.00, window=0, period=0, periodCount=1, windowCount=1, reason=SOURCE_UPDATE
D/EventLogger:   period [?]
D/EventLogger:   window [?, seekable=false, dynamic=false]
D/EventLogger: ]
D/EventLogger: loading [eventTime=0.01, mediaPos=0.00, window=0, period=0, true]
D/EventLogger: surfaceSize [eventTime=0.04, mediaPos=0.00, window=0, period=0, 1080, 2047]
D/EventLogger: timeline [eventTime=0.04, mediaPos=0.00, window=0, period=0, periodCount=1, windowCount=1, reason=SOURCE_UPDATE
D/EventLogger:   period [9.62]
D/EventLogger:   window [9.62, seekable=true, dynamic=false]
D/EventLogger: ]
D/EventLogger: videoEnabled [eventTime=0.04, mediaPos=0.00, window=0, period=0]
D/EventLogger: audioEnabled [eventTime=0.04, mediaPos=0.00, window=0, period=0]
D/EventLogger: tracks [eventTime=0.04, mediaPos=0.00, window=0, period=0, []]
D/EventLogger: downstreamFormat [eventTime=0.04, mediaPos=0.00, window=0, period=0, id=1, mimeType=video/avc, codecs=avc1.640028, res=1080x1920, fps=24.0]
D/EventLogger: videoDecoderInitialized [eventTime=0.07, mediaPos=0.00, window=0, period=0, OMX.Exynos.avc.dec]
D/EventLogger: videoInputFormat [eventTime=0.07, mediaPos=0.00, window=0, period=0, id=1, mimeType=video/avc, codecs=avc1.640028, res=1080x1920, fps=24.0]
D/EventLogger: downstreamFormat [eventTime=0.07, mediaPos=0.00, window=0, period=0, id=2, mimeType=audio/mp4a-latm, codecs=mp4a.40.2, channels=2, sample_rate=48000, language=und]
D/EventLogger: audioDecoderInitialized [eventTime=0.09, mediaPos=0.00, window=0, period=0, c2.android.aac.decoder]
D/EventLogger: audioInputFormat [eventTime=0.09, mediaPos=0.00, window=0, period=0, id=2, mimeType=audio/mp4a-latm, codecs=mp4a.40.2, channels=2, sample_rate=48000, language=und]
D/EventLogger: state [eventTime=0.09, mediaPos=0.00, window=0, period=0, READY]
D/EventLogger: isPlaying [eventTime=0.09, mediaPos=0.00, window=0, period=0, true]
D/EventLogger: loading [eventTime=0.11, mediaPos=0.00, window=0, period=0, false]
D/EventLogger: videoSize [eventTime=0.22, mediaPos=0.00, window=0, period=0, 1080, 1920]
D/EventLogger: surfaceSize [eventTime=0.23, mediaPos=0.01, window=0, period=0, 1080, 1920]
D/EventLogger: renderedFirstFrame [eventTime=0.23, mediaPos=0.01, window=0, period=0, Surface(name=null)/@0x32b14a3]
D/EventLogger: surfaceSize [eventTime=1.64, mediaPos=1.34, window=0, period=0, 0, 0]
D/EventLogger: timeline [eventTime=1.64, mediaPos=0.00, window=0, periodCount=0, windowCount=0, reason=PLAYLIST_CHANGED
D/EventLogger: ]
D/EventLogger: positionDiscontinuity [eventTime=1.65, mediaPos=0.00, window=0, reason=REMOVE, PositionInfo:old [mediaItem=0, period=0, pos=1348], PositionInfo:new [mediaItem=0, period=-1, pos=0]]
D/EventLogger: mediaItem [eventTime=1.65, mediaPos=0.00, window=0, reason=PLAYLIST_CHANGED]
D/EventLogger: tracks [eventTime=1.65, mediaPos=0.00, window=0, []]
D/EventLogger: state [eventTime=1.65, mediaPos=0.00, window=0, ENDED]
D/EventLogger: isPlaying [eventTime=1.65, mediaPos=0.00, window=0, false]
I/ExoPlayerImpl: Release cda5880 [ExoPlayerLib/2.16.1] [beyond2, SM-G975N, samsung, 31] [goog.exo.core, goog.exo.ui, goog.exo.decoder, goog.exo.exoplayer, goog.exo.datasource, goog.exo.extractor]
D/EventLogger: videoDisabled [eventTime=1.67, mediaPos=0.00, window=0, period=0]
D/EventLogger: audioDisabled [eventTime=1.67, mediaPos=0.00, window=0, period=0]
D/EventLogger: videoDecoderReleased [eventTime=1.67, mediaPos=0.00, window=0, period=0, OMX.Exynos.avc.dec]
D/EventLogger: audioDecoderReleased [eventTime=1.67, mediaPos=0.00, window=0, period=0, c2.android.aac.decoder]
I/ExoPlayerImpl: Init 7b542f1 [ExoPlayerLib/2.16.1] [beyond2, SM-G975N, samsung, 31]
D/EventLogger: state [eventTime=0.00, mediaPos=0.00, window=0, BUFFERING]
D/EventLogger: playWhenReady [eventTime=0.00, mediaPos=0.00, window=0, true, USER_REQUEST]
D/EventLogger: timeline [eventTime=0.01, mediaPos=0.00, window=0, period=0, periodCount=1, windowCount=1, reason=SOURCE_UPDATE
D/EventLogger:   period [?]
D/EventLogger:   window [?, seekable=false, dynamic=false]
D/EventLogger: ]
D/EventLogger: loading [eventTime=0.01, mediaPos=0.00, window=0, period=0, true]
D/EventLogger: surfaceSize [eventTime=0.03, mediaPos=0.00, window=0, period=0, 1080, 2047]
D/EventLogger: timeline [eventTime=0.04, mediaPos=0.00, window=0, period=0, periodCount=1, windowCount=1, reason=SOURCE_UPDATE
D/EventLogger:   period [9.62]
D/EventLogger:   window [9.62, seekable=true, dynamic=false]
D/EventLogger: ]
D/EventLogger: videoEnabled [eventTime=0.04, mediaPos=0.00, window=0, period=0]
D/EventLogger: audioEnabled [eventTime=0.04, mediaPos=0.00, window=0, period=0]
D/EventLogger: tracks [eventTime=0.04, mediaPos=0.00, window=0, period=0, []]
D/EventLogger: downstreamFormat [eventTime=0.04, mediaPos=0.00, window=0, period=0, id=1, mimeType=video/avc, codecs=avc1.640028, res=1080x1920, fps=24.0]
D/EventLogger: videoDecoderInitialized [eventTime=0.06, mediaPos=0.00, window=0, period=0, OMX.Exynos.avc.dec]
D/EventLogger: videoInputFormat [eventTime=0.06, mediaPos=0.00, window=0, period=0, id=1, mimeType=video/avc, codecs=avc1.640028, res=1080x1920, fps=24.0]
D/EventLogger: downstreamFormat [eventTime=0.06, mediaPos=0.00, window=0, period=0, id=2, mimeType=audio/mp4a-latm, codecs=mp4a.40.2, channels=2, sample_rate=48000, language=und]
D/EventLogger: audioDecoderInitialized [eventTime=0.09, mediaPos=0.00, window=0, period=0, c2.android.aac.decoder]
D/EventLogger: audioInputFormat [eventTime=0.09, mediaPos=0.00, window=0, period=0, id=2, mimeType=audio/mp4a-latm, codecs=mp4a.40.2, channels=2, sample_rate=48000, language=und]
D/EventLogger: state [eventTime=0.09, mediaPos=0.00, window=0, period=0, READY]
D/EventLogger: isPlaying [eventTime=0.09, mediaPos=0.00, window=0, period=0, true]
D/EventLogger: loading [eventTime=0.11, mediaPos=0.00, window=0, period=0, false]
D/EventLogger: state [eventTime=5.10, mediaPos=4.80, window=0, period=0, BUFFERING]
D/EventLogger: isPlaying [eventTime=5.10, mediaPos=4.80, window=0, period=0, false]

Hope this helps a bit more. I went to the official website and set the log.

Init 7b542f1 [ExoPlayerLib/2.16.1] [beyond2, SM-G975N, samsung, 31]

The log after this line is the situation where the video is not playing.

jeonghyun-genesislab avatar Mar 14 '22 17:03 jeonghyun-genesislab

Are you able to reproduce the issue on a non-Samsung device? If it only reproduces on Samsung devices, it likely indicates this isn't related to the ExoPlayer library and you should instead report this to Samsung.

icbaker avatar Mar 15 '22 17:03 icbaker

The dumpstate provided over email is access-restricted and I cannot read it. I'm also not sure it's the same as the output of running adb bugreport (based on the file name). Please can you make sure you've captured a bug report as described here: https://developer.android.com/studio/debug/bug-report

icbaker avatar Mar 15 '22 17:03 icbaker

Yes, that's right. We captured the bug report by referring to the official documentation. Except for the different name, the bug report format is the same as on the official website, but can't you read it?

I've also tested mine and company-supplied devices to make sure only Samsung devices are actually failing.

The result is as below.

Galaxy Note 10 (OS 9 // API 28) => No problem

Galaxy A6 (OS 10 // API29) => No problem

LG V-30 (OS 9 // API28) => No problem

Galaxy Fold3 (OS 12 // API 31) => Less frequent issue

to explain more For the Galaxy S10+, the problem did not occur, but the problem occurred after the OS 12 version update.

Is it the right way to ask Samsung to confirm in this case?

jeonghyun-genesislab avatar Mar 16 '22 07:03 jeonghyun-genesislab

but can't you read it?

I cannot access it, the file is access restricted on Google Drive and I do not have access.

I've also tested mine and company-supplied devices to make sure only Samsung devices are actually failing.

Is it the right way to ask Samsung to confirm in this case?

If you're unable to reproduce on non-Samsung devices then yes, I think it makes sense to report it to Samsung.

icbaker avatar Mar 22 '22 17:03 icbaker

exo dev [email protected]

Users can access Drive files and you have already added access to them.

What is still questionable All other Samsung devices except OS 12 are fine.

I will put off the manufacturer issue first and ask one more question.

Currently I am using two ExoPlayers in my app.

There is a screen that shows the thumbnail image in view pager format and a screen that plays the entire image when clicked.

That is, I am using 2 instances of ExoPlayer allocated and do you think this could be the cause?

jeonghyun-genesislab avatar Mar 23 '22 01:03 jeonghyun-genesislab

Hi, we are having the same problem on Galaxy S10+ OS12

That is, I am using 2 instances of ExoPlayer allocated and do you think this could be the cause?

We are seeing this with one player also

alexhorsa avatar May 10 '22 06:05 alexhorsa

Have the same trouble, find only one solution - downgrade exoplayer to previous version in my project. In version exo 2.13.3 all work perfectly

eloev avatar May 20 '22 11:05 eloev

Seems to work with surface type texture_view on exo player version 2.8.4

alexhorsa avatar May 20 '22 11:05 alexhorsa

The fact that this issue only occurs on Android 12 and 'recent' versions of ExoPlayer suggests it might be related to ExoPlayer's use of aynchronous interaction with MediaCodec.

ExoPlayer 2.16.0+ enables this mode by default on API >= 31 (Android 12) (as mentioned in the 2.16.0 release notes).

The BR provided over email shows MediaCodec is being used in async mode:

03-15 00:28:22.583 11244 17679 17864 I MediaCodec: MediaCodec will operate in async mode

As a workaround (and to verify this is the root cause) you can force-disable this mode with DefaultRenderersFactory#forceDisableMediaCodecAsynchronousQueueing (and then pass that RenderersFactory instance when building your ExoPlayer instance).

icbaker avatar May 23 '22 12:05 icbaker

I'm waiting to get access to a Samsung S10+ to try and repro. In the meantime, please follow the suggestion from @icbaker and disable asynchronous interactions with MediaCodec via DefaultRenderersFactory#forceDisableMediaCodecAsynchronousQueueing.

christosts avatar May 25 '22 15:05 christosts

I tried solution by @icbaker on Samsung S10(with Exynos, Android 12, which had problems), and it solve this. Thank's a lot

eloev avatar Jun 16 '22 18:06 eloev

Now after quite some time the workaround I have was very simple.

First of all @icbaker from DefaultRenderersFactory#forceDisableMediaCodecAsynchronousQueueing

I will take note too. Thank you.

I thought so.

look at the error message dequeueBuffer failed: NO_INIT(-19).

I thought it had something to do with the buffer

When loading the video, I had a vague thought that it would be okay to proceed after the buffer-related work was finished.

So, when moving on to the next activity, I played the video with a delay of 200L, and there was no error.

It may not be a fundamental solution, but I did this first.

jeonghyun-genesislab avatar Jun 21 '22 01:06 jeonghyun-genesislab

Same problem on Samsung Note10 (Android 12), and it was solved by @icbaker solution. Thanks.

codingct avatar Aug 16 '22 10:08 codingct