Merge 9cf3017b600c9fd71b3ce4a9a190509d42f08f45 on remote branch

Change-Id: I32759026e541117b3b7d248e3011435341887e73
diff --git a/gralloc/QtiGralloc.cpp b/gralloc/QtiGralloc.cpp
index 954c46d..e71e545 100644
--- a/gralloc/QtiGralloc.cpp
+++ b/gralloc/QtiGralloc.cpp
@@ -164,6 +164,23 @@
   return Error::NONE;
 }
 
+Error decodeVideoTranscodeStatsMetadata(hidl_vec<uint8_t> &in, VideoTranscodeStatsMetadata *out) {
+  if (!in.size() || !out) {
+    return Error::BAD_VALUE;
+  }
+  memcpy(out, in.data(), sizeof(VideoTranscodeStatsMetadata));
+  return Error::NONE;
+}
+
+Error encodeVideoTranscodeStatsMetadata(VideoTranscodeStatsMetadata &in, hidl_vec<uint8_t> *out) {
+  if (!out) {
+    return Error::BAD_VALUE;
+  }
+  out->resize(sizeof(VideoTranscodeStatsMetadata));
+  memcpy(out->data(), &in, sizeof(VideoTranscodeStatsMetadata));
+  return Error::NONE;
+}
+
 Error decodeVideoTimestampInfo(hidl_vec<uint8_t> &in, VideoTimestampInfo *out) {
   if (!in.size() || !out) {
     return Error::BAD_VALUE;
@@ -225,6 +242,8 @@
       return MetadataType_CVPMetadata;
     case QTI_VIDEO_HISTOGRAM_STATS:
       return MetadataType_VideoHistogramStats;
+    case QTI_VIDEO_TRANSCODE_STATS:
+      return MetadataType_VideoTranscodeStats;
     case QTI_VIDEO_TS_INFO:
       return MetadataType_VideoTimestampInfo;
     case QTI_FD:
@@ -326,6 +345,10 @@
       err = decodeVideoHistogramMetadata(bytestream,
                                          reinterpret_cast<VideoHistogramMetadata *>(param));
       break;
+    case QTI_VIDEO_TRANSCODE_STATS:
+      err = decodeVideoTranscodeStatsMetadata(bytestream,
+                                   reinterpret_cast<VideoTranscodeStatsMetadata *>(param));
+      break;
     case QTI_VIDEO_TS_INFO:
       err = decodeVideoTimestampInfo(bytestream, reinterpret_cast<VideoTimestampInfo *>(param));
       break;
@@ -449,6 +472,10 @@
       err = encodeVideoHistogramMetadata(*reinterpret_cast<VideoHistogramMetadata *>(param),
                                          &bytestream);
       break;
+    case QTI_VIDEO_TRANSCODE_STATS:
+      err = encodeVideoTranscodeStatsMetadata(
+            *reinterpret_cast<VideoTranscodeStatsMetadata *>(param), &bytestream);
+      break;
     case QTI_VIDEO_TS_INFO:
       err = encodeVideoTimestampInfo(*reinterpret_cast<VideoTimestampInfo *>(param), &bytestream);
       break;