Merge "media: Deprecate support for NV12_512"
diff --git a/conf_files/kona/media_codecs.xml b/conf_files/kona/media_codecs.xml
index ffb158e..17e5741 100644
--- a/conf_files/kona/media_codecs.xml
+++ b/conf_files/kona/media_codecs.xml
@@ -335,7 +335,6 @@
             <Feature name="secure-playback" required="true" />
             <Limit name="concurrent-instances" max="3" />
             <Limit name="performance-point-3840x2160" value="60" />
-            <Limit name="performance-point-4096x2160" value="60" />
             <Limit name="performance-point-4096x2304" value="60" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.mpeg2" type="video/mpeg2" >
@@ -416,7 +415,6 @@
             <Feature name="secure-playback" required="true" />
             <Limit name="concurrent-instances" max="3" />
             <Limit name="performance-point-3840x2160" value="60" />
-            <Limit name="performance-point-4096x2160" value="60" />
             <Limit name="performance-point-4096x2304" value="60" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.hevc" type="video/hevc" >
@@ -452,7 +450,6 @@
             <Feature name="secure-playback" required="true" />
             <Limit name="concurrent-instances" max="3" />
             <Limit name="performance-point-3840x2160" value="60" />
-            <Limit name="performance-point-4096x2160" value="60" />
             <Limit name="performance-point-4096x2304" value="60" />
         </MediaCodec>
         <!-- Video Software -->
diff --git a/conf_files/kona/media_codecs_performance.xml b/conf_files/kona/media_codecs_performance.xml
index 4072536..29ecd0b 100644
--- a/conf_files/kona/media_codecs_performance.xml
+++ b/conf_files/kona/media_codecs_performance.xml
@@ -127,11 +127,11 @@
             <Limit name="measured-frame-rate-1920x1080" range="248-248" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.vp9" type="video/x-vnd.on2.vp9" update="true">
-            <Limit name="measured-frame-rate-320x240" range="1103-1262" />
-            <Limit name="measured-frame-rate-640x360" range="1055-1163" />
-            <Limit name="measured-frame-rate-1280x720" range="579-594" />
-            <Limit name="measured-frame-rate-1920x1080" range="496-518" />
-            <Limit name="measured-frame-rate-3840x2160" range="139-139" />
+            <Limit name="measured-frame-rate-320x240" range="330-450" />
+            <Limit name="measured-frame-rate-640x360" range="300-390" />
+            <Limit name="measured-frame-rate-1280x720" range="238-253" />
+            <Limit name="measured-frame-rate-1920x1080" range="175-225" />
+            <Limit name="measured-frame-rate-3840x2160" range="83-98" />
         </MediaCodec>
         <MediaCodec name="OMX.google.h264.decoder" type="video/avc" update="true">
             <Limit name="measured-frame-rate-320x240" range="122-370" />
diff --git a/conf_files/kona/media_codecs_vendor.xml b/conf_files/kona/media_codecs_vendor.xml
index 496c906..b68b509 100644
--- a/conf_files/kona/media_codecs_vendor.xml
+++ b/conf_files/kona/media_codecs_vendor.xml
@@ -336,7 +336,6 @@
             <Feature name="secure-playback" required="true" />
             <Limit name="concurrent-instances" max="3" />
             <Limit name="performance-point-3840x2160" value="60" />
-            <Limit name="performance-point-4096x2160" value="60" />
             <Limit name="performance-point-4096x2304" value="60" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.mpeg2" type="video/mpeg2" >
@@ -417,7 +416,6 @@
             <Feature name="secure-playback" required="true" />
             <Limit name="concurrent-instances" max="3" />
             <Limit name="performance-point-3840x2160" value="60" />
-            <Limit name="performance-point-4096x2160" value="60" />
             <Limit name="performance-point-4096x2304" value="60" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.hevc" type="video/hevc" >
@@ -453,7 +451,6 @@
             <Feature name="secure-playback" required="true" />
             <Limit name="concurrent-instances" max="3" />
             <Limit name="performance-point-3840x2160" value="60" />
-            <Limit name="performance-point-4096x2160" value="60" />
             <Limit name="performance-point-4096x2304" value="60" />
         </MediaCodec>
         <!-- Video Software -->
diff --git a/conf_files/kona/mediacodec-seccomp.policy b/conf_files/kona/mediacodec-seccomp.policy
index 3bf11a3..0b75b84 100644
--- a/conf_files/kona/mediacodec-seccomp.policy
+++ b/conf_files/kona/mediacodec-seccomp.policy
@@ -17,3 +17,5 @@
 timer_create: 1
 timer_settime: 1
 rt_sigtimedwait: 1
+readlink: 1
+open: 1
diff --git a/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h b/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h
index b808d75..b666cd6 100644
--- a/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h
+++ b/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h
@@ -325,7 +325,7 @@
 	size_t offset;
 	size_t len;
 	uint32_t flags;
-	int64_t time_stamp;
+	uint64_t time_stamp;
 	enum vdec_picture pic_type;
 	void *client_data;
 	struct vdec_picsize picsize;
diff --git a/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h b/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
index a8e77f2..569d53d 100644
--- a/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
+++ b/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
@@ -265,7 +265,7 @@
 struct statistics {
     struct timeval prev_tv;
     int prev_fbd;
-    int bytes_generated;
+    OMX_U32 bytes_generated;
 };
 
 enum rc_modes {
diff --git a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
index 77a892e..ab2f301 100644
--- a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
+++ b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
@@ -440,14 +440,14 @@
         /* calc avg. fps, bitrate */
         struct timeval tv;
         gettimeofday(&tv,NULL);
-        OMX_U64 time_diff = (tv.tv_sec * 1000000ULL + tv.tv_usec) -
-                (stats.prev_tv.tv_sec * 1000000ULL + stats.prev_tv.tv_usec);
+        OMX_U64 time_diff = ((uint64_t) tv.tv_sec * (uint64_t) 1000000ULL + (uint64_t) tv.tv_usec) -
+                ((uint64_t) stats.prev_tv.tv_sec * (uint64_t) 1000000ULL + (uint64_t) stats.prev_tv.tv_usec);
         if (time_diff >= 1000000) {
             OMX_U32 num_fbd = omx->handle->fbd - stats.prev_fbd;
             if (stats.prev_tv.tv_sec && num_fbd && time_diff) {
                 float framerate = num_fbd * 1000000/(float)time_diff;
-                OMX_U32 bitrate = (stats.bytes_generated * 8 / num_fbd) * framerate;
-                DEBUG_PRINT_INFO("stats: avg. fps %0.2f, bitrate %d",
+                OMX_U64 bitrate = (stats.bytes_generated * 8 / num_fbd) * framerate;
+                DEBUG_PRINT_INFO("stats: avg. fps %0.2f, bitrate %llu",
                     framerate, bitrate);
             }
             stats.prev_tv = tv;
diff --git a/product.mk b/product.mk
index 8072deb..f809485 100644
--- a/product.mk
+++ b/product.mk
@@ -25,3 +25,6 @@
 include hardware/qcom/media/conf_files/$(TARGET_BOARD_PLATFORM)/$(TARGET_BOARD_PLATFORM).mk
 
 endif
+
+#Vendor property to enable Codec2 for audio and OMX for Video
+PRODUCT_PROPERTY_OVERRIDES += debug.stagefright.ccodec=1