ExoPlayer icon indicating copy to clipboard operation
ExoPlayer copied to clipboard

Failed to open session: General DRM error. (Samsung Galaxy S6)

Open casajavi opened this issue 10 years ago • 16 comments

I have been getting this error randomly during play back on all Samsung Galaxy S6 / Edge / Edge + phones :

01-22 10:58:30.297 12215-12215/com.blim E/EventLogger: internalError [0.26, drmSessionManagerError]
                                                       android.media.MediaDrm$MediaDrmStateException: Failed to open session: General DRM error
                                                           at android.media.MediaDrm.openSession(Native Method)
                                                           at com.google.android.exoplayer.drm.StreamingDrmSessionManager.openInternal(StreamingDrmSessionManager.java:320)
                                                           at com.google.android.exoplayer.drm.StreamingDrmSessionManager.open(StreamingDrmSessionManager.java:293)
                                                           at com.google.android.exoplayer.MediaCodecTrackRenderer.maybeInitCodec(MediaCodecTrackRenderer.java:310)
                                                           at com.google.android.exoplayer.MediaCodecTrackRenderer.onInputFormatChanged(MediaCodecTrackRenderer.java:723)
                                                           at com.google.android.exoplayer.MediaCodecVideoTrackRenderer.onInputFormatChanged(MediaCodecVideoTrackRenderer.java:328)
                                                           at com.google.android.exoplayer.MediaCodecTrackRenderer.readFormat(MediaCodecTrackRenderer.java:484)
                                                           at com.google.android.exoplayer.MediaCodecTrackRenderer.doSomeWork(MediaCodecTrackRenderer.java:467)
                                                           at com.google.android.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:431)
                                                           at com.google.android.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:213)
                                                           at android.os.Handler.dispatchMessage(Handler.java:98)
                                                           at android.os.Looper.loop(Looper.java:145)
                                                           at android.os.HandlerThread.run(HandlerThread.java:61)
                                                           at com.google.android.exoplayer.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40)

Once this issue occurs it basically kills the phones ability to play any other asset that requires DRM including other apps like Netflix. I cant seem to find a way to recover from the error and it leaves me no choice but to restart the device.

If anyone has encountered this problem and has some advice it would be highly appreciated!

casajavi avatar Jan 22 '16 17:01 casajavi

Is it possible that you're opening MediaDrm sessions and failing to close them again. How do you actually reproduce the issue? Is it possible to reproduce the problem with the ExoPlayer demo app?

ojw28 avatar Jan 22 '16 17:01 ojw28

That is possible, We reproduce it using one of our feeds and it is one of those things that just happens randomly sometimes one hour into the playback but once it happens there is not way to play any asset again. And it only seems to happen on the Samsung Galaxy S6 , and S6 Edge +.

I will try to close the session once the error occurs and also try to reproduce it using the demo app.

Thanks for the quick response.

casajavi avatar Jan 22 '16 17:01 casajavi

The issue would more likely be that previous playback sessions have not closed their DRM sessions. A failure then occurs because there are so many sessions held open due to previous playbacks, that it's not possible to create another one.

ojw28 avatar Jan 22 '16 18:01 ojw28

Our StreamingDrmSessionManager seems to always be in a Error state after this happens and it doesn't seem to have any other open sessions. Do you know of any way to reset or close all DRM sessions running at a global level ? calling StreamingDrmSessionManager.close() hasn't lead to different results.

casajavi avatar Jan 22 '16 21:01 casajavi

How are you determining whether there are any other open sessions? Can you reproduce this with the demo app, or only your app? If you can't reproduce with the demo app then it's likely an app specific issue.

I'm not aware of any way to reset DRM sessions at the global level, unfortunately (that's not to say that there isn't one - just that I'm not aware of one!).

ojw28 avatar Jan 22 '16 21:01 ojw28

So it looks like StreamingDrmSessionManager.close() will always fail to close it because the "sessionId" property is null at this point : if (sessionId != null) { mediaDrm.closeSession(sessionId); sessionId = null; } but I see that there is a session open......

so this in turn makes this method fail every time I try to open a new session: private void openInternal(boolean allowProvisioning) { try { sessionId = mediaDrm.openSession(); mediaCrypto = new MediaCrypto(uuid, sessionId); state = STATE_OPENED; postKeyRequest(); } catch (NotProvisionedException e) { if (allowProvisioning) { postProvisionRequest(); } else { onError(e); } } catch (Exception e) { onError(e); } }

It seems like I am stuck in a loop of not being able to close but not being able to open. Very strange that I cannot reproduce this on any other phone.... and sorry haven't had time to run it in the demo will try to now.

casajavi avatar Jan 22 '16 21:01 casajavi

Hi, we have the same issue here on the same devices.

The way to reproduce for us is to seek (change player position) multiple times on a Widevine protected Dash video.

It's consistently reproductible in about 3 minutes of seeking.

Then nothing but a reboot has worked so far.

tajoumal avatar Jan 27 '16 02:01 tajoumal

As above, does this reproduce using ExoPlayer's demo app, or just with your own applications? Thanks!

ojw28 avatar Jan 27 '16 09:01 ojw28

On the latest 1.5.4 demo app slightly adapted to use our stream and license.

tajoumal avatar Jan 27 '16 09:01 tajoumal

I feel there's something missing from the description provided here. I'm pretty sure that the call stack at the top of this report only occurs at the start of playback. I don't think seeking would ever cause you to hit that code path, unless playback were to fail and you were then to start a subsequent playback.

If the playback is failing with some other error, and then the stack at the top of this report only occurs on a subsequent playback, then it's the initial failure that we need to be looking at, rather than the one that's been provided. Please provide more details around exactly what you're seeing, and corresponding logs, preferably in the form of a full bug report taken with adb bugreport, not adb logcat and not just the stack copied from an IDE.

Thanks!

ojw28 avatar Jan 27 '16 10:01 ojw28

Sorry if it wasn't clear. To reproduce, I seek-to pretty fast, and then it crashes. Then when I try to play the video again, or any other video for that matter, it crashes.

Here's the bugreport for the first crash.

@casajavi I am pretty sure we are facing the same issue but please let me know if I'm wrong. BugReport_ExoPlayer_1178.zip

tajoumal avatar Jan 27 '16 10:01 tajoumal

Hey @tajoumal We have not reproduced the error in the same manner but if you are encountering DRM Session errors after the first initial crash in all other video streams then it is likely the same issue. We are trying to find some time to dig further into this issue. I will post as soon as I find further information.

casajavi avatar Jan 27 '16 20:01 casajavi

@casajavi Thanks @ojw28 Any idea about how to solve this?

tajoumal avatar Mar 17 '16 08:03 tajoumal

If this is still reproducible, please provide an ADB Bugreport.

thanks.

wvpaf avatar May 03 '16 22:05 wvpaf

@casajavi , any updates? almost 3 months without a ADB Bugreport. Will monitor for a couple more weeks then will close.

wvpaf avatar Jul 26 '16 21:07 wvpaf

@wvpaf @tajoumal It seems like some of our assets where encoded incorrectly, it had something to do with a conversion from the original format to Dash affecting the way the aspect ratio was being calculated..... I dont really have the full details on this.

Anyway once the assets were re-encoded it started working fine and it made sense to us because only certain assets would cause this particular issue. It also caused different issues on different phones. It was a very strange issue but it lead us to discover the root of the problem (which was our asset encoding).

casajavi avatar Jul 27 '16 14:07 casajavi