diff --git a/Android.mk b/Android.mk
new file mode 100644
index 0000000..5c069fe
--- /dev/null
+++ b/Android.mk
@@ -0,0 +1,2 @@
+LOCAL_PATH := $(call my-dir)
+include $(call all-makefiles-under, $(LOCAL_PATH))
diff --git a/libaac/Android.mk b/libaac/Android.mk
new file mode 100644
index 0000000..9c875bd
--- /dev/null
+++ b/libaac/Android.mk
@@ -0,0 +1,18 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := aacEncode.cpp
+LOCAL_SRC_FILES += aacDecode.cpp
+
+LOCAL_C_INCLUDES := $(LOCAL_PATH)
+LOCAL_C_INCLUDES += $(TOP)/external/aac/libAACenc/include
+LOCAL_C_INCLUDES += $(TOP)/external/aac/libAACdec/include
+LOCAL_C_INCLUDES += $(TOP)/external/aac/libSYS/include
+
+LOCAL_SHARED_LIBRARIES := liblog
+LOCAL_STATIC_LIBRARIES := libFraunhoferAAC
+
+LOCAL_32_BIT_ONLY := true
+LOCAL_MODULE := libwfdaac
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/libaac/aacDecode.cpp b/libaac/aacDecode.cpp
new file mode 100644
index 0000000..44296b6
--- /dev/null
+++ b/libaac/aacDecode.cpp
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2018, 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:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ *       copyright notice, this list of conditions and the following
+ *       disclaimer in the documentation and/or other materials provided
+ *       with the distribution.
+ *     * Neither the name of The Linux Foundation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * */
+
+#include "aacDecode.h"
+#include "aacdecoder_lib.h"
+#include <utils/Log.h>
+#include <string.h>
+
+aacDecode::aacDecode() {
+    p_aacHandle = NULL;
+    p_aacInfo = NULL;
+    memset(&s_aacConfig, 0, sizeof(s_aacConfig));
+}
+
+aacDecode::~aacDecode() {
+    if(!p_aacHandle) {
+        return;
+    }
+
+    aacDecoder_Close((HANDLE_AACDECODER)p_aacHandle);
+    p_aacHandle = NULL;
+}
+
+bool aacDecode::aacConfigure(aacConfigType * p_aacConfig) {
+    if(!p_aacConfig) {
+        return false;
+    }
+
+    memcpy(&s_aacConfig, p_aacConfig, sizeof(s_aacConfig));
+
+    p_aacHandle = aacDecoder_Open(TT_MP4_ADTS, 1);
+
+    if(!p_aacHandle) {
+        ALOGE("Failed to open AAC decoder");
+        return false;
+    }
+
+    p_aacInfo = (void*)aacDecoder_GetStreamInfo((HANDLE_AACDECODER)p_aacHandle);
+
+    if(!p_aacInfo) {
+        ALOGE("Failed to get stream info");
+        return false;
+    }
+
+    /* Configure AAC decoder */
+
+    aacDecoder_SetParam((HANDLE_AACDECODER)p_aacHandle,
+                        AAC_DRC_REFERENCE_LEVEL,
+                        64);
+
+    aacDecoder_SetParam((HANDLE_AACDECODER)p_aacHandle,
+                        AAC_DRC_ATTENUATION_FACTOR,
+                        127);
+
+    aacDecoder_SetParam((HANDLE_AACDECODER)p_aacHandle,
+                        AAC_PCM_MAX_OUTPUT_CHANNELS,
+                        s_aacConfig.n_channels > 6 ? -1 : s_aacConfig.n_channels);
+    return true;
+}
+
+bool aacDecode::aacDecodeFrame(unsigned char* p_buffer, unsigned int n_size) {
+    if(!p_buffer || n_size < 7) {
+        ALOGE("No/Incorrect buffer provided for AAC decoder");
+        return false;
+    }
+
+    if(!p_aacHandle) {
+        ALOGE("Decoder handle not available");
+        return false;
+    }
+
+    AAC_DECODER_ERROR err = AAC_DEC_UNKNOWN;
+
+    UINT nSize[] = {(UINT)n_size};
+    UINT nOcc[] = {(UINT)n_size};
+    UCHAR* pBuf[] = {p_buffer};
+
+    err = aacDecoder_Fill((HANDLE_AACDECODER)p_aacHandle, pBuf, nSize, nOcc);
+
+    if(err != AAC_DEC_OK || nOcc[0] != 0) {
+        ALOGE("Error in aacDecoder_Fill");
+        return false;
+    }
+
+    /* Fix the alloc length being passed to AAC Decoder since it expects INT_PCM
+       as input buffer but we have it as UINT8. INT_PCM is of type SHORT */
+
+    int factor = sizeof(INT_PCM)/sizeof(unsigned char);
+    int allocLen = (factor == 0) ? n_size : n_size/factor;
+
+    err = aacDecoder_DecodeFrame((HANDLE_AACDECODER)p_aacHandle,
+                                  (INT_PCM*)p_buffer, allocLen, 0);
+
+    if(err != AAC_DEC_OK) {
+        ALOGE("Failed to decode frame");
+        return false;
+    }
+    return true;
+}
diff --git a/libaac/aacDecode.h b/libaac/aacDecode.h
new file mode 100644
index 0000000..41b9df5
--- /dev/null
+++ b/libaac/aacDecode.h
@@ -0,0 +1,52 @@
+#ifndef __AAC_DECODE__
+#define __AAC_DECODE__
+/*
+ * Copyright (c) 2018, 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:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ *       copyright notice, this list of conditions and the following
+ *       disclaimer in the documentation and/or other materials provided
+ *       with the distribution.
+ *     * Neither the name of The Linux Foundation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * */
+
+typedef struct aacConfig {
+    unsigned int n_sampleRate;
+    unsigned int n_channels;
+    unsigned int n_bitsPerSample;
+    unsigned int n_bitrate;
+    unsigned int n_samplesPerFrame;
+}aacConfigType;
+
+class aacDecode {
+public:
+    aacDecode();
+    ~aacDecode();
+    bool aacConfigure(aacConfigType* p_aacConfig);
+    bool aacDecodeFrame(unsigned char* p_Buffer, unsigned int n_size);
+
+private:
+    void* p_aacHandle;
+    void* p_aacInfo;
+    aacConfigType s_aacConfig;
+};
+#endif
diff --git a/libaac/aacEncode.cpp b/libaac/aacEncode.cpp
new file mode 100644
index 0000000..1d5b273
--- /dev/null
+++ b/libaac/aacEncode.cpp
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2018, 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:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ *       copyright notice, this list of conditions and the following
+ *       disclaimer in the documentation and/or other materials provided
+ *       with the distribution.
+ *     * Neither the name of The Linux Foundation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * */
+
+#include "aacEncode.h"
+#include "aacenc_lib.h"
+#include <utils/Log.h>
+#include <string.h>
+
+struct aacInfo
+{
+    AACENC_BufDesc inBuff;
+    AACENC_BufDesc outBuff;
+    AACENC_InArgs  inArg;
+    AACENC_OutArgs outArg;
+};
+
+aacEncode::aacEncode() {
+    p_aacHandle = NULL;
+    p_aacInfo = NULL;
+    memset(&s_aacConfig, 0, sizeof(s_aacConfig));
+}
+
+aacEncode::~aacEncode() {
+    if(!p_aacHandle) {
+        return;
+    }
+
+    if(aacEncClose((HANDLE_AACENCODER*)(&p_aacHandle)) != AACENC_OK) {
+        ALOGE("aacEncClose Failed");
+        return;
+    }
+}
+
+bool aacEncode::aacConfigure(aacConfigType * p_aacConfig) {
+    if(!p_aacConfig) {
+        return false;
+    }
+
+    memcpy(&s_aacConfig, p_aacConfig, sizeof(s_aacConfig));
+
+    /* Configure AAC encoder here */
+
+    AACENC_ERROR err = AACENC_OK;
+
+    p_aacInfo = (void*)new(aacInfo);
+    if(!p_aacInfo) {
+        ALOGE("Failed to allocate aacInfo");
+        return false;
+    }
+
+    /* Open AAC encoder */
+    err = aacEncOpen((HANDLE_AACENCODER*)(&p_aacHandle),
+                      0x01 /* AAC */,
+                      s_aacConfig.n_channels);
+
+    if(err != AACENC_OK) {
+        ALOGE("Failed top open AAC encoder");
+        return false;
+    }
+
+    /* Set Bitrate and SampleRate */
+    err = aacEncoder_SetParam((HANDLE_AACENCODER)p_aacHandle,
+                               AACENC_BITRATE,
+                               s_aacConfig.n_bitrate);
+
+    if(err != AACENC_OK) {
+        ALOGE("Failed to set bitrate param to AAC encoder");
+        return false;
+    }
+
+    err = aacEncoder_SetParam((HANDLE_AACENCODER)p_aacHandle,
+                                   AACENC_SAMPLERATE,
+                                   s_aacConfig.n_sampleRate);
+
+    if(err != AACENC_OK) {
+        ALOGE("Failed to set samplerate param to AAC encoder");
+        return false;
+    }
+
+    /* Fix Channel mode and order */
+    /* TODO */
+
+    /* Prefill encode structures */
+    /* TODO */
+
+    return true;
+}
+
+bool aacEncode::aacEncodeFrame(unsigned char * p_inBuffer,
+                              unsigned int n_inSize,
+                              unsigned char * p_outBuffer,
+                              unsigned int n_outSize,
+                              unsigned int * p_length) {
+    (void)n_inSize;
+    (void)n_outSize;
+    (void)p_length;
+    if(!p_inBuffer || !p_outBuffer) {
+        ALOGE("No buffers provided for AAC encoder");
+        return false;
+    }
+
+    aacInfo *tempAacInfo = (aacInfo*)p_aacInfo;
+    tempAacInfo->inBuff.bufs = (void**) (&p_inBuffer);
+    tempAacInfo->outBuff.bufs = (void**) (&p_outBuffer);
+
+    AACENC_ERROR err = AACENC_OK;
+
+    if(p_aacHandle) {
+        err = aacEncEncode((HANDLE_AACENCODER)p_aacHandle,
+                           &tempAacInfo->inBuff,
+                           &tempAacInfo->outBuff,
+                           &tempAacInfo->inArg,
+                           &tempAacInfo->outArg);
+
+        if(err != AACENC_OK) {
+            ALOGE("Failed to encode buffer");
+            return false;
+        }
+    } else {
+        ALOGE("No encoder available");
+        return false;
+    }
+
+    return true;
+}
diff --git a/libaac/aacEncode.h b/libaac/aacEncode.h
new file mode 100644
index 0000000..46a7734
--- /dev/null
+++ b/libaac/aacEncode.h
@@ -0,0 +1,55 @@
+#ifndef __AAC_ENCODE__
+#define __AAC_ENCODE__
+/*
+ * Copyright (c) 2018, 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:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ *       copyright notice, this list of conditions and the following
+ *       disclaimer in the documentation and/or other materials provided
+ *       with the distribution.
+ *     * Neither the name of The Linux Foundation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * */
+typedef struct aacConfig {
+    unsigned int n_sampleRate;
+    unsigned int n_channels;
+    unsigned int n_bitsPerSample;
+    unsigned int n_bitrate;
+    unsigned int n_samplesPerFrame;
+}aacConfigType;
+
+class aacEncode {
+public:
+    aacEncode();
+    ~aacEncode();
+    bool aacConfigure(aacConfigType* p_aacConfig);
+    bool aacEncodeFrame(unsigned char* p_inBuffer,
+                   unsigned int n_inSize,
+                   unsigned char* p_outBuffer,
+                   unsigned int n_outSize,
+                   unsigned int* p_length);
+
+private:
+    void* p_aacHandle;
+    void* p_aacInfo;
+    aacConfigType s_aacConfig;
+};
+#endif
