Merge remote-tracking branch 'goog/qcom/release/LA.UM.9.1.C11.11.00.00.841.013' into sc-dev

 Conflicts:
	conf_files/atoll/media_codecs.xml
	conf_files/atoll/media_codecs_performance.xml
	conf_files/atoll/media_codecs_vendor.xml
	conf_files/sm6150/media_codecs.xml
	conf_files/sm6150/media_codecs_sdmmagpie_v1.xml
	conf_files/sm6150/media_codecs_vendor_sdmmagpie_v1.xml
	mm-core/src/registry_table.c
	mm-core/src/registry_table_android.c
	mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp
	product.mk

Bug: 188781413
Bug: 189096555
Change-Id: I3ff3c2d9f700e0e134fedc8e0012381cdd9442b3
diff --git a/conf_files/atoll/atoll.mk b/conf_files/atoll/atoll.mk
index aeecb4b..d61842d 100644
--- a/conf_files/atoll/atoll.mk
+++ b/conf_files/atoll/atoll.mk
@@ -20,8 +20,8 @@
   PRODUCT_ODM_PROPERTIES += debug.stagefright.ccodec=4
   PRODUCT_ODM_PROPERTIES += debug.stagefright.omx_default_rank=1000
 else
-  $(warning "Enabling codec2.0 SW only for non-generic odm build variant")
-  #Rank OMX SW codecs lower than OMX HW codecs
-  PRODUCT_PROPERTY_OVERRIDES += debug.stagefright.omx_default_rank.sw-audio=1
+  $(warning "Enabling codec2.0 non-audio SW only for non-generic odm build variant")
   PRODUCT_PROPERTY_OVERRIDES += debug.stagefright.omx_default_rank=0
+  PRODUCT_COPY_FILES += \
+     device/qcom/common/media/media_profiles.xml:$(TARGET_COPY_OUT_ODM)/etc/media_profiles_V1_0.xml
 endif
diff --git a/conf_files/atoll/media_codecs.xml b/conf_files/atoll/media_codecs.xml
index 1d0185c..514ce7a 100644
--- a/conf_files/atoll/media_codecs.xml
+++ b/conf_files/atoll/media_codecs.xml
@@ -199,6 +199,7 @@
             <Limit name="frame-rate" range="1-30" />
             <Limit name="concurrent-instances" max="16" />
             <Limit name="performance-point-720x480" value="30" />
+            <Limit name="performance-point-720x576" value="25" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.encoder.mpeg4sw" type="video/mp4v-es" >
              <Quirk name="requires-allocate-on-input-ports" />
@@ -212,6 +213,7 @@
              <Limit name="frame-rate" range="1-30" />
              <Limit name="concurrent-instances" max="16" />
              <Limit name="performance-point-720x480" value="30" />
+             <Limit name="performance-point-720x576" value="25" />
         </MediaCodec>
     </Encoders>
     <Decoders>
@@ -361,6 +363,7 @@
              <Feature name="adaptive-playback" />
              <Limit name="concurrent-instances" max="16" />
              <Limit name="performance-point-720x480" value="30" />
+             <Limit name="performance-point-720x576" value="25" />
         </MediaCodec>
         <MediaCodec name="OMX.qti.video.decoder.mpeg4sw" type="video/mp4v-es">
              <Quirk name="requires-allocate-on-input-ports" />
diff --git a/conf_files/atoll/media_codecs_performance.xml b/conf_files/atoll/media_codecs_performance.xml
index bd31f08..450f78d 100644
--- a/conf_files/atoll/media_codecs_performance.xml
+++ b/conf_files/atoll/media_codecs_performance.xml
@@ -22,20 +22,20 @@
 <MediaCodecs>
     <Encoders>
         <MediaCodec name="OMX.qcom.video.encoder.avc" type="video/avc" update="true">
-            <Limit name="measured-frame-rate-320x240" range="238-238" />
-            <Limit name="measured-frame-rate-720x480" range="123-123" />
-            <Limit name="measured-frame-rate-1280x720" range="50-50" />
-            <Limit name="measured-frame-rate-1920x1080" range="16-40" />
+            <Limit name="measured-frame-rate-320x240" range="650-655" />
+            <Limit name="measured-frame-rate-720x480" range="280-289" />
+            <Limit name="measured-frame-rate-1280x720" range="110-115" />
+            <Limit name="measured-frame-rate-1920x1080" range="91-95" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.encoder.hevc" type="video/hevc" update="true">
-            <Limit name="measured-frame-rate-320x240" range="226-226" />
-            <Limit name="measured-frame-rate-720x480" range="121-121" />
-            <Limit name="measured-frame-rate-1280x720" range="49-49" />
+            <Limit name="measured-frame-rate-320x240" range="580-590" />
+            <Limit name="measured-frame-rate-720x480" range="270-300" />
+            <Limit name="measured-frame-rate-1280x720" range="110-119" />
             <Limit name="measured-frame-rate-1920x1080" range="16-45" />
             <Limit name="measured-frame-rate-3840x2160" range="20-28" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.encoder.h263sw" type="video/3gpp" update="true">
-            <Limit name="measured-frame-rate-176x144" range="79-117" />
+            <Limit name="measured-frame-rate-176x144" range="270-280" />
             <Limit name="measured-frame-rate-352x288" range="59-84" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.encoder.mpeg4sw" type="video/mp4v-es" update="true">
@@ -45,8 +45,8 @@
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.encoder.vp8" type="video/x-vnd.on2.vp8" update="true">
             <Limit name="measured-frame-rate-320x180" range="266-266" />
-            <Limit name="measured-frame-rate-640x360" range="165-165" />
-            <Limit name="measured-frame-rate-1280x720" range="49-49" />
+            <Limit name="measured-frame-rate-640x360" range="440-450" />
+            <Limit name="measured-frame-rate-1280x720" range="130-135" />
             <Limit name="measured-frame-rate-1920x1080" range="16-40" />
         </MediaCodec>
         <MediaCodec name="OMX.google.h264.encoder" type="video/avc" update="true">
@@ -122,8 +122,8 @@
             <Limit name="measured-frame-rate-320x240" range="377-377" />
             <Limit name="measured-frame-rate-640x360" range="323-323" />
             <Limit name="measured-frame-rate-1280x720" range="262-262" />
-            <Limit name="measured-frame-rate-1920x1080" range="220-220" />
-            <Limit name="measured-frame-rate-3840x2160" range="51-51" />
+            <Limit name="measured-frame-rate-1920x1080" range="77-81" />
+            <Limit name="measured-frame-rate-3840x2160" range="18-19" />
         </MediaCodec>
         <MediaCodec name="OMX.google.h264.decoder" type="video/avc" update="true">
             <Limit name="measured-frame-rate-320x240" range="122-122" />
diff --git a/conf_files/atoll/media_codecs_vendor.xml b/conf_files/atoll/media_codecs_vendor.xml
index 959da1c..6e892ec 100644
--- a/conf_files/atoll/media_codecs_vendor.xml
+++ b/conf_files/atoll/media_codecs_vendor.xml
@@ -212,6 +212,7 @@
             <Limit name="frame-rate" range="1-30" />
             <Limit name="concurrent-instances" max="16" />
             <Limit name="performance-point-720x480" value="30" />
+            <Limit name="performance-point-720x576" value="25" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.encoder.mpeg4sw" type="video/mp4v-es" >
              <Quirk name="requires-allocate-on-input-ports" />
@@ -225,6 +226,7 @@
              <Limit name="frame-rate" range="1-30" />
              <Limit name="concurrent-instances" max="16" />
              <Limit name="performance-point-720x480" value="30" />
+             <Limit name="performance-point-720x576" value="25" />
         </MediaCodec>
     </Encoders>
     <Decoders>
@@ -374,6 +376,7 @@
              <Feature name="adaptive-playback" />
              <Limit name="concurrent-instances" max="16" />
              <Limit name="performance-point-720x480" value="30" />
+             <Limit name="performance-point-720x576" value="25" />
         </MediaCodec>
         <MediaCodec name="OMX.qti.video.decoder.mpeg4sw" type="video/mp4v-es">
              <Quirk name="requires-allocate-on-input-ports" />
diff --git a/conf_files/atoll/media_codecs_vendor_audio.xml b/conf_files/atoll/media_codecs_vendor_audio.xml
index e6273e9..e334641 100644
--- a/conf_files/atoll/media_codecs_vendor_audio.xml
+++ b/conf_files/atoll/media_codecs_vendor_audio.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" ?>
-<!-- Copyright (C) 2015-2019 The Linux Foundation. All rights reserved.
+<!-- Copyright (C) 2015-2020 The Linux Foundation. All rights reserved.
      Not a contribution.
      Copyright (C) 2012 The Android Open Source Project
 
@@ -19,9 +19,6 @@
     <Decoders>
         <MediaCodec name="OMX.google.opus.decoder" type="audio/opus" update="true" rank="100"/>
         <!-- SimpleOMXComponet based software decoder-->
-        <MediaCodec name="OMX.qti.audio.decoder.flac" type="audio/flac" rank="0">
-            <Limit name="concurrent-instances" max="10" />
-        </MediaCodec>
         <MediaCodec name="OMX.qti.audio.decoder.mpegh" type="audio/mhas" rank="0">
             <Limit name="concurrent-instances" max="1" />
         </MediaCodec>
diff --git a/conf_files/atoll/media_profiles.xml b/conf_files/atoll/media_profiles.xml
index 38aa45e..4c8c2a0 100644
--- a/conf_files/atoll/media_profiles.xml
+++ b/conf_files/atoll/media_profiles.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012-2019 The Linux Foundation. All rights reserved.
+<!-- Copyright (C) 2012-2019, 2021 The Linux Foundation. All rights reserved.
      Not a contribution.
      Copyright (C) 2010 The Android Open Source Project
 
@@ -186,32 +186,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="qhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
-    <EncoderProfile quality="2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
     <EncoderProfile quality="4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
@@ -391,34 +365,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="timelapseqhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-
-      <!-- audio setting is ignored -->
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
-    <EncoderProfile quality="timelapse2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-
-      <!-- audio setting is ignored -->
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
     <EncoderProfile quality="timelapse4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
@@ -545,28 +491,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="qhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-    <EncoderProfile quality="2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
     <EncoderProfile quality="4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
@@ -741,28 +665,6 @@
              sampleRate="48000"
              channels="2" />
     </EncoderProfile>
-    <EncoderProfile quality="timelapseqhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-    <EncoderProfile quality="timelapse2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
     <EncoderProfile quality="timelapse4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
@@ -887,32 +789,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="qhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
-    <EncoderProfile quality="2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
     <EncoderProfile quality="qcif" fileFormat="3gp" duration="30">
       <Video codec="h264"
              bitRate="192000"
@@ -1066,34 +942,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="timelapseqhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-
-      <!-- audio setting is ignored -->
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
-    <EncoderProfile quality="timelapse2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-
-      <!-- audio setting is ignored -->
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
         <ImageEncoding quality="95" />
         <ImageEncoding quality="80" />
         <ImageEncoding quality="70" />
@@ -1194,32 +1042,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="qhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
-    <EncoderProfile quality="2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
     <EncoderProfile quality="4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
@@ -1399,34 +1221,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="timelapseqhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-
-      <!-- audio setting is ignored -->
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
-    <EncoderProfile quality="timelapse2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-
-      <!-- audio setting is ignored -->
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
     <EncoderProfile quality="timelapse4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
diff --git a/conf_files/msmnile/c2_manifest.xml b/conf_files/msmnile/c2_manifest.xml
index 34730f3..139aca9 100644
--- a/conf_files/msmnile/c2_manifest.xml
+++ b/conf_files/msmnile/c2_manifest.xml
@@ -25,7 +25,7 @@
 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 -->
-<manifest version="1.0" type="device" target-level="4">
+<manifest version="1.0" type="device">
     <!-- Codec2 HAl service -->
     <hal format="hidl">
         <name>android.hardware.media.c2</name>
diff --git a/conf_files/msmnile/c2_manifest_vendor.xml b/conf_files/msmnile/c2_manifest_vendor.xml
index db550cd..bac0865 100644
--- a/conf_files/msmnile/c2_manifest_vendor.xml
+++ b/conf_files/msmnile/c2_manifest_vendor.xml
@@ -25,7 +25,7 @@
 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 -->
-<manifest version="1.0" type="device" target-level="4">
+<manifest version="1.0" type="device">
     <!-- Codec2 HAl service -->
     <hal format="hidl">
         <name>android.hardware.media.c2</name>
diff --git a/conf_files/msmnile/media_codecs.xml b/conf_files/msmnile/media_codecs.xml
index aadbb71..18c43f6 100644
--- a/conf_files/msmnile/media_codecs.xml
+++ b/conf_files/msmnile/media_codecs.xml
@@ -110,7 +110,6 @@
  |             | 4096    2304    60      220     2211840             |
  |             | 7680    4320    30      220     3888000             |
  |             | 8192    4320    24      220     3317760             |
- | vc1         | 1920    1088    30      20      244800      244800  |
  | h263-sw     | 864     480     30      16       48600       48600  |
  | mpeg2       | 1920    1088    30      40      244800      244800  |
  |_____________|_____________________________________________________|
@@ -437,19 +436,6 @@
              <Limit name="concurrent-instances" max="16" />
              <Limit name="performance-point-1920x1080" value="30" />
         </MediaCodec>
-        <MediaCodec name="OMX.qti.video.decoder.vc1sw" type="video/x-ms-wmv" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="1920x1088" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="244800" />
-            <Limit name="bitrate" range="1-20000000" />
-            <Limit name="frame-rate" range="1-30" />
-            <Feature name="adaptive-playback" />
-            <Limit name="concurrent-instances" max="16" />
-            <Limit name="performance-point-1920x1080" value="30" />
-        </MediaCodec>
         <MediaCodec name="OMX.google.opus.decoder" type="audio/opus" update="true" rank="100"/>
     </Decoders>
     <Include href="media_codecs_google_video.xml" />
diff --git a/conf_files/msmnile/media_codecs_vendor_audio.xml b/conf_files/msmnile/media_codecs_vendor_audio.xml
index 0cd3294..2749bc6 100644
--- a/conf_files/msmnile/media_codecs_vendor_audio.xml
+++ b/conf_files/msmnile/media_codecs_vendor_audio.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" ?>
-<!-- Copyright (C) 2015-2019 The Linux Foundation. All rights reserved.
+<!-- Copyright (C) 2015-2020 The Linux Foundation. All rights reserved.
      Not a contribution.
      Copyright (C) 2012 The Android Open Source Project
 
@@ -19,8 +19,5 @@
     <Decoders>
         <MediaCodec name="OMX.google.opus.decoder" type="audio/opus" update="true" rank="100"/>
         <!-- SimpleOMXComponet based software decoder-->
-        <MediaCodec name="OMX.qti.audio.decoder.flac" type="audio/flac" rank="0">
-            <Limit name="concurrent-instances" max="10" />
-        </MediaCodec>
     </Decoders>
 </Included>
diff --git a/conf_files/msmnile/media_profiles.xml b/conf_files/msmnile/media_profiles.xml
index 8afb30b..1d7d584 100644
--- a/conf_files/msmnile/media_profiles.xml
+++ b/conf_files/msmnile/media_profiles.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012-2017 The Linux Foundation. All rights reserved.
+<!-- Copyright (C) 2012-2017, 2021 The Linux Foundation. All rights reserved.
      Not a contribution.
      Copyright (C) 2010 The Android Open Source Project
 
@@ -186,32 +186,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="qhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
-    <EncoderProfile quality="2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
     <EncoderProfile quality="4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
@@ -391,34 +365,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="timelapseqhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-
-      <!-- audio setting is ignored -->
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
-    <EncoderProfile quality="timelapse2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-
-      <!-- audio setting is ignored -->
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
     <EncoderProfile quality="timelapse4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
@@ -545,32 +491,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="qhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
-    <EncoderProfile quality="2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
     <EncoderProfile quality="4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
@@ -750,34 +670,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="timelapseqhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-
-      <!-- audio setting is ignored -->
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
-    <EncoderProfile quality="timelapse2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-
-      <!-- audio setting is ignored -->
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
     <EncoderProfile quality="timelapse4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
@@ -904,32 +796,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="qhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
-    <EncoderProfile quality="2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
     <EncoderProfile quality="4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
@@ -1109,34 +975,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="timelapseqhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-
-      <!-- audio setting is ignored -->
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
-    <EncoderProfile quality="timelapse2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-
-      <!-- audio setting is ignored -->
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
     <EncoderProfile quality="timelapse4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
@@ -1318,32 +1156,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="qhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
-    <EncoderProfile quality="2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
     <EncoderProfile quality="4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
@@ -1523,34 +1335,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="timelapseqhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-
-      <!-- audio setting is ignored -->
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
-    <EncoderProfile quality="timelapse2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-
-      <!-- audio setting is ignored -->
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
     <EncoderProfile quality="timelapse4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
diff --git a/conf_files/msmnile/msmnile.mk b/conf_files/msmnile/msmnile.mk
index 5e24709..b8fca8c 100644
--- a/conf_files/msmnile/msmnile.mk
+++ b/conf_files/msmnile/msmnile.mk
@@ -29,14 +29,19 @@
     PRODUCT_COPY_FILES += \
       device/qcom/common/media/media_profiles.xml:$(TARGET_COPY_OUT_ODM)/etc/media_profiles_V1_0.xml \
       device/qcom/common/media/media_profiles.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_vendor.xml
-else
-    $(warning "Enabling codec2.0 SW only for non-generic odm build variant")
+
+else ifneq ($(TARGET_FWK_SUPPORTS_AV_VALUEADDS),false)
+    $(warning "Enabling codec2.0 non-audio SW only for non-generic odm build variant")
     DEVICE_MANIFEST_FILE += hardware/qcom/media/conf_files/msmnile/c2_manifest.xml
-    #Rank OMX SW codecs lower than OMX HW codecs
-    PRODUCT_PROPERTY_OVERRIDES += debug.stagefright.omx_default_rank.sw-audio=1
     PRODUCT_PROPERTY_OVERRIDES += debug.stagefright.omx_default_rank=0
-    PRODUCT_PROPERTY_OVERRIDES += media.settings.xml=/vendor/etc/media_profiles_vendor.xml
     PRODUCT_COPY_FILES += \
-      $(CONFIG_PATH)/media_profiles.xml:$(TARGET_COPY_OUT_ODM)/etc/media_profiles_V1_0.xml \
+      device/qcom/common/media/media_profiles.xml:$(TARGET_COPY_OUT_ODM)/etc/media_profiles_V1_0.xml \
       $(CONFIG_PATH)/media_profiles.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_vendor.xml
+
+else
+    $(warning "Compiling without value-added features")
+    DEVICE_MANIFEST_FILE += hardware/qcom/media/conf_files/msmnile/c2_manifest.xml
+    PRODUCT_COPY_FILES += \
+      device/qcom/common/media/media_profiles.xml:$(TARGET_COPY_OUT_ODM)/etc/media_profiles_V1_0.xml \
+      device/qcom/common/media/media_profiles.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_vendor.xml
 endif
diff --git a/conf_files/sm6150/media_codecs.xml b/conf_files/sm6150/media_codecs.xml
index 4ba2b13..705075d 100644
--- a/conf_files/sm6150/media_codecs.xml
+++ b/conf_files/sm6150/media_codecs.xml
@@ -82,14 +82,14 @@
 
 <!--
  SM6150 Non-Secure decoder capabilities
- _________________________________________________________
- | Codec       | W       H       fps     Mbps    MB/s    |
+ ________________________________________________________
+ | Codec       | W       H       fps     Mbps     MB/s   |
  |_____________|_________________________________________|
- | h264        | 4096    2160    24      100      829440 |
- | hevc        | 4096    2160    24      100      829440 |
+ | h264        | 3840    2160    30      100      972000 |
+ | hevc        | 3840    2160    30      100      972000 |
  | mpeg4-sw    | 1920    1088    30      40       244800 |
  | vp8         | 1920    1088    60      100      489600 |
- | vp9         | 4096    2160    24      100      829440 |
+ | vp9         | 3840    2160    30      100      972000 |
  | vc1         | 1920    1088    30      20       244800 |
  | h263-sw     | 864     480     30      16        48600 |
  | mpeg2       | 1920    1088    30      40       244800 |
@@ -99,18 +99,18 @@
  ______________________________________________________
  | Codec    | W       H       fps     Mbps    MB/s    |
  |__________|_________________________________________|
- | h264     | 3840    2160    30      35       972000 |
- | vp9      | 3840    2160    30      35       972000 |
- | hevc     | 3840    2160    30      35       972000 |
- | mpeg2    | 1920    1088    30      35       244800 |
+ | h264     | 3840    2160    30      40       972000 |
+ | vp9      | 3840    2160    30      40       972000 |
+ | hevc     | 3840    2160    30      40       972000 |
+ | mpeg2    | 1920    1088    30      40       244800 |
  |__________|_________________________________________|
 
  SM6150 Non-Secure encoder capabilities (Secure not supported)
  ______________________________________________________
  | Codec    | W       H       fps     Mbps    MB/s    |
  |__________|_________________________________________|
- | h264     | 4096    2160    24      100     829440  |
- | hevc     | 4096    2160    24      100     829440  |
+ | h264     | 3840    2160    30      100     972000  |
+ | hevc     | 3840    2160    30      100     972000  |
  | mpeg4-sw | 1280     720    30      4       108000  |
  | vp8      | 1920    1088    60      40      489600  |
  | h263-sw  | 864     480     30      2       48600   |
@@ -132,7 +132,7 @@
             <Limit name="size" min="96x96" max="4096x2160" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="24" max="979200" />
+            <Limit name="blocks-per-second" min="24" max="972000" />
             <Limit name="bitrate" range="1-100000000" />
             <Limit name="frame-rate" range="1-240" />
             <Limit name="concurrent-instances" max="16" />
@@ -152,7 +152,7 @@
             <Limit name="bitrate" range="1-40000000" />
             <Limit name="frame-rate" range="1-120" />
             <Limit name="concurrent-instances" max="16" />
-            <Limit name="performance-point-3840x2160" value="30" />
+            <Limit name="performance-point-1920x1088" value="60" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.encoder.hevc" type="video/hevc" >
             <Quirk name="requires-allocate-on-input-ports" />
@@ -161,7 +161,7 @@
             <Limit name="size" min="96x96" max="4096x2160" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="24" max="979200" />
+            <Limit name="blocks-per-second" min="24" max="972000" />
             <Limit name="bitrate" range="1-100000000" />
             <Limit name="frame-rate" range="1-240" />
             <Limit name="concurrent-instances" max="16" />
@@ -170,6 +170,18 @@
             <Limit name="performance-point-1920x1080" value="120" />
             <Limit name="performance-point-1280x720" value="240" />
         </MediaCodec>
+        <MediaCodec name="OMX.qcom.video.encoder.hevc.cq" type="video/hevc" >
+            <Quirk name="requires-allocate-on-input-ports" />
+            <Quirk name="requires-allocate-on-input-ports" />
+            <Quirk name="requires-allocate-on-output-ports" />
+            <Quirk name="requires-loaded-to-idle-after-allocation" />
+            <Limit name="size" min="512x512" max="512x512" />
+            <Limit name="frame-rate" range="1-20" />
+            <Limit name="concurrent-instances" max="16" />
+            <Limit name="quality" range="0-100" default="80" />
+            <Limit name="performance-point-512x512" value="480" />
+            <Feature name="bitrate-modes" value="CQ" />
+        </MediaCodec>
         <!-- Video Software -->
         <MediaCodec name="OMX.qcom.video.encoder.h263sw" type="video/3gpp" >
             <Quirk name="requires-allocate-on-input-ports" />
@@ -206,7 +218,7 @@
             <Limit name="size" min="96x96" max="4096x2160" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="24" max="979200" />
+            <Limit name="blocks-per-second" min="24" max="972000" />
             <Limit name="bitrate" range="1-100000000" />
             <Limit name="frame-rate" range="1-240" />
             <Feature name="adaptive-playback" />
@@ -219,12 +231,12 @@
         <MediaCodec name="OMX.qcom.video.decoder.avc.secure" type="video/avc" >
             <Quirk name="requires-allocate-on-input-ports" />
             <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="3840x2160" />
+            <Limit name="size" min="96x96" max="4096x2160" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
             <Limit name="blocks-per-second" min="24" max="972000" />
-            <Limit name="bitrate" range="1-35000000" />
-            <Limit name="frame-rate" range="1-30" />
+            <Limit name="bitrate" range="1-40000000" />
+            <Limit name="frame-rate" range="1-60" />
             <Feature name="adaptive-playback" />
             <Feature name="secure-playback" required="true" />
             <Limit name="concurrent-instances" max="3" />
@@ -250,7 +262,7 @@
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
             <Limit name="blocks-per-second" min="24" max="244800" />
-            <Limit name="bitrate" range="1-35000000" />
+            <Limit name="bitrate" range="1-40000000" />
             <Limit name="frame-rate" range="1-30" />
             <Feature name="adaptive-playback" />
             <Feature name="secure-playback" required="true" />
@@ -268,7 +280,6 @@
             <Limit name="frame-rate" range="1-120" />
             <Feature name="adaptive-playback" />
             <Limit name="concurrent-instances" max="16" />
-            <Limit name="performance-point-3840x2160" value="30" />
             <Limit name="performance-point-1920x1080" value="60" />
             <Limit name="performance-point-1280x720" value="120" />
         </MediaCodec>
@@ -278,8 +289,8 @@
             <Limit name="size" min="96x96" max="4096x2160" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="24" max="979200" />
-            <Limit name="bitrate" range="1-120000000" />
+            <Limit name="blocks-per-second" min="24" max="972000" />
+            <Limit name="bitrate" range="1-100000000" />
             <Limit name="frame-rate" range="1-240" />
             <Feature name="adaptive-playback" />
             <Limit name="concurrent-instances" max="6" />
@@ -291,12 +302,12 @@
         <MediaCodec name="OMX.qcom.video.decoder.vp9.secure" type="video/x-vnd.on2.vp9" >
             <Quirk name="requires-allocate-on-input-ports" />
             <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="3840x2160" />
+            <Limit name="size" min="96x96" max="4096x2160" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
             <Limit name="blocks-per-second" min="24" max="972000" />
-            <Limit name="bitrate" range="1-35000000" />
-            <Limit name="frame-rate" range="1-30" />
+            <Limit name="bitrate" range="1-40000000" />
+            <Limit name="frame-rate" range="1-60" />
             <Feature name="adaptive-playback" />
             <Feature name="secure-playback" required="true" />
             <Limit name="concurrent-instances" max="3" />
@@ -308,7 +319,7 @@
             <Limit name="size" min="96x96" max="4096x2160" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="24" max="979200" />
+            <Limit name="blocks-per-second" min="24" max="972000" />
             <Limit name="bitrate" range="1-100000000" />
             <Limit name="frame-rate" range="1-240" />
             <Feature name="adaptive-playback" />
@@ -321,12 +332,12 @@
         <MediaCodec name="OMX.qcom.video.decoder.hevc.secure" type="video/hevc" >
             <Quirk name="requires-allocate-on-input-ports" />
             <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="3840x2160" />
+            <Limit name="size" min="96x96" max="4096x2160" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
             <Limit name="blocks-per-second" min="24" max="972000" />
-            <Limit name="bitrate" range="1-35000000" />
-            <Limit name="frame-rate" range="1-30" />
+            <Limit name="bitrate" range="1-40000000" />
+            <Limit name="frame-rate" range="1-60" />
             <Feature name="adaptive-playback" />
             <Feature name="secure-playback" required="true" />
             <Limit name="concurrent-instances" max="3" />
diff --git a/conf_files/sm6150/media_codecs_performance.xml b/conf_files/sm6150/media_codecs_performance.xml
index 720dbb9..500457b 100644
--- a/conf_files/sm6150/media_codecs_performance.xml
+++ b/conf_files/sm6150/media_codecs_performance.xml
@@ -42,7 +42,7 @@
             <Limit name="measured-frame-rate-176x144" range="92-115" />
             <Limit name="measured-frame-rate-352x288" range="53-80" />
             <Limit name="measured-frame-rate-640x480" range="41-66" />
-            <Limit name="measured-frame-rate-1280x720" range="32-39" />
+            <Limit name="measured-frame-rate-1280x720" range="10-12" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.encoder.vp8" type="video/x-vnd.on2.vp8" update="true">
             <Limit name="measured-frame-rate-320x180" range="266-266" />
@@ -50,6 +50,12 @@
             <Limit name="measured-frame-rate-1280x720" range="74-92" />
             <Limit name="measured-frame-rate-1920x1080" range="16-40" />
         </MediaCodec>
+        <MediaCodec name="c2.qti.avc.encoder" type="video/avc" update="true">
+            <Limit name="measured-frame-rate-320x240" range="106-234" />
+            <Limit name="measured-frame-rate-720x480" range="64-140" />
+            <Limit name="measured-frame-rate-1280x720" range="26-56" />
+            <Limit name="measured-frame-rate-1920x1080" range="20-44" />
+        </MediaCodec>
         <MediaCodec name="OMX.google.h264.encoder" type="video/avc" update="true">
             <Limit name="measured-frame-rate-320x240" range="215-215" />
             <Limit name="measured-frame-rate-720x480" range="100-100" />
@@ -123,8 +129,14 @@
             <Limit name="measured-frame-rate-320x240" range="377-377" />
             <Limit name="measured-frame-rate-640x360" range="323-323" />
             <Limit name="measured-frame-rate-1280x720" range="262-262" />
-            <Limit name="measured-frame-rate-1920x1080" range="220-220" />
-            <Limit name="measured-frame-rate-3840x2160" range="51-51" />
+            <Limit name="measured-frame-rate-1920x1080" range="77-81" />
+            <Limit name="measured-frame-rate-3840x2160" range="18-19" />
+        </MediaCodec>
+        <MediaCodec name="c2.qti.avc.decoder" type="video/avc" update="true">
+            <Limit name="measured-frame-rate-320x240" range="220-630" />
+            <Limit name="measured-frame-rate-720x480" range="250-513" />
+            <Limit name="measured-frame-rate-1280x720" range="200-420" />
+            <Limit name="measured-frame-rate-1920x1088" range="189-301" />
         </MediaCodec>
         <MediaCodec name="OMX.google.h264.decoder" type="video/avc" update="true">
             <Limit name="measured-frame-rate-320x240" range="122-122" />
diff --git a/conf_files/sm6150/media_codecs_performance_sdmmagpie_v0.xml b/conf_files/sm6150/media_codecs_performance_sdmmagpie_v0.xml
index 35ee5ae..8612ad9 100644
--- a/conf_files/sm6150/media_codecs_performance_sdmmagpie_v0.xml
+++ b/conf_files/sm6150/media_codecs_performance_sdmmagpie_v0.xml
@@ -50,6 +50,12 @@
             <Limit name="measured-frame-rate-1280x720" range="57-83" />
             <Limit name="measured-frame-rate-1920x1080" range="16-40" />
         </MediaCodec>
+        <MediaCodec name="c2.qti.avc.encoder" type="video/avc" update="true">
+            <Limit name="measured-frame-rate-320x240" range="106-234" />
+            <Limit name="measured-frame-rate-720x480" range="64-140" />
+            <Limit name="measured-frame-rate-1280x720" range="26-56" />
+            <Limit name="measured-frame-rate-1920x1080" range="20-44" />
+        </MediaCodec>
         <MediaCodec name="OMX.google.h264.encoder" type="video/avc" update="true">
             <Limit name="measured-frame-rate-320x240" range="215-215" />
             <Limit name="measured-frame-rate-720x480" range="100-100" />
@@ -126,6 +132,12 @@
             <Limit name="measured-frame-rate-1920x1080" range="220-220" />
             <Limit name="measured-frame-rate-3840x2160" range="51-51" />
         </MediaCodec>
+        <MediaCodec name="c2.qti.avc.decoder" type="video/avc" update="true">
+            <Limit name="measured-frame-rate-320x240" range="220-630" />
+            <Limit name="measured-frame-rate-720x480" range="250-513" />
+            <Limit name="measured-frame-rate-1280x720" range="200-420" />
+            <Limit name="measured-frame-rate-1920x1088" range="189-301" />
+        </MediaCodec>
         <MediaCodec name="OMX.google.h264.decoder" type="video/avc" update="true">
             <Limit name="measured-frame-rate-320x240" range="270-310" />
             <Limit name="measured-frame-rate-720x480" range="68-68" />
diff --git a/conf_files/sm6150/media_codecs_performance_sdmmagpie_v1.xml b/conf_files/sm6150/media_codecs_performance_sdmmagpie_v1.xml
index 44c6e22..16ccc5e 100644
--- a/conf_files/sm6150/media_codecs_performance_sdmmagpie_v1.xml
+++ b/conf_files/sm6150/media_codecs_performance_sdmmagpie_v1.xml
@@ -50,6 +50,12 @@
             <Limit name="measured-frame-rate-1280x720" range="57-83" />
             <Limit name="measured-frame-rate-1920x1080" range="16-40" />
         </MediaCodec>
+        <MediaCodec name="c2.qti.avc.encoder" type="video/avc" update="true">
+            <Limit name="measured-frame-rate-320x240" range="106-234" />
+            <Limit name="measured-frame-rate-720x480" range="64-140" />
+            <Limit name="measured-frame-rate-1280x720" range="26-56" />
+            <Limit name="measured-frame-rate-1920x1080" range="20-44" />
+        </MediaCodec>
         <MediaCodec name="OMX.google.h264.encoder" type="video/avc" update="true">
             <Limit name="measured-frame-rate-320x240" range="215-215" />
             <Limit name="measured-frame-rate-720x480" range="100-100" />
@@ -126,6 +132,12 @@
             <Limit name="measured-frame-rate-1920x1080" range="220-220" />
             <Limit name="measured-frame-rate-3840x2160" range="51-51" />
         </MediaCodec>
+        <MediaCodec name="c2.qti.avc.decoder" type="video/avc" update="true">
+            <Limit name="measured-frame-rate-320x240" range="220-630" />
+            <Limit name="measured-frame-rate-720x480" range="250-513" />
+            <Limit name="measured-frame-rate-1280x720" range="200-420" />
+            <Limit name="measured-frame-rate-1920x1088" range="189-301" />
+        </MediaCodec>
         <MediaCodec name="OMX.google.h264.decoder" type="video/avc" update="true">
             <Limit name="measured-frame-rate-320x240" range="270-310" />
             <Limit name="measured-frame-rate-720x480" range="68-68" />
diff --git a/conf_files/sm6150/media_codecs_sdmmagpie_v1.xml b/conf_files/sm6150/media_codecs_sdmmagpie_v1.xml
index cf99e49..53499ba 100644
--- a/conf_files/sm6150/media_codecs_sdmmagpie_v1.xml
+++ b/conf_files/sm6150/media_codecs_sdmmagpie_v1.xml
@@ -87,12 +87,11 @@
  _________________________________________________________
  | Codec       | W       H       fps     Mbps    MB/s    |
  |_____________|_________________________________________|
- | h264        | 4096    2160    30      100     1036800 |
- | hevc        | 4096    2160    30      100     1036800 |
+ | h264        | 3840    2160    30      100     972000  |
+ | hevc        | 3840    2160    30      100     972000  |
  | mpeg4-sw    | 1920    1088    30      40      244800  |
  | vp8         | 1920    1088    60      100     489600  |
- | vp9         | 4096    2160    30      100     1036800 |
- |             | (4096)  (2304)  (30)    (120)           |
+ | vp9         | 3840    2160    30      100     972000  |
  | vc1         | 1920    1088    30      20      244800  |
  | h263-sw     | 864     480     30      16       48600  |
  | mpeg2       | 1920    1088    30      40      244800  |
@@ -102,9 +101,9 @@
  ______________________________________________________
  | Codec    | W       H       fps     Mbps    MB/s    |
  |__________|_________________________________________|
- | h264     | 4096    2160    30      40      1036800 |
- | vp9      | 4096    2160    30      40      1036800 |
- | hevc     | 4096    2160    30      40      1036800 |
+ | h264     | 3840    2160    30      40      972000  |
+ | vp9      | 3840    2160    30      40      972000  |
+ | hevc     | 3840    2160    30      40      972000  |
  | mpeg2    | 1920    1088    30      40      244800  |
  |__________|_________________________________________|
 
@@ -112,8 +111,8 @@
  ______________________________________________________
  | Codec    | W       H       fps     Mbps    MB/s    |
  |__________|_________________________________________|
- | h264     | 4096    2160    30      100     1036800 |
- | hevc     | 4096    2160    30      100     1036800 |
+ | h264     | 3840    2160    30      100     972000  |
+ | hevc     | 3840    2160    30      100     972000  |
  | mpeg4-sw | 1280     720    30      4       108000  |
  | vp8      | 1920    1088    60      40      489600  |
  | h263-sw  | 864     480     30      2       48600   |
@@ -135,7 +134,7 @@
             <Limit name="size" min="96x96" max="4096x2160" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="24" max="1036800" />
+            <Limit name="blocks-per-second" min="24" max="972000" />
             <Limit name="bitrate" range="1-100000000" />
             <Limit name="frame-rate" range="1-240" />
             <Limit name="concurrent-instances" max="16" />
@@ -159,7 +158,7 @@
             <Limit name="size" min="96x96" max="4096x2160" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="24" max="1036800" />
+            <Limit name="blocks-per-second" min="24" max="972000" />
             <Limit name="bitrate" range="1-100000000" />
             <Limit name="frame-rate" range="1-240" />
             <Limit name="concurrent-instances" max="16" />
@@ -200,7 +199,7 @@
             <Limit name="size" min="96x96" max="4096x2160" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="24" max="1036800" />
+            <Limit name="blocks-per-second" min="24" max="972000" />
             <Limit name="bitrate" range="1-100000000" />
             <Limit name="frame-rate" range="1-240" />
             <Feature name="adaptive-playback" />
@@ -212,7 +211,7 @@
             <Limit name="size" min="96x96" max="4096x2160" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="24" max="1036800" />
+            <Limit name="blocks-per-second" min="24" max="972000" />
             <Limit name="bitrate" range="1-40000000" />
             <Limit name="frame-rate" range="1-60" />
             <Feature name="adaptive-playback" />
@@ -262,7 +261,7 @@
             <Limit name="size" min="96x96" max="4096x2160" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="24" max="1036800" />
+            <Limit name="blocks-per-second" min="24" max="972000" />
             <Limit name="bitrate" range="1-100000000" />
             <Limit name="frame-rate" range="1-240" />
             <Feature name="adaptive-playback" />
@@ -274,7 +273,7 @@
             <Limit name="size" min="96x96" max="4096x2160" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="24" max="1036800" />
+            <Limit name="blocks-per-second" min="24" max="972000" />
             <Limit name="bitrate" range="1-40000000" />
             <Limit name="frame-rate" range="1-60" />
             <Feature name="adaptive-playback" />
@@ -287,7 +286,7 @@
             <Limit name="size" min="96x96" max="4096x2160" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="24" max="1036800" />
+            <Limit name="blocks-per-second" min="24" max="972000" />
             <Limit name="bitrate" range="1-100000000" />
             <Limit name="frame-rate" range="1-240" />
             <Feature name="adaptive-playback" />
@@ -299,7 +298,7 @@
             <Limit name="size" min="96x96" max="4096x2160" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="24" max="1036800" />
+            <Limit name="blocks-per-second" min="24" max="972000" />
             <Limit name="bitrate" range="1-40000000" />
             <Limit name="frame-rate" range="1-60" />
             <Feature name="adaptive-playback" />
diff --git a/conf_files/sm6150/media_codecs_vendor_audio.xml b/conf_files/sm6150/media_codecs_vendor_audio.xml
index 0cd3294..2749bc6 100644
--- a/conf_files/sm6150/media_codecs_vendor_audio.xml
+++ b/conf_files/sm6150/media_codecs_vendor_audio.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" ?>
-<!-- Copyright (C) 2015-2019 The Linux Foundation. All rights reserved.
+<!-- Copyright (C) 2015-2020 The Linux Foundation. All rights reserved.
      Not a contribution.
      Copyright (C) 2012 The Android Open Source Project
 
@@ -19,8 +19,5 @@
     <Decoders>
         <MediaCodec name="OMX.google.opus.decoder" type="audio/opus" update="true" rank="100"/>
         <!-- SimpleOMXComponet based software decoder-->
-        <MediaCodec name="OMX.qti.audio.decoder.flac" type="audio/flac" rank="0">
-            <Limit name="concurrent-instances" max="10" />
-        </MediaCodec>
     </Decoders>
 </Included>
diff --git a/conf_files/sm6150/media_codecs_vendor_sdmmagpie_v1.xml b/conf_files/sm6150/media_codecs_vendor_sdmmagpie_v1.xml
index e20dfec..f10f1eb 100644
--- a/conf_files/sm6150/media_codecs_vendor_sdmmagpie_v1.xml
+++ b/conf_files/sm6150/media_codecs_vendor_sdmmagpie_v1.xml
@@ -87,12 +87,11 @@
  _________________________________________________________
  | Codec       | W       H       fps     Mbps    MB/s    |
  |_____________|_________________________________________|
- | h264        | 4096    2160    30      100     1036800 |
- | hevc        | 4096    2160    30      100     1036800 |
+ | h264        | 3840    2160    30      100     972000  |
+ | hevc        | 3840    2160    30      100     972000  |
  | mpeg4-sw    | 1920    1088    30      40      244800  |
  | vp8         | 1920    1088    60      100     489600  |
- | vp9         | 4096    2160    30      100     1036800 |
- |             | (4096)  (2304)  (30)    (120)           |
+ | vp9         | 3840    2160    30      100     972000  |
  | vc1         | 1920    1088    30      20      244800  |
  | h263-sw     | 864     480     30      16       48600  |
  | mpeg2       | 1920    1088    30      40      244800  |
@@ -102,9 +101,9 @@
  ______________________________________________________
  | Codec    | W       H       fps     Mbps    MB/s    |
  |__________|_________________________________________|
- | h264     | 4096    2160    30      40      1036800 |
- | vp9      | 4096    2160    30      40      1036800 |
- | hevc     | 4096    2160    30      40      1036800 |
+ | h264     | 3840    2160    30      40      972000  |
+ | vp9      | 3840    2160    30      40      972000  |
+ | hevc     | 3840    2160    30      40      972000  |
  | mpeg2    | 1920    1088    30      40      244800  |
  |__________|_________________________________________|
 
@@ -112,8 +111,8 @@
  ______________________________________________________
  | Codec    | W       H       fps     Mbps    MB/s    |
  |__________|_________________________________________|
- | h264     | 4096    2160    30      100     1036800 |
- | hevc     | 4096    2160    30      100     1036800 |
+ | h264     | 3840    2160    30      100     972000  |
+ | hevc     | 3840    2160    30      100     972000  |
  | mpeg4-sw | 1280     720    30      4       108000  |
  | vp8      | 1920    1088    60      40      489600  |
  | h263-sw  | 864     480     30      2       48600   |
@@ -136,7 +135,7 @@
             <Limit name="size" min="96x96" max="4096x2160" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="24" max="1036800" />
+            <Limit name="blocks-per-second" min="24" max="972000" />
             <Limit name="bitrate" range="1-100000000" />
             <Limit name="frame-rate" range="1-240" />
             <Limit name="concurrent-instances" max="16" />
@@ -166,7 +165,7 @@
             <Limit name="size" min="96x96" max="4096x2160" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="24" max="1036800" />
+            <Limit name="blocks-per-second" min="24" max="972000" />
             <Limit name="bitrate" range="1-100000000" />
             <Limit name="frame-rate" range="1-240" />
             <Limit name="concurrent-instances" max="16" />
@@ -241,7 +240,7 @@
             <Limit name="size" min="96x96" max="4096x2160" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="24" max="1036800" />
+            <Limit name="blocks-per-second" min="24" max="972000" />
             <Limit name="bitrate" range="1-100000000" />
             <Limit name="frame-rate" range="1-240" />
             <Feature name="adaptive-playback" />
@@ -257,7 +256,7 @@
             <Limit name="size" min="96x96" max="4096x2160" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="24" max="1036800" />
+            <Limit name="blocks-per-second" min="24" max="972000" />
             <Limit name="bitrate" range="1-40000000" />
             <Limit name="frame-rate" range="1-60" />
             <Feature name="adaptive-playback" />
@@ -314,7 +313,7 @@
             <Limit name="size" min="96x96" max="4096x2160" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="24" max="1036800" />
+            <Limit name="blocks-per-second" min="24" max="972000" />
             <Limit name="bitrate" range="1-100000000" />
             <Limit name="frame-rate" range="1-240" />
             <Feature name="adaptive-playback" />
@@ -330,7 +329,7 @@
             <Limit name="size" min="96x96" max="4096x2160" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="24" max="1036800" />
+            <Limit name="blocks-per-second" min="24" max="972000" />
             <Limit name="bitrate" range="1-40000000" />
             <Limit name="frame-rate" range="1-60" />
             <Feature name="adaptive-playback" />
@@ -346,7 +345,7 @@
             <Limit name="size" min="96x96" max="4096x2160" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="24" max="1036800" />
+            <Limit name="blocks-per-second" min="24" max="972000" />
             <Limit name="bitrate" range="1-100000000" />
             <Limit name="frame-rate" range="1-240" />
             <Feature name="adaptive-playback" />
@@ -362,7 +361,7 @@
             <Limit name="size" min="96x96" max="4096x2160" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="24" max="1036800" />
+            <Limit name="blocks-per-second" min="24" max="972000" />
             <Limit name="bitrate" range="1-40000000" />
             <Limit name="frame-rate" range="1-60" />
             <Feature name="adaptive-playback" />
diff --git a/conf_files/sm6150/media_profiles.xml b/conf_files/sm6150/media_profiles.xml
index bdd8051..9cabc71 100644
--- a/conf_files/sm6150/media_profiles.xml
+++ b/conf_files/sm6150/media_profiles.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- Copyright (C) 2010 The Android Open Source Project
-     Copyright (C) 2012-2019 The Linux Foundation. All rights reserved.
+     Copyright (C) 2012-2019, 2021 The Linux Foundation. All rights reserved.
      Not a contribution.
 
      Licensed under the Apache License, Version 2.0 (the "License");
@@ -186,32 +186,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="qhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
-    <EncoderProfile quality="2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
     <EncoderProfile quality="4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
@@ -391,34 +365,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="timelapseqhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-
-      <!-- audio setting is ignored -->
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
-    <EncoderProfile quality="timelapse2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-
-      <!-- audio setting is ignored -->
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
     <EncoderProfile quality="timelapse4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
@@ -545,28 +491,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="qhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-    <EncoderProfile quality="2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
     <EncoderProfile quality="4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
@@ -741,28 +665,6 @@
              sampleRate="48000"
              channels="2" />
     </EncoderProfile>
-    <EncoderProfile quality="timelapseqhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-    <EncoderProfile quality="timelapse2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
     <EncoderProfile quality="timelapse4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
@@ -886,32 +788,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="qhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
-    <EncoderProfile quality="2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
     <EncoderProfile quality="4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
@@ -1091,34 +967,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="timelapseqhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-
-      <!-- audio setting is ignored -->
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
-    <EncoderProfile quality="timelapse2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-
-      <!-- audio setting is ignored -->
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
     <EncoderProfile quality="timelapse4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
@@ -1245,28 +1093,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="qhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-    <EncoderProfile quality="2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
     <EncoderProfile quality="4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
@@ -1441,28 +1267,6 @@
              sampleRate="48000"
              channels="2" />
     </EncoderProfile>
-    <EncoderProfile quality="timelapseqhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-    <EncoderProfile quality="timelapse2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
     <EncoderProfile quality="timelapse4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
@@ -1586,32 +1390,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="qhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
-    <EncoderProfile quality="2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
     <EncoderProfile quality="4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
@@ -1791,34 +1569,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="timelapseqhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-
-      <!-- audio setting is ignored -->
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
-    <EncoderProfile quality="timelapse2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-
-      <!-- audio setting is ignored -->
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
     <EncoderProfile quality="timelapse4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
@@ -1945,28 +1695,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="qhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-    <EncoderProfile quality="2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
     <EncoderProfile quality="4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
@@ -2141,28 +1869,6 @@
              sampleRate="48000"
              channels="2" />
     </EncoderProfile>
-    <EncoderProfile quality="timelapseqhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-    <EncoderProfile quality="timelapse2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
     <EncoderProfile quality="timelapse4kdci" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
diff --git a/conf_files/sm6150/sm6150.mk b/conf_files/sm6150/sm6150.mk
index 547951e..1f8af10 100644
--- a/conf_files/sm6150/sm6150.mk
+++ b/conf_files/sm6150/sm6150.mk
@@ -31,7 +31,17 @@
 
 # Vendor property overrides
 # Enable Codec2.0 HAL for pure AOSP variants.
-ifeq ($(GENERIC_ODM_IMAGE),true)
+# Enable OMX for pure AOSP AUTO variants.
+ifeq ($(GENERIC_ODM_IMAGE)$(TARGET_BOARD_AUTO),truetrue)
+  $(warning "Forcing OMX for Generic auto build variant")
+  DEVICE_MANIFEST_FILE += hardware/qcom/media/conf_files/sm6150/c2_manifest_vendor.xml
+  PRODUCT_ODM_PROPERTIES += debug.media.codec2=0
+  PRODUCT_ODM_PROPERTIES += debug.stagefright.ccodec=0
+  PRODUCT_ODM_PROPERTIES += debug.stagefright.omx_default_rank=1000
+  PRODUCT_COPY_FILES += \
+      device/qcom/common/media/media_profiles.xml:$(TARGET_COPY_OUT_ODM)/etc/media_profiles_V1_0.xml \
+      device/qcom/common/media/media_profiles.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_vendor.xml
+else ifeq ($(GENERIC_ODM_IMAGE),true)
   $(warning "Forcing codec2.0 HW for generic odm build variant")
   DEVICE_MANIFEST_FILE += hardware/qcom/media/conf_files/sm6150/c2_manifest_vendor.xml
   #Set default ranks and rank Codec 2.0 over OMX codecs
@@ -40,14 +50,18 @@
   PRODUCT_COPY_FILES += \
       device/qcom/common/media/media_profiles.xml:$(TARGET_COPY_OUT_ODM)/etc/media_profiles_V1_0.xml \
       device/qcom/common/media/media_profiles.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_vendor.xml
-else
-  $(warning "Enabling codec2.0 SW only for non-generic odm build variant")
+else ifneq ($(TARGET_FWK_SUPPORTS_AV_VALUEADDS),false)
+  $(warning "Enabling codec2.0 non-audio SW only for non-generic odm build variant")
   DEVICE_MANIFEST_FILE += hardware/qcom/media/conf_files/sm6150/c2_manifest.xml
-  #Rank OMX SW codecs lower than OMX HW codecs
-  PRODUCT_PROPERTY_OVERRIDES += debug.stagefright.omx_default_rank.sw-audio=1
   PRODUCT_PROPERTY_OVERRIDES += debug.stagefright.omx_default_rank=0
   PRODUCT_PROPERTY_OVERRIDES += media.settings.xml=/vendor/etc/media_profiles_vendor.xml
   PRODUCT_COPY_FILES += \
       device/qcom/common/media/media_profiles.xml:$(TARGET_COPY_OUT_ODM)/etc/media_profiles_V1_0.xml \
       $(CONFIG_PATH)/media_profiles.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_vendor.xml
+else
+    $(warning "Compiling without value-added features")
+    DEVICE_MANIFEST_FILE += hardware/qcom/media/conf_files/msmnile/c2_manifest.xml
+    PRODUCT_COPY_FILES += \
+      device/qcom/common/media/media_profiles.xml:$(TARGET_COPY_OUT_ODM)/etc/media_profiles_V1_0.xml \
+      device/qcom/common/media/media_profiles.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_vendor.xml
 endif
diff --git a/conf_files/trinket/media_codecs_vendor_audio.xml b/conf_files/trinket/media_codecs_vendor_audio.xml
index 0cd3294..2749bc6 100644
--- a/conf_files/trinket/media_codecs_vendor_audio.xml
+++ b/conf_files/trinket/media_codecs_vendor_audio.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" ?>
-<!-- Copyright (C) 2015-2019 The Linux Foundation. All rights reserved.
+<!-- Copyright (C) 2015-2020 The Linux Foundation. All rights reserved.
      Not a contribution.
      Copyright (C) 2012 The Android Open Source Project
 
@@ -19,8 +19,5 @@
     <Decoders>
         <MediaCodec name="OMX.google.opus.decoder" type="audio/opus" update="true" rank="100"/>
         <!-- SimpleOMXComponet based software decoder-->
-        <MediaCodec name="OMX.qti.audio.decoder.flac" type="audio/flac" rank="0">
-            <Limit name="concurrent-instances" max="10" />
-        </MediaCodec>
     </Decoders>
 </Included>
diff --git a/conf_files/trinket/media_profiles.xml b/conf_files/trinket/media_profiles.xml
index 1f10fd0..d9e7cdc 100644
--- a/conf_files/trinket/media_profiles.xml
+++ b/conf_files/trinket/media_profiles.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- Copyright (C) 2010 The Android Open Source Project
-     Copyright (C) 2012-2018 The Linux Foundation. All rights reserved.
+     Copyright (C) 2012-2018, 2021 The Linux Foundation. All rights reserved.
      Not a contribution.
 
      Licensed under the Apache License, Version 2.0 (the "License");
@@ -186,32 +186,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="qhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
-    <EncoderProfile quality="2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
     <EncoderProfile quality="2160p" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
@@ -378,34 +352,6 @@
              channels="2" />
     </EncoderProfile>
 
-    <EncoderProfile quality="timelapseqhd" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="42000000"
-             width="2560"
-             height="1440"
-             frameRate="30" />
-
-      <!-- audio setting is ignored -->
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
-    <EncoderProfile quality="timelapse2k" fileFormat="mp4" duration="30">
-      <Video codec="h264"
-             bitRate="20000000"
-             width="2048"
-             height="1080"
-             frameRate="30" />
-
-      <!-- audio setting is ignored -->
-      <Audio codec="aac"
-             bitRate="156000"
-             sampleRate="48000"
-             channels="2" />
-    </EncoderProfile>
-
     <EncoderProfile quality="timelapse2160p" fileFormat="mp4" duration="30">
       <Video codec="h264"
             bitRate="42000000"
diff --git a/conf_files/trinket/trinket.mk b/conf_files/trinket/trinket.mk
index 73fc46c..70401e6 100644
--- a/conf_files/trinket/trinket.mk
+++ b/conf_files/trinket/trinket.mk
@@ -10,9 +10,8 @@
     $(CONFIG_PATH)/media_codecs_vendor_audio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_vendor_audio.xml \
     $(CONFIG_PATH)/media_profiles.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_vendor.xml \
     $(CONFIG_PATH)/mediacodec-seccomp.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediacodec.policy \
-    $(CONFIG_PATH)/system_properties.xml:$(TARGET_COPY_OUT_VENDOR)/etc/system_properties.xml
+    $(CONFIG_PATH)/system_properties.xml:$(TARGET_COPY_OUT_VENDOR)/etc/system_properties.xml \
+    device/qcom/common/media/media_profiles.xml:$(TARGET_COPY_OUT_ODM)/etc/media_profiles_V1_0.xml
 
 # Vendor property overrides
-    #Rank OMX SW codecs lower than OMX HW codecs
-    PRODUCT_PROPERTY_OVERRIDES += debug.stagefright.omx_default_rank.sw-audio=1
     PRODUCT_PROPERTY_OVERRIDES += debug.stagefright.omx_default_rank=0
diff --git a/mm-core/inc/OMX_IndexExt.h b/mm-core/inc/OMX_IndexExt.h
index 60e515c..837c9f1 100644
--- a/mm-core/inc/OMX_IndexExt.h
+++ b/mm-core/inc/OMX_IndexExt.h
@@ -98,6 +98,7 @@
     OMX_IndexConfigOperatingRate,                   /**< reference: OMX_PARAM_U32TYPE in Q16 format for video and in Hz for audio */
     OMX_IndexParamConsumerUsageBits,                /**< reference: OMX_PARAM_U32TYPE */
     OMX_IndexConfigLatency,                         /**< reference: OMX_PARAM_U32TYPE */
+    OMX_IndexConfigLowLatency,                      /**< reference: OMX_CONFIG_BOOLEANTYPE */
     OMX_IndexExtOtherEndUnused,
 
     /* Time configurations */
diff --git a/mm-core/src/common/qc_omx_core.c b/mm-core/src/common/qc_omx_core.c
index 341a44d..8edb731 100644
--- a/mm-core/src/common/qc_omx_core.c
+++ b/mm-core/src/common/qc_omx_core.c
@@ -44,6 +44,7 @@
 #include <string.h>
 #include <stdio.h>
 #include <pthread.h>
+#include <stdlib.h>
 
 #include "qc_omx_core.h"
 #include "omx_core_cmp.h"
@@ -56,6 +57,9 @@
 static pthread_mutex_t lock_core = PTHREAD_MUTEX_INITIALIZER;
 static int number_of_adec_nt_session;
 
+extern omx_core_cb_type component[];
+unsigned int num_components = 0;
+
 #define MAX_AUDIO_NT_SESSION 2
 
 /* ======================================================================
@@ -120,8 +124,42 @@
 OMX_API OMX_ERRORTYPE OMX_APIENTRY
 OMX_Init()
 {
+    char platform_name[PROP_VALUE_MAX] = {0};
+    char version[PROP_VALUE_MAX] = {0};
+    property_get("ro.board.platform", platform_name, "0");
+
   DEBUG_PRINT("OMXCORE API - OMX_Init \n");
-  /* Nothing to do here ; shared objects shall be loaded at the get handle method */
+
+  // Use below method to generate list of components actually supported
+  // on any given platform. Core list is considered as superset and does
+  // not determine the actual supported codecs on a particular target.
+  num_components = 0;
+  for (int i = 0; i < SIZE_OF_CORE; i++) {
+      if (!strcmp(platform_name, "sm6150")) {
+          if (!strcmp("OMX.qti.video.decoder.vc1sw", core[i].name) || !strcmp("OMX.qcom.video.encoder.heic", core[i].name)) {
+                //Talos (6150) both does not support vc1 and heic hence don't add them in list
+              if (property_get("vendor.media.target.version", version, "0") && (atoi(version) == 0))
+                  continue;
+          } else if (!strcmp("OMX.qcom.video.encoder.tme", core[i].name) || !strcmp("OMX.qcom.video.encoder.tme.secure", core[i].name))
+                    continue;
+      } else if (!strcmp(platform_name, "atoll")) {
+                //Atoll does not support vc1 and vpp hence don't add them in list
+              if (!strcmp("OMX.qti.video.decoder.vc1sw", core[i].name) || !strcmp("OMX.qti.vdec.vpp", core[i].name))
+                     continue;
+      } else if (!strcmp(platform_name, "trinket")) {
+                //Trinket does not support vc1,tme,tme-secure hence don't add them in list
+              if (!strcmp("OMX.qti.video.decoder.vc1sw", core[i].name) || !strcmp("OMX.qcom.video.encoder.tme", core[i].name) ||
+                  !strcmp("OMX.qcom.video.encoder.tme.secure", core[i].name) || !strcmp("OMX.qti.vdec.vpp", core[i].name))
+                     continue;
+      } else if (!strcmp(platform_name, "msmnile")) {
+                //Hana does not support tme,tme secure hence donot add to list
+                if (!strcmp("OMX.qcom.video.encoder.tme", core[i].name) || !strcmp("OMX.qcom.video.encoder.tme.secure", core[i].name))
+                    continue;
+      }
+
+    memcpy(&component[num_components++],
+           &core[i], sizeof(omx_core_cb_type));
+  }
   return OMX_ErrorNone;
 }
 
@@ -143,11 +181,12 @@
   int rc = -1,i=0;
   DEBUG_PRINT("before get_cmp_index **********%d\n", rc);
 
-  for(i=0; i< (int)SIZE_OF_CORE; i++)
+  for (i = 0; i < num_components; i++)
   {
-   DEBUG_PRINT("get_cmp_index: cmp_name = %s , core[i].name = %s ,count = %d \n",cmp_name,core[i].name,i);
+    DEBUG_PRINT("get_cmp_index: cmp_name = %s , core[i].name = %s ,count = %d \n",
+                cmp_name, component[i].name, i);
 
-    if(!strcmp(cmp_name, core[i].name))
+    if (!strcmp(cmp_name, component[i].name))
     {
         rc = i;
         break;
@@ -177,13 +216,13 @@
   if(NULL == inst)
      return;
 
-  for(i=0; i< SIZE_OF_CORE; i++)
+  for (i = 0; i < num_components; i++)
   {
     for(j=0; j< OMX_COMP_MAX_INST; j++)
     {
-      if(inst == core[i].inst[j])
+      if (inst == component[i].inst[j])
       {
-        core[i].inst[j] = NULL;
+        component[i].inst[j] = NULL;
         return;
       }
     }
@@ -213,11 +252,11 @@
      return rc;
 
   pthread_mutex_lock(&lock_core);
-  for(i=0; i< SIZE_OF_CORE; i++)
+  for (i = 0; i < num_components; i++)
   {
     for(j=0; j< OMX_COMP_MAX_INST; j++)
     {
-      if(inst == core[i].inst[j])
+      if (inst == component[i].inst[j])
       {
         rc = i;
         goto finish;
@@ -246,13 +285,13 @@
 {
   unsigned i=0,j=0;
   int rc = -1;
-  for(i=0; i< SIZE_OF_CORE; i++)
+  for (i = 0; i < num_components; i++)
   {
-    if(!strcmp(cmp_name, core[i].name))
+    if (!strcmp(cmp_name, component[i].name))
     {
       for(j=0; j< OMX_COMP_MAX_INST; j++)
       {
-        if(NULL == core[i].inst[j])
+        if (NULL == component[i].inst[j])
         {
           rc = j;
           DEBUG_PRINT("free handle slot exists %d\n", rc);
@@ -286,7 +325,7 @@
 
   for(i=0; i< OMX_COMP_MAX_INST; i++)
   {
-    if(core[index].inst[i])
+    if (component[index].inst[i])
     {
       rc = 0;
       DEBUG_PRINT("Library Used \n");
@@ -314,16 +353,16 @@
   unsigned i    =0,j=0;
 
   DEBUG_PRINT("get_cmp_handle \n");
-  for(i=0; i< SIZE_OF_CORE; i++)
+  for (i = 0; i < num_components; i++)
   {
-    if(!strcmp(cmp_name, core[i].name))
+    if (!strcmp(cmp_name, component[i].name))
     {
       for(j=0; j< OMX_COMP_MAX_INST; j++)
       {
-        if(core[i].inst[j])
+        if (component[i].inst[j])
         {
           DEBUG_PRINT("get_cmp_handle match\n");
-          return core[i].inst[j];
+          return component[i].inst[j];
         }
       }
     }
@@ -432,8 +471,8 @@
       // Load VPP omx component for decoder if vpp property is enabled
       const char *hwDecLib = "libOmxVdec.so";
       const char *swDecLib = "libOmxSwVdec.so";
-      if (!strncmp(core[cmp_index].so_lib_name, hwDecLib, strlen(hwDecLib)) ||
-          !strncmp(core[cmp_index].so_lib_name, swDecLib, strlen(swDecLib))) {
+      if (!strncmp(component[cmp_index].so_lib_name, hwDecLib, strlen(hwDecLib)) ||
+          !strncmp(component[cmp_index].so_lib_name, swDecLib, strlen(swDecLib))) {
         bool isVppEnabled = false;
         if (isConfigStoreEnabled()) {
           getConfigStoreBool("vpp", "enable", &isVppEnabled, false);
@@ -457,19 +496,19 @@
       }
 
        // dynamically load the so
-      core[cmp_index].fn_ptr =
-        omx_core_load_cmp_library(core[cmp_index].so_lib_name,
-                                  &core[cmp_index].so_lib_handle);
+      component[cmp_index].fn_ptr =
+        omx_core_load_cmp_library(component[cmp_index].so_lib_name,
+                                  &component[cmp_index].so_lib_handle);
 
 
-      if(core[cmp_index].fn_ptr)
+      if(component[cmp_index].fn_ptr)
       {
         //Do not allow more than MAX limit for DSP audio decoders
-        if((!strcmp(core[cmp_index].so_lib_name,"libOmxWmaDec.so")  ||
-            !strcmp(core[cmp_index].so_lib_name,"libOmxAacDec.so")  ||
-            !strcmp(core[cmp_index].so_lib_name,"libOmxG711Dec.so")  ||
-            !strcmp(core[cmp_index].so_lib_name,"libOmxAlacDec.so") ||
-            !strcmp(core[cmp_index].so_lib_name,"libOmxApeDec.so")) &&
+        if((!strcmp(component[cmp_index].so_lib_name,"libOmxWmaDec.so")  ||
+            !strcmp(component[cmp_index].so_lib_name,"libOmxAacDec.so")  ||
+            !strcmp(component[cmp_index].so_lib_name,"libOmxG711Dec.so")  ||
+            !strcmp(component[cmp_index].so_lib_name,"libOmxAlacDec.so") ||
+            !strcmp(component[cmp_index].so_lib_name,"libOmxApeDec.so")) &&
             (number_of_adec_nt_session+1 > MAX_AUDIO_NT_SESSION)) {
             DEBUG_PRINT_ERROR("Rejecting new session..Reached max limit for DSP audio decoder session");
             pthread_mutex_unlock(&lock_core);
@@ -477,7 +516,7 @@
         }
         // Construct the component requested
         // Function returns the opaque handle
-        void* pThis = (*(core[cmp_index].fn_ptr))();
+        void* pThis = (*(component[cmp_index].fn_ptr))();
         if(pThis)
         {
           void *hComp = NULL;
@@ -503,7 +542,7 @@
 
           if(hnd_index >= 0)
           {
-            core[cmp_index].inst[hnd_index]= *handle = (OMX_HANDLETYPE) hComp;
+            component[cmp_index].inst[hnd_index]= *handle = (OMX_HANDLETYPE) hComp;
           }
           else
           {
@@ -512,11 +551,11 @@
             return OMX_ErrorInsufficientResources;
           }
           DEBUG_PRINT("Component %p Successfully created\n",*handle);
-          if(!strcmp(core[cmp_index].so_lib_name,"libOmxWmaDec.so")  ||
-             !strcmp(core[cmp_index].so_lib_name,"libOmxAacDec.so")  ||
-             !strcmp(core[cmp_index].so_lib_name,"libOmxG711Dec.so")  ||
-             !strcmp(core[cmp_index].so_lib_name,"libOmxAlacDec.so") ||
-             !strcmp(core[cmp_index].so_lib_name,"libOmxApeDec.so")) {
+          if(!strcmp(component[cmp_index].so_lib_name,"libOmxWmaDec.so")  ||
+             !strcmp(component[cmp_index].so_lib_name,"libOmxAacDec.so")  ||
+             !strcmp(component[cmp_index].so_lib_name,"libOmxG711Dec.so")  ||
+             !strcmp(component[cmp_index].so_lib_name,"libOmxAlacDec.so") ||
+             !strcmp(component[cmp_index].so_lib_name,"libOmxApeDec.so")) {
 
              number_of_adec_nt_session++;
              DEBUG_PRINT("OMX_GetHandle: number_of_adec_nt_session : %d\n",
@@ -579,24 +618,24 @@
         pthread_mutex_lock(&lock_core);
         clear_cmp_handle(hComp);
         /* Unload component library */
-    if( (i < (int)SIZE_OF_CORE) && core[i].so_lib_handle)
+    if( (i < (int)num_components) && component[i].so_lib_handle)
     {
            if(check_lib_unload(i))
            {
               DEBUG_PRINT_ERROR(" Unloading the dynamic library for %s\n",
-                                  core[i].name);
-              err = dlclose(core[i].so_lib_handle);
+                                  component[i].name);
+              err = dlclose(component[i].so_lib_handle);
               if(err)
               {
                   DEBUG_PRINT_ERROR("Error %d in dlclose of lib %s\n",
-                                     err,core[i].name);
+                                     err,component[i].name);
               }
-              core[i].so_lib_handle = NULL;
+              component[i].so_lib_handle = NULL;
            }
-           if(!strcmp(core[i].so_lib_name,"libOmxWmaDec.so")  ||
-              !strcmp(core[i].so_lib_name,"libOmxAacDec.so")  ||
-              !strcmp(core[i].so_lib_name,"libOmxAlacDec.so") ||
-              !strcmp(core[i].so_lib_name,"libOmxApeDec.so")) {
+           if(!strcmp(component[i].so_lib_name,"libOmxWmaDec.so")  ||
+              !strcmp(component[i].so_lib_name,"libOmxAacDec.so")  ||
+              !strcmp(component[i].so_lib_name,"libOmxAlacDec.so") ||
+              !strcmp(component[i].so_lib_name,"libOmxApeDec.so")) {
                if(number_of_adec_nt_session>0)
                    number_of_adec_nt_session--;
                DEBUG_PRINT_ERROR("OMX_FreeHandle: reduced number_of_adec_nt_session %d\n",
@@ -683,16 +722,17 @@
                       OMX_IN  OMX_U32            index)
 {
   OMX_ERRORTYPE eRet = OMX_ErrorNone;
-  DEBUG_PRINT("OMXCORE API - OMX_ComponentNameEnum %p %d %d\n", componentName
-                                                              ,(unsigned)nameLen
-                                                              ,(unsigned)index);
-  if((index < SIZE_OF_CORE) && strncmp(core[index].name, "OMX.QCOM.CUST.COMP.START",strlen("OMX.QCOM.CUST.COMP.START")))
+  if (index < num_components &&
+      strncmp(component[index].name, "OMX.QCOM.CUST.COMP.START",
+              strlen("OMX.QCOM.CUST.COMP.START")))
   {
     #ifdef _ANDROID_
-    strlcpy(componentName, core[index].name,nameLen);
+    strlcpy(componentName, component[index].name, nameLen);
     #else
-    strncpy(componentName, core[index].name,nameLen);
+    strlcpy(componentName, component[index].name, nameLen);
     #endif
+    DEBUG_PRINT("OMXCORE API - OMX_ComponentNameEnum [%d] %s\n",
+                (unsigned)index, componentName);
   }
   else
   {
@@ -728,25 +768,25 @@
   /*If CompNames is NULL then return*/
   if (compNames == NULL)
   {
-      if (numComps == NULL)
-      {
-          eRet = OMX_ErrorBadParameter;
-      }
-      else
-  {
-    *numComps          = 0;
-    for (i=0; i<SIZE_OF_CORE;i++)
+    if (numComps == NULL)
     {
-      for(j=0; j<OMX_CORE_MAX_CMP_ROLES && core[i].roles[j] ; j++)
+      eRet = OMX_ErrorBadParameter;
+    }
+    else
+    {
+      *numComps = 0;
+      for (i = 0; i < num_components; i++)
       {
-        if(!strcmp(role,core[i].roles[j]))
+        for (j = 0; j < OMX_CORE_MAX_CMP_ROLES && component[i].roles[j]; j++)
         {
-                  (*numComps)++;
-              }
-            }
+          if (!strcmp(role,component[i].roles[j]))
+          {
+            (*numComps)++;
           }
+        }
       }
-      return eRet;
+    }
+    return eRet;
   }
 
   if(numComps)
@@ -760,17 +800,17 @@
 
     *numComps          = 0;
 
-    for (i=0; i<SIZE_OF_CORE;i++)
+    for (i = 0; i < num_components;i++)
     {
-      for(j=0; j<OMX_CORE_MAX_CMP_ROLES && core[i].roles[j] ; j++)
+      for (j = 0; j < OMX_CORE_MAX_CMP_ROLES && component[i].roles[j]; j++)
       {
-        if(!strcmp(role,core[i].roles[j]))
-          {
-            #ifdef _ANDROID_
-            strlcpy((char *)compNames[*numComps],core[i].name, OMX_MAX_STRINGNAME_SIZE);
-            #else
-            strncpy((char *)compNames[*numComps],core[i].name, OMX_MAX_STRINGNAME_SIZE);
-            #endif
+        if (!strcmp(role,component[i].roles[j]))
+        {
+          #ifdef _ANDROID_
+          strlcpy((char *)compNames[*numComps],component[i].name, OMX_MAX_STRINGNAME_SIZE);
+          #else
+          strlcpy((char *)compNames[*numComps],component[i].name, OMX_MAX_STRINGNAME_SIZE);
+          #endif
           (*numComps)++;
           break;
         }
@@ -814,27 +854,26 @@
 
   if (roles == NULL)
   {
-      if (numRoles == NULL)
+    if (numRoles == NULL)
+    {
+      eRet = OMX_ErrorBadParameter;
+    }
+    else
+    {
+      *numRoles = 0;
+      for (i = 0; i < num_components; i++)
       {
-         eRet = OMX_ErrorBadParameter;
+        if (!strcmp(compName,component[i].name))
+        {
+          for (j = 0; j < OMX_CORE_MAX_CMP_ROLES && component[i].roles[j]; j++)
+          {
+            (*numRoles)++;
+          }
+          break;
+        }
       }
-      else
-      {
-         *numRoles = 0;
-         for(i=0; i< SIZE_OF_CORE; i++)
-         {
-           if(!strcmp(compName,core[i].name))
-           {
-             for(j=0; (j<OMX_CORE_MAX_CMP_ROLES) && core[i].roles[j];j++)
-             {
-                (*numRoles)++;
-             }
-             break;
-           }
-         }
-
-      }
-      return eRet;
+    }
+    return eRet;
   }
 
   if(numRoles)
@@ -846,18 +885,20 @@
 
     numofroles = *numRoles;
     *numRoles = 0;
-    for(i=0; i< SIZE_OF_CORE; i++)
+    for (i = 0; i < num_components; i++)
     {
-      if(!strcmp(compName,core[i].name))
+      if (!strcmp(compName, component[i].name))
       {
-        for(j=0; (j<OMX_CORE_MAX_CMP_ROLES) && core[i].roles[j];j++)
+        for (j = 0; j < OMX_CORE_MAX_CMP_ROLES && component[i].roles[j]; j++)
         {
           if(roles && roles[*numRoles])
           {
             #ifdef _ANDROID_
-            strlcpy((char *)roles[*numRoles],core[i].roles[j],OMX_MAX_STRINGNAME_SIZE);
+            strlcpy((char *)roles[*numRoles],
+                    component[i].roles[j], OMX_MAX_STRINGNAME_SIZE);
             #else
-            strncpy((char *)roles[*numRoles],core[i].roles[j],OMX_MAX_STRINGNAME_SIZE);
+            strlcpy((char *)roles[*numRoles],
+                    component[i].roles[j], OMX_MAX_STRINGNAME_SIZE);
             #endif
           }
           (*numRoles)++;
diff --git a/mm-core/src/registry_table.c b/mm-core/src/registry_table.c
index db2d7de..4b6d732 100644
--- a/mm-core/src/registry_table.c
+++ b/mm-core/src/registry_table.c
@@ -53,5 +53,6 @@
 };
 
 const unsigned int SIZE_OF_CORE = sizeof(core) / sizeof(omx_core_cb_type);
+omx_core_cb_type component[SIZE_OF_CORE];
 
 
diff --git a/mm-core/src/registry_table_android.c b/mm-core/src/registry_table_android.c
index 97da480..51c5985 100644
--- a/mm-core/src/registry_table_android.c
+++ b/mm-core/src/registry_table_android.c
@@ -56,3 +56,4 @@
     OMX_REGISTRY_ENTRY("OMX.qcom.video.encoder.heic", "libOmxVenc.so", "image_encoder.heic"),
 };
 const unsigned int SIZE_OF_CORE = sizeof(core) / sizeof(omx_core_cb_type);
+omx_core_cb_type component[SIZE_OF_CORE];
diff --git a/mm-video-v4l2/vidc/vdec/src/omx_swvdec.cpp b/mm-video-v4l2/vidc/vdec/src/omx_swvdec.cpp
index d71cc78..eb666cf 100644
--- a/mm-video-v4l2/vidc/vdec/src/omx_swvdec.cpp
+++ b/mm-video-v4l2/vidc/vdec/src/omx_swvdec.cpp
@@ -3546,7 +3546,9 @@
 
         if (m_sync_frame_decoding_mode)
         {
-            p_buffer_req->mincount = 1;
+            /* Content for which low delay is 0 for ex: XVID clips
+               minimum two buffers are required to generate thumbnail */
+            p_buffer_req->mincount = 2;
         }
 
         m_port_op.def.nBufferSize        = p_buffer_req->size;
diff --git a/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp b/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp
index a8c4dff..c7b87c2 100644
--- a/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp
+++ b/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp
@@ -145,6 +145,7 @@
 #endif
 
 #define LUMINANCE_DIV_FACTOR 10000.0
+#define LUMINANCE_MAXDISPLAY_CDM2 1000
 
 /* defined in mp-ctl.h */
 #define MPCTLV3_VIDEO_DECODE_PB_HINT 0x41C04000
@@ -1140,7 +1141,8 @@
                  capture_capability = V4L2_PIX_FMT_SDE_Y_CBCR_H2V2_P010_VENUS;
                  capability_changed = true;
             }
-        } else  if (m_progressive == MSM_VIDC_PIC_STRUCT_PROGRESSIVE) {
+        } else  if (m_progressive == MSM_VIDC_PIC_STRUCT_PROGRESSIVE &&
+                    eCompressionFormat != OMX_VIDEO_CodingMPEG2) {
             enable_split = true;
         } else {
             // Hardware does not support NV12+interlace clips.
@@ -1611,7 +1613,7 @@
                                             pThis->omx_report_error ();
                                             break;
                                         }
-#if !HDR10_SETMETADATA_ENABLE
+//#if !HDR10_SETMETADATA_ENABLE
                                         if (pThis->output_capability != V4L2_PIX_FMT_VP9 &&
                                             pThis->output_capability != V4L2_PIX_FMT_HEVC)
                                             break;
@@ -1633,7 +1635,7 @@
                                                     OMX_CORE_OUTPUT_PORT_INDEX,
                                                     OMX_QTIIndexConfigDescribeHDR10PlusInfo, NULL);
                                         }
-#endif
+//#endif
                                         break;
 
                 case OMX_COMPONENT_GENERATE_EVENT_INPUT_FLUSH:
@@ -3141,7 +3143,7 @@
                struct timespec ts;
 
                clock_gettime(CLOCK_REALTIME, &ts);
-               ts.tv_sec += 2;
+               ts.tv_sec += 1;
                DEBUG_PRINT_LOW("waiting for %d EBDs of CODEC CONFIG buffers ",
                        m_queued_codec_config_count);
                BITMASK_SET(&m_flags, OMX_COMPONENT_FLUSH_DEFERRED);
@@ -5625,6 +5627,23 @@
         VALIDATE_OMX_VENDOR_EXTENSION_PARAM_DATA(ext);
 
         return set_vendor_extension_config(ext);
+    }  else if ((int)configIndex == (int)OMX_IndexConfigLowLatency) {
+        OMX_CONFIG_BOOLEANTYPE *lowLatency = (OMX_CONFIG_BOOLEANTYPE *)configData;
+        DEBUG_PRINT_LOW("Set_config: low-latency %u",(uint32_t)lowLatency->bEnabled);
+        struct v4l2_control control;
+        control.id = V4L2_CID_MPEG_VIDC_VIDEO_LOWLATENCY_MODE;
+        if (lowLatency->bEnabled) {
+            control.value = V4L2_MPEG_MSM_VIDC_ENABLE;
+        } else {
+            control.value = V4L2_MPEG_MSM_VIDC_DISABLE;
+        }
+        if (ioctl(drv_ctx.video_driver_fd, VIDIOC_S_CTRL, &control)) {
+            DEBUG_PRINT_ERROR("Set low latency failed");
+            ret = OMX_ErrorUnsupportedSetting;
+        } else {
+            m_sParamLowLatency.bEnableLowLatencyMode = lowLatency->bEnabled;
+        }
+        return ret;
     }
 
     return OMX_ErrorNotImplemented;
@@ -8627,7 +8646,6 @@
                     is_interlaced && is_duplicate_ts_valid && !is_mbaff);
         }
     }
-
     VIDC_TRACE_INT_LOW("FBD-TS", buffer->nTimeStamp / 1000);
 
     if (m_cb.FillBufferDone) {
@@ -8991,6 +9009,11 @@
 
                if (vdec_msg->msgdata.output_frame.len <=  omxhdr->nAllocLen) {
                    omxhdr->nFilledLen = vdec_msg->msgdata.output_frame.len;
+               } else {
+                   DEBUG_PRINT_ERROR("Invalid filled length = %u, set it as buffer size = %u",
+                           (unsigned int)vdec_msg->msgdata.output_frame.len, omxhdr->nAllocLen);
+                   omxhdr->nFilledLen = omxhdr->nAllocLen;
+               }
                    omxhdr->nOffset = vdec_msg->msgdata.output_frame.offset;
                    omxhdr->nTimeStamp = vdec_msg->msgdata.output_frame.time_stamp;
                    omxhdr->nFlags = 0;
@@ -9167,12 +9190,6 @@
                                ((unsigned long)vdec_msg->msgdata.output_frame.bufferaddr +
                                 (unsigned long)vdec_msg->msgdata.output_frame.offset),
                                vdec_msg->msgdata.output_frame.len);
-               } else {
-                   DEBUG_PRINT_ERROR("Invalid filled length = %u, buffer size = %u, prev_length = %u",
-                           (unsigned int)vdec_msg->msgdata.output_frame.len,
-                           omxhdr->nAllocLen, omx->prev_n_filled_len);
-                   omxhdr->nFilledLen = 0;
-               }
 
                omx->post_event ((unsigned long)omxhdr, vdec_msg->status_code,
                         OMX_COMPONENT_GENERATE_FBD);
@@ -10370,16 +10387,14 @@
     memset(&fmt, 0x0, sizeof(struct v4l2_format));
     if (0 == portDefn->nPortIndex) {
         int ret = 0;
-        if (secure_mode) {
-            fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
-            fmt.fmt.pix_mp.pixelformat = output_capability;
-            ret = ioctl(drv_ctx.video_driver_fd, VIDIOC_G_FMT, &fmt);
-            if (ret) {
-                DEBUG_PRINT_ERROR("Get Resolution failed");
-                return OMX_ErrorHardware;
-            }
-            drv_ctx.ip_buf.buffer_size = fmt.fmt.pix_mp.plane_fmt[0].sizeimage;
+        fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+        fmt.fmt.pix_mp.pixelformat = output_capability;
+        ret = ioctl(drv_ctx.video_driver_fd, VIDIOC_G_FMT, &fmt);
+        if (ret) {
+            DEBUG_PRINT_ERROR("Get Resolution failed");
+            return OMX_ErrorHardware;
         }
+        drv_ctx.ip_buf.buffer_size = fmt.fmt.pix_mp.plane_fmt[0].sizeimage;
         portDefn->eDir =  OMX_DirInput;
         portDefn->nBufferCountActual = drv_ctx.ip_buf.actualcount;
         portDefn->nBufferCountMin    = drv_ctx.ip_buf.mincount;
@@ -10391,10 +10406,6 @@
         portDefn->format.video.xFramerate = m_fps_received;
         portDefn->bEnabled   = m_inp_bEnabled;
         portDefn->bPopulated = m_inp_bPopulated;
-
-        fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
-        fmt.fmt.pix_mp.pixelformat = output_capability;
-        ioctl(drv_ctx.video_driver_fd, VIDIOC_G_FMT, &fmt);
     } else if (1 == portDefn->nPortIndex) {
         unsigned int buf_size = 0;
         int ret = 0;
@@ -10816,6 +10827,8 @@
     switch (transfer) {
         case MSM_VIDC_TRANSFER_BT709_5:
         case MSM_VIDC_TRANSFER_601_6_525: // case MSM_VIDC_TRANSFER_601_6_625:
+        case MSM_VIDC_TRANSFER_BT_2020_10:
+        case MSM_VIDC_TRANSFER_BT_2020_12:
             aspects->mTransfer = ColorAspects::TransferSMPTE170M;
             break;
         case MSM_VIDC_TRANSFER_BT_470_6_M:
@@ -11106,10 +11119,24 @@
         (hdr_info->sType1.mW.y != mastering_display_payload->nWhitePointY);
 
     /* Maximum Display Luminance from the bitstream is in 0.0001 cd/m2 while the HDRStaticInfo extension
-       requires it in cd/m2, so dividing by 10000 and rounding the value after division
+       requires it in cd/m2, so dividing by 10000 and rounding the value after division.
+       Check if max luminance is at least 100 cd/m^2.This check is required for few bistreams where
+       max luminance is not in correct scale. Use the default max luminance value if the value from
+       the bitstream is less than 100 cd/m^2.
     */
-    uint16_t max_display_luminance_cd_m2 =
+
+    uint16_t max_display_luminance_cd_m2;
+    if ((mastering_display_payload->nMaxDisplayMasteringLuminance > 0) &&
+                        ((mastering_display_payload->nMaxDisplayMasteringLuminance / LUMINANCE_DIV_FACTOR) < 100)) {
+        max_display_luminance_cd_m2 = LUMINANCE_MAXDISPLAY_CDM2;
+        DEBUG_PRINT_HIGH("Invalid maxLuminance value from SEI [%.4f]. Using default [%u]",
+              (mastering_display_payload->nMaxDisplayMasteringLuminance / LUMINANCE_DIV_FACTOR),
+              LUMINANCE_MAXDISPLAY_CDM2);
+    } else {
+        max_display_luminance_cd_m2 =
         static_cast<int>((mastering_display_payload->nMaxDisplayMasteringLuminance / LUMINANCE_DIV_FACTOR) + 0.5);
+    }
+
     internal_disp_changed_flag |= (hdr_info->sType1.mMaxDisplayLuminance != max_display_luminance_cd_m2) ||
         (hdr_info->sType1.mMinDisplayLuminance != mastering_display_payload->nMinDisplayMasteringLuminance);
 
@@ -11209,6 +11236,9 @@
 
 void omx_vdec::get_preferred_color_aspects(ColorAspects& preferredColorAspects)
 {
+    OMX_U32 width = drv_ctx.video_resolution.frame_width;
+    OMX_U32 height = drv_ctx.video_resolution.frame_height;
+
     // For VPX, use client-color if specified.
     // For the rest, try to use the stream-color if present
     bool preferClientColor = (output_capability == V4L2_PIX_FMT_VP8 ||
@@ -11219,6 +11249,13 @@
     const ColorAspects &defaultColor = preferClientColor ?
         m_internal_color_space.sAspects : m_client_color_space.sAspects;
 
+    if ((width >= 3840 || height >= 3840 || width * (int64_t)height >= 3840 * 1634) &&
+        (m_client_color_space.sAspects.mPrimaries == ColorAspects::PrimariesBT2020) &&
+        (dpb_bit_depth == MSM_VIDC_BIT_DEPTH_8)) {
+        m_client_color_space.sAspects.mPrimaries = ColorAspects::PrimariesBT709_5;
+        m_client_color_space.sAspects.mMatrixCoeffs = ColorAspects::MatrixBT709_5;
+    }
+
     preferredColorAspects.mPrimaries = preferredColor.mPrimaries != ColorAspects::PrimariesUnspecified ?
         preferredColor.mPrimaries : defaultColor.mPrimaries;
     preferredColorAspects.mTransfer = preferredColor.mTransfer != ColorAspects::TransferUnspecified ?
@@ -11527,14 +11564,14 @@
                             (payload_len > HDR_DYNAMIC_META_DATA_SZ)) {
                             DEBUG_PRINT_ERROR("Invalid User extradata size %u for HDR10+", data->nDataSize);
                         } else {
-#if HDR10_SETMETADATA_ENABLE
+// enable setting metadata via gralloc handle
+//#if HDR10_SETMETADATA_ENABLE
                             color_mdata.dynamicMetaDataValid = true;
                             color_mdata.dynamicMetaDataLen = payload_len;
                             memcpy(color_mdata.dynamicMetaDataPayload, userdata_payload->data, payload_len);
                             DEBUG_PRINT_HIGH("Copied %u bytes of HDR10+ extradata", payload_len);
-#else
+//#endif
                             store_hevc_hdr10plusinfo(payload_len, userdata_payload);
-#endif
                         }
                     }
                     if (client_extradata & OMX_EXTNUSER_EXTRADATA) {
@@ -11602,7 +11639,8 @@
                     final_color_aspects.mMatrixCoeffs = ColorAspects::MatrixBT601_6;
                 }
                 get_preferred_hdr_info(final_hdr_info);
-#if HDR10_SETMETADATA_ENABLE
+// enable setting metadata via gralloc handle
+//#if HDR10_SETMETADATA_ENABLE
                 convert_hdr_info_to_metadata(final_hdr_info, color_mdata);
                 convert_hdr10plusinfo_to_metadata(p_buf_hdr->pMarkData, color_mdata);
                 remove_hdr10plusinfo_using_cookie(p_buf_hdr->pMarkData);
@@ -11610,7 +11648,7 @@
                 print_debug_hdr_color_info_mdata(&color_mdata);
                 print_debug_hdr10plus_metadata(color_mdata);
                 set_colormetadata_in_handle(&color_mdata, buf_index);
-#endif
+//#endif
         }
 
     }
@@ -12617,7 +12655,8 @@
         DEBUG_PRINT_LOW("Enabling C2D");
         if (dest_color_format == OMX_COLOR_FormatYUV420Planar ||
             dest_color_format == OMX_COLOR_FormatYUV420SemiPlanar ||
-            (omx->m_progressive != MSM_VIDC_PIC_STRUCT_PROGRESSIVE &&
+            ((omx->m_progressive != MSM_VIDC_PIC_STRUCT_PROGRESSIVE ||
+            omx->eCompressionFormat == OMX_VIDEO_CodingMPEG2) &&
             dest_color_format == (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m)) {
             ColorFormat = dest_color_format;
             if (dest_color_format == OMX_COLOR_FormatYUV420Planar) {
@@ -12685,6 +12724,10 @@
             } else {
                 unsigned int filledLen = 0;
                 c2dcc.getBuffFilledLen(C2D_OUTPUT, filledLen);
+                if (filledLen > omx->m_out_mem_ptr[index].nAllocLen) {
+                    DEBUG_PRINT_ERROR("Invalid C2D FBD length filledLen = %d alloclen = %d ",filledLen,omx->m_out_mem_ptr[index].nAllocLen);
+                    filledLen = 0;
+                }
                 m_out_mem_ptr_client[index].nFilledLen = filledLen;
                 omx->m_out_mem_ptr[index].nFilledLen = filledLen;
             }
@@ -12795,9 +12838,9 @@
 
 void omx_vdec::send_codec_config() {
     if (codec_config_flag) {
-        unsigned long p1 = 0; // Parameter - 1
-        unsigned long p2 = 0; // Parameter - 2
-        unsigned long ident = 0;
+        unsigned long p1 = 0, p2 = 0;
+        unsigned long p3 = 0, p4 = 0;
+        unsigned long ident = 0, ident2 = 0;
         pthread_mutex_lock(&m_lock);
         DEBUG_PRINT_LOW("\n Check Queue for codec_config buffer \n");
         while (m_etb_q.m_size) {
@@ -12815,6 +12858,21 @@
                 }
             } else if (ident == OMX_COMPONENT_GENERATE_ETB) {
                 if (((OMX_BUFFERHEADERTYPE *)p2)->nFlags & OMX_BUFFERFLAG_CODECCONFIG) {
+                    while (m_ftb_q.m_size) {
+                        m_ftb_q.pop_entry(&p3,&p4,&ident2);
+                        if (ident2 == OMX_COMPONENT_GENERATE_FTB) {
+                            pthread_mutex_unlock(&m_lock);
+                            if (fill_this_buffer_proxy((OMX_HANDLETYPE)p3,\
+                                        (OMX_BUFFERHEADERTYPE *)p4) != OMX_ErrorNone) {
+                                DEBUG_PRINT_ERROR("\n fill_this_buffer_proxy failure");
+                                omx_report_error ();
+                            }
+                            pthread_mutex_lock(&m_lock);
+                        } else if (ident2 == OMX_COMPONENT_GENERATE_FBD) {
+                            fill_buffer_done(&m_cmp,(OMX_BUFFERHEADERTYPE *)p3);
+                        }
+                    }
+                    pthread_mutex_unlock(&m_lock);
                     if (empty_this_buffer_proxy((OMX_HANDLETYPE)p1,\
                                 (OMX_BUFFERHEADERTYPE *)p2) != OMX_ErrorNone) {
                         DEBUG_PRINT_ERROR("\n empty_this_buffer_proxy failure");
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 0e5d3f3..e230d63 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
@@ -1,5 +1,5 @@
 /*--------------------------------------------------------------------------
-Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
+Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
@@ -607,6 +607,7 @@
         OMX_U32 append_extradata_roi_region_qp_info(OMX_OTHER_EXTRADATATYPE *data,
                 OMX_TICKS timestamp, OMX_U32 freeSize);
         bool mBitrateSavingsEnable;
+        bool hdr10metadata_supported;
 };
 
 enum instance_state {
diff --git a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
index 5c6c8db..67fbff3 100644
--- a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
+++ b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
@@ -3696,6 +3696,8 @@
                     m_pOutput_pmem[i].buffer = malloc(sizeof(output_metabuffer));
                     if (m_pOutput_pmem[i].buffer == NULL) {
                         DEBUG_PRINT_ERROR("%s: Failed to allocate meta buffer", __func__);
+                        native_handle_close(handle);
+                        native_handle_delete(handle);
                         return OMX_ErrorInsufficientResources;
                     }
                     (*bufferHdr)->nAllocLen = sizeof(output_metabuffer);
diff --git a/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp b/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
index e3a9056..6002f32 100644
--- a/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
+++ b/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
@@ -299,6 +299,17 @@
             DEBUG_PRINT_LOW("TME is not supported");
             eRet = OMX_ErrorInvalidComponentName;
         }
+    } else if (!strncmp((char *)m_nkind, "OMX.qcom.video.encoder.tme.secure",    \
+                OMX_MAX_STRINGNAME_SIZE)) {
+        char platform_name[PROP_VALUE_MAX] = {0};
+        char version[PROP_VALUE_MAX] = {0};
+        property_get("ro.board.platform", platform_name, "0");
+        if (!strcmp(platform_name, "atoll")) {
+            //TME is enabled on atoll
+            strlcpy((char *)m_cRole, "video_encoder.tme", OMX_MAX_STRINGNAME_SIZE);
+            codec_type =  (OMX_VIDEO_CODINGTYPE)QOMX_VIDEO_CodingTME;
+            secure_session = true;
+        }
     } else {
         DEBUG_PRINT_ERROR("ERROR: Unknown Component");
         eRet = OMX_ErrorInvalidComponentName;
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
old mode 100755
new mode 100644
index 21655a1..5e1b280
--- a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
+++ b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
@@ -1,5 +1,5 @@
 /*--------------------------------------------------------------------------
-Copyright (c) 2010-2018, The Linux Foundation. All rights reserved.
+Copyright (c) 2010-2018, 2020, The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
@@ -120,6 +120,8 @@
 #undef LOG_TAG
 #define LOG_TAG "OMX-VENC: venc_dev"
 
+#define LUMINANCE_MULTIPLICATION_FACTOR 10000
+
 //constructor
 venc_dev::venc_dev(class omx_venc *venc_class)
 {
@@ -190,6 +192,7 @@
     intra_period.num_bframes = 0;
     mIsNativeRecorder = false;
     m_hdr10meta_enabled = false;
+    hdr10metadata_supported = false;
 
     Platform::Config::getInt32(Platform::vidc_enc_log_in,
             (int32_t *)&m_debug.in_buffer_log, 0);
@@ -1655,6 +1658,14 @@
         supported_rc_modes = (RC_ALL & ~RC_CBR_CFR);
     }
 
+    if (!strcmp(m_platform_name, "sm6150") || !strcmp(m_platform_name, "atoll") || !strcmp(m_platform_name, "trinket"))
+    {
+       hdr10metadata_supported = false;
+    }
+    else {
+       hdr10metadata_supported = true;
+    }
+
 #ifdef HYPERVISOR
     m_nDriver_fd = hypv_open(device_name, O_RDWR);
 #else
@@ -3769,7 +3780,9 @@
         return 1;
     }
 
-    venc_set_extradata_hdr10metadata();
+    if (hdr10metadata_supported == true) {
+        venc_set_extradata_hdr10metadata();
+    }
 
     venc_config_print();
 
@@ -4521,6 +4534,8 @@
                         if (encodePerfMode == OMX_TRUE) {
                             buf.flags |= V4L2_QCOM_BUF_FLAG_PERF_MODE;
                         }
+                        // Clear SET_VIDEO_PERF_MODE in buffer handle
+                        setMetaData(handle, SET_VIDEO_PERF_MODE, 0);
                     }
                     fd = handle->fd;
                     plane[0].data_offset = 0;
@@ -5283,6 +5298,14 @@
     DEBUG_PRINT_LOW("Success IOCTL set control for id=%d, value=%d", control.id, control.value);
 
     codec_profile.profile = control.value;
+
+    if (hdr10metadata_supported == true) {
+        if (venc_set_extradata_hdr10metadata() == false)
+        {
+            DEBUG_PRINT_ERROR("Failed to set extradata HDR10PLUS_METADATA");
+            return false;
+        }
+    }
     return true;
 }
 
@@ -5721,7 +5744,7 @@
 {
     bool status = true;
     int rc;
-    struct v4l2_control control_mode, control_mbs;
+    struct v4l2_control control_mode;
     control_mode.id   = V4L2_CID_MPEG_VIDC_VIDEO_INTRA_REFRESH_MODE_CYCLIC;
     control_mode.value = 0;
     // There is no disabled mode.  Disabled mode is indicated by a 0 count.
@@ -5744,7 +5767,6 @@
         return false;
     }
 
-    intra_refresh.mbcount = control_mbs.value;
     return status;
 }
 
@@ -7666,7 +7688,10 @@
     ctrl[8].value = mastering_disp_info.primaries.whitePoint[1];
 
     ctrl[9].id = V4L2_CID_MPEG_VIDC_VENC_MAX_DISP_LUM;
-    ctrl[9].value = mastering_disp_info.maxDisplayLuminance;
+    // maxDisplayLuminance is in cd/m^2 scale. But the standard requires this field
+    // to be in 0.0001 cd/m^2 scale. So, multiply with LUMINANCE_MULTIPLICATION_FACTOR
+    // and give to be driver
+    ctrl[9].value = mastering_disp_info.maxDisplayLuminance * LUMINANCE_MULTIPLICATION_FACTOR;
 
     ctrl[10].id = V4L2_CID_MPEG_VIDC_VENC_MIN_DISP_LUM;
     ctrl[10].value = mastering_disp_info.minDisplayLuminance;
diff --git a/product.mk b/product.mk
index 5bfa0b0..2aa09cd 100644
--- a/product.mk
+++ b/product.mk
@@ -24,6 +24,8 @@
 
 ifeq ($(call is-board-platform-in-list, msmnile $(MSMSTEPPE)),true)
 include hardware/qcom/sm8150/media/conf_files/$(TARGET_BOARD_PLATFORM)/$(TARGET_BOARD_PLATFORM).mk
+else ifeq ($(TARGET_BOARD_PLATFORM), sdmshrike)
+include hardware/qcom/media/conf_files/msmnile/msmnile.mk
 endif
 
 endif