OSDN Git Service

stagefright: return encrypted input buffer for secure codecs
authorLajos Molnar <lajos@google.com>
Wed, 24 Sep 2014 00:49:02 +0000 (17:49 -0700)
committerLajos Molnar <lajos@google.com>
Wed, 24 Sep 2014 00:55:40 +0000 (17:55 -0700)
Bug: 17630446
Change-Id: I8a9352bcd00a3f4eb6fd2797d6809a8c1edc8482

media/libstagefright/MediaCodec.cpp

index 6c98c52..b56819c 100644 (file)
@@ -589,7 +589,12 @@ status_t MediaCodec::getBufferAndFormat(
     if (index < buffers->size()) {
         const BufferInfo &info = buffers->itemAt(index);
         if (info.mOwnedByClient) {
-            *buffer = info.mData;
+            // by the time buffers array is initialized, crypto is set
+            if (portIndex == kPortIndexInput && mCrypto != NULL) {
+                *buffer = info.mEncryptedData;
+            } else {
+                *buffer = info.mData;
+            }
             *format = info.mFormat;
         }
     }