OSDN Git Service

Instantiate SingleStateQueue<AudioTimestamp>
authorGlenn Kasten <gkasten@google.com>
Fri, 23 Aug 2013 17:54:35 +0000 (10:54 -0700)
committerGlenn Kasten <gkasten@google.com>
Tue, 3 Sep 2013 22:11:39 +0000 (15:11 -0700)
as typedef AudioTimestampSingleStateQueue and use it in MonoPipe.

Change-Id: Idaebb362bd9d0a81a7ed83792ab9369dc37c0e74

include/media/nbaio/MonoPipe.h
media/libmedia/Android.mk
media/libmedia/SingleStateQueueInstantiations.cpp
media/libnbaio/Android.mk
media/libnbaio/MonoPipe.cpp

index ffdcc21..d3802fe 100644 (file)
 #include <time.h>
 #include <utils/LinearTransform.h>
 #include "NBAIO.h"
+#include <media/SingleStateQueue.h>
 
 namespace android {
 
+typedef SingleStateQueue<AudioTimestamp> AudioTimestampSingleStateQueue;
+
 // MonoPipe is similar to Pipe except:
 //  - supports only a single reader, called MonoPipeReader
 //  - write() cannot overrun; instead it will return a short actual count if insufficient space
@@ -130,6 +133,10 @@ private:
     LinearTransform mSamplesToLocalTime;
 
     bool            mIsShutdown;    // whether shutdown(true) was called, no barriers are needed
+
+    AudioTimestampSingleStateQueue::Shared      mTimestampShared;
+    AudioTimestampSingleStateQueue::Mutator     mTimestampMutator;
+    AudioTimestampSingleStateQueue::Observer    mTimestampObserver;
 };
 
 }   // namespace android
index 96755bb..56e7787 100644 (file)
@@ -62,6 +62,7 @@ LOCAL_SRC_FILES += ../libnbaio/roundup.c
 LOCAL_CFLAGS += -DANDROID_SMP=$(if $(findstring true,$(TARGET_CPU_SMP)),1,0)
 LOCAL_SRC_FILES += SingleStateQueue.cpp
 LOCAL_CFLAGS += -DSINGLE_STATE_QUEUE_INSTANTIATIONS='"SingleStateQueueInstantiations.cpp"'
+# Consider a separate a library for SingleStateQueueInstantiations.
 
 LOCAL_SHARED_LIBRARIES := \
        libui liblog libcutils libutils libbinder libsonivox libicuuc libexpat \
index 2afebe9..0265c8c 100644 (file)
 
 #include <media/SingleStateQueue.h>
 #include <private/media/StaticAudioTrackState.h>
+#include <media/AudioTimestamp.h>
 
 // FIXME hack for gcc
 
 namespace android {
 
 template class SingleStateQueue<StaticAudioTrackState>; // typedef StaticAudioTrackSingleStateQueue
+template class SingleStateQueue<AudioTimestamp>;        // typedef AudioTimestampSingleStateQueue
 
 }
index 5d00d15..69c75b8 100644 (file)
@@ -31,6 +31,9 @@ LOCAL_SHARED_LIBRARIES := \
     libcommon_time_client \
     libcutils \
     libutils \
-    liblog
+    liblog \
+    libmedia
+# This dependency on libmedia is for SingleStateQueueInstantiations.
+# Consider a separate a library for SingleStateQueueInstantiations.
 
 include $(BUILD_SHARED_LIBRARY)
index a74b49e..b55be83 100644 (file)
@@ -42,7 +42,10 @@ MonoPipe::MonoPipe(size_t reqFrames, NBAIO_Format format, bool writeCanBlock) :
         // mWriteTs
         mSetpoint((reqFrames * 11) / 16),
         mWriteCanBlock(writeCanBlock),
-        mIsShutdown(false)
+        mIsShutdown(false),
+        // mTimestampShared
+        mTimestampMutator(&mTimestampShared),
+        mTimestampObserver(&mTimestampShared)
 {
     CCHelper tmpHelper;
     status_t res;