Merge change 7701

* changes:
  Clean up MP3Extractor code and fixes a bug that miscalculated the position of the header by a few bytes whenever we read in more data.
diff --git a/include/media/stagefright/TimeSource.h b/include/media/stagefright/TimeSource.h
index f57d8cf..443673d 100644
--- a/include/media/stagefright/TimeSource.h
+++ b/include/media/stagefright/TimeSource.h
@@ -18,6 +18,8 @@
 
 #define TIME_SOURCE_H_
 
+#include <stdint.h>
+
 namespace android {
 
 class TimeSource {
diff --git a/media/libstagefright/Android.mk b/media/libstagefright/Android.mk
index 6e7936c..5944d9c 100644
--- a/media/libstagefright/Android.mk
+++ b/media/libstagefright/Android.mk
@@ -4,29 +4,29 @@
 include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES:=                 \
-	CachingDataSource.cpp     \
+        CachingDataSource.cpp     \
         DataSource.cpp            \
-	FileSource.cpp            \
-	HTTPDataSource.cpp        \
-	HTTPStream.cpp            \
-	MP3Extractor.cpp          \
-	MPEG4Extractor.cpp        \
-	MPEG4Writer.cpp           \
-	MediaBuffer.cpp           \
+        FileSource.cpp            \
+        HTTPDataSource.cpp        \
+        HTTPStream.cpp            \
+        MP3Extractor.cpp          \
+        MPEG4Extractor.cpp        \
+        MPEG4Writer.cpp           \
+        MediaBuffer.cpp           \
         MediaBufferGroup.cpp      \
         MediaExtractor.cpp        \
         MediaPlayerImpl.cpp       \
         MediaSource.cpp           \
-	MetaData.cpp              \
+        MetaData.cpp              \
         MmapSource.cpp            \
         QComHardwareRenderer.cpp  \
-	SampleTable.cpp           \
-	ShoutcastSource.cpp       \
+        SampleTable.cpp           \
+        ShoutcastSource.cpp       \
         SoftwareRenderer.cpp      \
         SurfaceRenderer.cpp       \
         TimeSource.cpp            \
         TimedEventQueue.cpp       \
-	Utils.cpp                 \
+        Utils.cpp                 \
         AudioPlayer.cpp           \
         ESDS.cpp                  \
         OMXClient.cpp             \
@@ -34,16 +34,20 @@
         string.cpp
 
 LOCAL_C_INCLUDES:= \
-	$(TOP)/external/opencore/extern_libs_v2/khronos/openmax/include \
+        $(TOP)/external/opencore/extern_libs_v2/khronos/openmax/include \
         $(TOP)/external/opencore/android
 
 LOCAL_SHARED_LIBRARIES := \
         libbinder         \
         libmedia          \
-	libutils          \
+        libutils          \
         libcutils         \
         libui
 
+ifeq ($(TARGET_OS)-$(TARGET_SIMULATOR),linux-true)
+        LOCAL_LDLIBS += -lpthread
+endif
+
 LOCAL_CFLAGS += -Wno-multichar
 
 LOCAL_PRELINK_MODULE:= false
diff --git a/media/libstagefright/TimeSource.cpp b/media/libstagefright/TimeSource.cpp
index 7deb310..d987fbf 100644
--- a/media/libstagefright/TimeSource.cpp
+++ b/media/libstagefright/TimeSource.cpp
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+#include <stddef.h>
 #include <sys/time.h>
 
 #include <media/stagefright/TimeSource.h>
diff --git a/media/libstagefright/TimedEventQueue.cpp b/media/libstagefright/TimedEventQueue.cpp
index 10cf81a..2f8a19f 100644
--- a/media/libstagefright/TimedEventQueue.cpp
+++ b/media/libstagefright/TimedEventQueue.cpp
@@ -16,6 +16,7 @@
 
 #undef __STRICT_ANSI__
 #define __STDINT_LIMITS
+#define __STDC_LIMIT_MACROS
 #include <stdint.h>
 
 #define LOG_TAG "TimedEventQueue"
diff --git a/media/libstagefright/omx/OMX.cpp b/media/libstagefright/omx/OMX.cpp
index c18f5ce..daaa741 100644
--- a/media/libstagefright/omx/OMX.cpp
+++ b/media/libstagefright/omx/OMX.cpp
@@ -217,6 +217,7 @@
 
                 header->nFilledLen = 0;
                 header->nOffset = 0;
+                header->hMarkTargetComponent = NULL;
                 header->nFlags = 0;
 
                 NodeMeta *node_meta = static_cast<NodeMeta *>(
@@ -238,6 +239,7 @@
 
                 header->nFilledLen = msg.u.extended_buffer_data.range_length;
                 header->nOffset = msg.u.extended_buffer_data.range_offset;
+                header->hMarkTargetComponent = NULL;
                 header->nFlags = msg.u.extended_buffer_data.flags;
                 header->nTimeStamp = msg.u.extended_buffer_data.timestamp;