OSDN Git Service

Fix typos and pointer math.
authorMarco Nelissen <marcone@google.com>
Tue, 13 May 2014 23:22:19 +0000 (16:22 -0700)
committerMarco Nelissen <marcone@google.com>
Wed, 14 May 2014 16:06:08 +0000 (09:06 -0700)
Change-Id: I07f33a57454d013844b56bc3e57fe0a271e8b38c

include/ndk/NdkMediaCodec.h
include/ndk/NdkMediaCrypto.h
media/ndk/NdkMediaCodec.cpp
media/ndk/NdkMediaCrypto.cpp

index 5233fe3..28d121c 100644 (file)
@@ -179,7 +179,7 @@ AMediaCodecCryptoInfo *AMediaCodecCryptoInfo_new(
         size_t *encryptedbytes);
 
 /**
- * delete an AMediaCodecCryptoInfo create previously with AMediaCodecCryptoInfo_new, or
+ * delete an AMediaCodecCryptoInfo created previously with AMediaCodecCryptoInfo_new, or
  * obtained from AMediaExtractor
  */
 int AMediaCodecCryptoInfo_delete(AMediaCodecCryptoInfo*);
index 0bcba9f..83eaad2 100644 (file)
@@ -39,7 +39,7 @@ typedef struct AMediaCrypto AMediaCrypto;
 
 typedef uint8_t AMediaUUID[16];
 
-bool AMediaCrypto_isCryptoSchemeSupport(const AMediaUUID uuid);
+bool AMediaCrypto_isCryptoSchemeSupported(const AMediaUUID uuid);
 
 bool AMediaCrypto_requiresSecureDecoderComponent(const char *mime);
 
index 1f62fa2..ac05920 100644 (file)
@@ -369,7 +369,7 @@ int AMediaCodec_queueSecureInputBuffer(
     if (err != 0) {
         ALOGE("queSecureInputBuffer: %s", errormsg.c_str());
     }
-    delete subSamples;
+    delete [] subSamples;
     return translate_error(err);
 }
 
@@ -396,13 +396,11 @@ AMediaCodecCryptoInfo *AMediaCodecCryptoInfo_new(
     ret->mode = mode;
 
     // clearbytes and encryptedbytes point at the actual data, which follows
-    ret->clearbytes = (size_t*) ((&ret->encryptedbytes) + sizeof(ret->encryptedbytes));
-    ret->encryptedbytes = (size_t*) (ret->clearbytes + (sizeof(size_t) * numsubsamples));
+    ret->clearbytes = (size_t*) (ret + 1); // point immediately after the struct
+    ret->encryptedbytes = ret->clearbytes + numsubsamples; // point after the clear sizes
 
-    size_t *dst = ret->clearbytes;
-    memcpy(dst, clearbytes, numsubsamples * sizeof(size_t));
-    dst += numsubsamples * sizeof(size_t);
-    memcpy(dst, encryptedbytes, numsubsamples * sizeof(size_t));
+    memcpy(ret->clearbytes, clearbytes, numsubsamples * sizeof(size_t));
+    memcpy(ret->encryptedbytes, encryptedbytes, numsubsamples * sizeof(size_t));
 
     return ret;
 }
index 25dfe6a..d57f42b 100644 (file)
@@ -74,7 +74,7 @@ struct AMediaCrypto {
 extern "C" {
 
 
-bool AMediaCrypto_isCryptoSchemeSupport(const AMediaUUID uuid) {
+bool AMediaCrypto_isCryptoSchemeSupported(const AMediaUUID uuid) {
     sp<ICrypto> crypto = makeCrypto();
     if (crypto == NULL) {
         return false;