ExoPlayer icon indicating copy to clipboard operation
ExoPlayer copied to clipboard

MediaDrmStateException in mediaDrm.openSession()

Open Gian84 opened this issue 8 years ago • 7 comments

Issue description

I get a MediaDrmStateException in mediaDrm.openSession() when I try to reproduce a Playready content after to kill the power in Android TV box. This issue happens not often, so it is not easy reproduce it. For this reason, I would like just to know where can I find a documentation about the errors returned from getDiagnosticInfo() (https://developer.android.com/reference/android/media/MediaCasStateException.html). This function returns the value "error_neg_2003".

Reproduction steps

  • install ExoPlayer in a Android TV box
  • reproduce a playready content (demo content for example).
  • kill the power while ExoPayer reproduce the content
  • switch-on again the Android TV box
  • try to restart the same content
  • you get MediaDrmStateException

Link to test content

demo content for example { "name": "Super speed (PlayReady)", "uri": "http://playready.directtaps.net/smoothstreaming/SSWSS720H264PR/SuperSpeedway_720.ism", "drm_scheme": "playready" }

Version of ExoPlayer being used

ExoPlayer 2.6.0

Device(s) and version(s) of Android being used

Android TV Box - Android 7

A full bug report captured from the device

Gian84 avatar Apr 06 '18 15:04 Gian84

Please could you provide a bug report captured with adb bugreport after reproducing the error?

Assigning to @wvpaf for now in case he can provide information on MediaCas exceptions. Thanks!

andrewlewis avatar Apr 06 '18 15:04 andrewlewis

bugreport-NTK15-2018-04-06-17-04-41.zip I hope this is ok.

Thank so much!

Gian84 avatar Apr 09 '18 13:04 Gian84

Hi Gian84,

I think the error "error_neg_2003" maps to -2003 which is ERROR_DRM_SESSION_NOT_OPENED

Can you check if the bugreport you attached actually was taken immediately after the error occurred? I only see one openSession call and it appears to have been successful.

04-06 17:04:36.344 227 2552 V PlayReadySessionManager: openSession << sessionID = PR0 04-06 17:04:36.346 227 227 V PlayReadySessionManager: getSession >> 04-06 17:04:36.346 227 2552 V PlayReadySessionManager: getSession >> 04-06 17:04:36.346 227 2552 V PlayReadySessionManager: getKeyRequest >> init_data_size = 940 04-06 17:04:36.346 227 2552 V PlayReadySessionManager: getKeyRequest >> Found PSSH from initData: 32, 908

jt64 avatar Apr 10 '18 22:04 jt64

Thank you jy64! Sorry for may late, I got it the same error using the last demo app: ExoPlayer 2.7.3. ExoPlayer 2.7.3 Content url: "name": "Super speed (PlayReady)", "uri": "http://playready.directtaps.net/smoothstreaming/SSWSS720H264PR/SuperSpeedway_720.ism", "drm_scheme": "playready"

bug report attached: bugreport-NTK15-2018-04-20-14-03-49.zip

Gian84 avatar Apr 20 '18 12:04 Gian84

Thank you for the bug report and additional repro steps.

We see that PlayReady is failing to initialize its context with the error DRM_E_INVALIDARG

04-20 14:03:29.246 227 356 V PlayReadyContext: initialize >> 04-20 14:03:29.248 227 356 V PlayReadyContext: initialize Drm_Initialize called 04-20 14:03:29.678 227 356 E PlayReadyContext: initialize was failed with DRM_E_INVALIDARG(80070057) 04-20 14:03:29.678 227 356 E PlayReadySessionManager: Cannot initialize PlayReadyAppContext. 04-20 14:03:29.678 227 356 E PlayReadySessionManager: openSession failed since createSession() failed

We are discussing this problem internally and will update the bug with our findings.

jt64 avatar Apr 24 '18 22:04 jt64

Hi jt64, we have tried to save the drm session id and then release the drm session (and / or other similar solutions), but our code changes and tests have not solved the bug. Any news form your side?

Thanks, Gianmaria

Gian84 avatar May 23 '18 09:05 Gian84

Unfortunately we do not control the PlayReady implementation on AndroidTV devices so are not able to diagnose this further. The OEM (Technicolor in this case) integrates PR on the device so this issue must be reported to them.

jt64 avatar Oct 22 '19 22:10 jt64