Is it possible to decrypt and decode data using MediaCodec API?
I want to decrypt and decode the data which is encrypted by widevine or other DRM mechanism.
The basic thing I want to try is
I configured the MediaCodec with Surface which is created from SurfaceTexure.
MediaCodec->configure(..????., with mediacrypto instance, ...)
I'm not sure if I can pass SurfaceTexture in this case?
Or any secure configure I should do?
MediaCodec->start()
MediaCodec->queuesecureinputbuffer(...,with cryptoinfo,...)
MediaCodec->dequeoutputbuffer() to get the decoded data back....
The sample I could find is to directly render decrypted data onto a SurfaceView.
But I just want to get the decoded buffer or a SurfaceTexture which is rendered by the MediaCodec.
If I didn't set any secure configure such as MediaFormat->SetFeatureEnabled("secure-playback", true)
; use OMX.qcom.video.decoder.avc to create the decoder.
I will get such error,
E/OMX-VDEC-1080P(23290):
E/OMX-VDEC-1080P(23290): ERROR: Sending OMX_EventError to Client
E/ (23290): not in avi mode
E/ACodec ( 1930): [OMX.qcom.video.decoder.avc] ERROR(0x80001009)
E/ACodec ( 1930): signalError(omxError 0x80001009, internalError -2147483648)
E/MediaCodec( 1930): Codec reported err 0x80001009, actionCode 0, while in state 6
W/System.err( 1930): java.lang.IllegalStateException
W/System.err( 1930): at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)
W/System.err( 1930): at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:1033)
Once I set the secure config and use MediaCodec::CreateByCodecName(with ".secure" appended) I will get this kind of error...
E/ACodec: native window could not be authenticated
E/ACodec: Failed to allocate buffers after transitioning to IDLE state (error 0xffffffff)
E/ACodec: signalError(omxError 0x80001001, internalError -1)