dashplayer: Code clean up and dynamic logging for dashplayer
1) Remove redundant logic
2) Addressing Code change
3) Dynamic logging
Change-Id: I6cdd19bb69492366138090351bd2390c9de1017a
diff --git a/dashplayer/DashFactory.cpp b/dashplayer/DashFactory.cpp
index d7be87b..854b302 100644
--- a/dashplayer/DashFactory.cpp
+++ b/dashplayer/DashFactory.cpp
@@ -21,7 +21,6 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "DASHFactory"
#include <media/IMediaPlayer.h>
-#include <utils/Log.h>
#include "DashPlayerDriver.h"
#include "MediaPlayerFactory.h"
diff --git a/dashplayer/DashPacketSource.cpp b/dashplayer/DashPacketSource.cpp
index b76bd3a..ad3719c 100644
--- a/dashplayer/DashPacketSource.cpp
+++ b/dashplayer/DashPacketSource.cpp
@@ -18,16 +18,17 @@
*/
#include "DashPacketSource.h"
-
-#include <media/stagefright/foundation/ABuffer.h>
-#include <media/stagefright/foundation/ADebug.h>
-#include <media/stagefright/foundation/AMessage.h>
-#include <media/stagefright/foundation/AString.h>
-#include <media/stagefright/foundation/hexdump.h>
+#include "DashPlayer.h"
#include <media/stagefright/MediaBuffer.h>
#include <media/stagefright/MediaDefs.h>
#include <media/stagefright/MetaData.h>
#include <utils/Vector.h>
+#include <cutils/properties.h>
+
+#define DPS_MSG_ERROR(...) ALOGE(__VA_ARGS__)
+#define DPS_MSG_HIGH(...) if(mLogLevel >= 1){ALOGE(__VA_ARGS__);}
+#define DPS_MSG_MEDIUM(...) if(mLogLevel >= 2){ALOGE(__VA_ARGS__);}
+#define DPS_MSG_LOW(...) if(mLogLevel >= 3){ALOGE(__VA_ARGS__);}
namespace android {
@@ -35,9 +36,14 @@
: mIsAudio(false),
mFormat(meta),
mEOSResult(OK),
- mStreamPID(0),
- mProgramPID(0),
- mFirstPTS(0) {
+ mLogLevel(0) {
+
+ char property_value[PROPERTY_VALUE_MAX] = {0};
+ property_get("persist.dash.debug.level", property_value, NULL);
+ if(*property_value) {
+ mLogLevel = atoi(property_value);
+ }
+
const char *mime;
CHECK(meta->findCString(kKeyMIMEType, &mime));
@@ -68,19 +74,6 @@
return OK;
}
-void DashPacketSource::setStreamInfo(unsigned streamPID, unsigned programPID, uint64_t firstPTS){
- mStreamPID = streamPID;
- mProgramPID = programPID;
- mFirstPTS = firstPTS;
-}
-
-status_t DashPacketSource::getStreamInfo(unsigned& streamPID, unsigned& programPID, uint64_t& firstPTS){
- streamPID = mStreamPID;
- programPID = mProgramPID;
- firstPTS = mFirstPTS;
- return OK;
-}
-
sp<MetaData> DashPacketSource::getFormat() {
Mutex::Autolock autoLock(mLock);
return mFormat;
@@ -167,16 +160,16 @@
int64_t timeUs;
CHECK(buffer->meta()->findInt64("timeUs", &timeUs));
- ALOGV("queueAccessUnit timeUs=%lld us (%.2f secs)", timeUs, timeUs / 1E6);
+ DPS_MSG_LOW("queueAccessUnit timeUs=%lld us (%.2f secs)", timeUs, (double)timeUs / 1E6);
Mutex::Autolock autoLock(mLock);
mBuffers.push_back(buffer);
- ALOGV("@@@@:: DashPacketSource --> size is %d ",mBuffers.size() );
+ DPS_MSG_LOW("@@@@:: DashPacketSource --> size is %d ",mBuffers.size() );
mCondition.signal();
}
int DashPacketSource::getQueueSize() {
- return mBuffers.size();
+ return (int)mBuffers.size();
}
void DashPacketSource::queueDiscontinuity(
@@ -185,7 +178,7 @@
Mutex::Autolock autoLock(mLock);
if (type == ATSParser::DISCONTINUITY_TIME) {
- ALOGI("Flushing all Access units for seek");
+ DPS_MSG_HIGH("Flushing all Access units for seek");
mBuffers.clear();
mEOSResult = OK;
mCondition.signal();
@@ -280,7 +273,7 @@
*isSyncFrame = false;
int32_t value = 0;
- if (buffer->meta()->findInt32("isSync", &value) && (value == 1)) {
+ if (buffer->meta()->findInt32("sync", &value) && (value == 1)) {
*isSyncFrame = true;
}
return OK;
diff --git a/dashplayer/DashPacketSource.h b/dashplayer/DashPacketSource.h
index 5185f8b..6046bfc 100644
--- a/dashplayer/DashPacketSource.h
+++ b/dashplayer/DashPacketSource.h
@@ -25,7 +25,6 @@
#include <media/stagefright/MediaSource.h>
#include <utils/threads.h>
#include <utils/List.h>
-
#include "ATSParser.h"
namespace android {
@@ -63,10 +62,6 @@
void updateFormat(const sp<MetaData> &meta);
int getQueueSize();
- status_t getStreamInfo(unsigned& streamPID, unsigned& programPID, uint64_t& firstPTS);
-
- void setStreamInfo(unsigned streamPID, unsigned programPID, uint64_t firstPTS);
-
status_t nextBufferIsSync(bool* isSyncFrame);
protected:
@@ -80,9 +75,7 @@
sp<MetaData> mFormat;
List<sp<ABuffer> > mBuffers;
status_t mEOSResult;
- unsigned mStreamPID;
- unsigned mProgramPID;
- uint64_t mFirstPTS;
+ int mLogLevel;
bool wasFormatChange(int32_t discontinuityType) const;
diff --git a/dashplayer/DashPlayer.cpp b/dashplayer/DashPlayer.cpp
index e397b42..82e6950 100644
--- a/dashplayer/DashPlayer.cpp
+++ b/dashplayer/DashPlayer.cpp
@@ -25,38 +25,26 @@
#include <utils/Log.h>
#include <dlfcn.h> // for dlopen/dlclose
#include "DashPlayer.h"
-#ifdef QCOM_WFD_SINK
-#include "WFDRenderer.h"
-#endif //QCOM_WFD_SINK
-//#include "HTTPLiveSource.h"
#include "DashPlayerDecoder.h"
#include "DashPlayerDriver.h"
#include "DashPlayerRenderer.h"
#include "DashPlayerSource.h"
#include "DashCodec.h"
-//#include "RTSPSource.h"
-//#include "StreamingSource.h"
-//#include "GenericSource.h"
-
#include "ATSParser.h"
-
-#include <media/stagefright/foundation/hexdump.h>
-#include <media/stagefright/foundation/ABuffer.h>
-#include <media/stagefright/foundation/ADebug.h>
-#include <media/stagefright/foundation/AMessage.h>
-#include <media/stagefright/foundation/AString.h>
#include <media/stagefright/MediaDefs.h>
#include <media/stagefright/MediaErrors.h>
#include <media/stagefright/MetaData.h>
-#include <TextDescriptions.h>
-
#include <gui/IGraphicBufferProducer.h>
-
-#include <cutils/properties.h>
#include "avc_utils.h"
-
#include "OMX_QCOMExtns.h"
#include <gralloc_priv.h>
+#include <cutils/properties.h>
+#include <utils/Log.h>
+
+#define DP_MSG_ERROR(...) ALOGE(__VA_ARGS__)
+#define DP_MSG_HIGH(...) if(mLogLevel >= 1){ALOGE(__VA_ARGS__);}
+#define DP_MSG_MEDIUM(...) if(mLogLevel >= 2){ALOGE(__VA_ARGS__);}
+#define DP_MSG_LOW(...) if(mLogLevel >= 3){ALOGE(__VA_ARGS__);}
namespace android {
@@ -141,17 +129,22 @@
mSkipRenderingAudioUntilMediaTimeUs(-1ll),
mSkipRenderingVideoUntilMediaTimeUs(-1ll),
mVideoLateByUs(0ll),
- mNumFramesTotal(0ll),
- mNumFramesDropped(0ll),
mPauseIndication(false),
- mSourceType(kDefaultSource),
- mIsSecureInputBuffers(false),
mSRid(0),
mStats(NULL),
+ mLogLevel(0),
mTimedTextCEAPresent(false),
mTimedTextCEASamplesDisc(false),
mQCTimedTextListenerPresent(false){
mTrackName = new char[6];
+
+ char property_value[PROPERTY_VALUE_MAX] = {0};
+ property_get("persist.dash.debug.level", property_value, NULL);
+
+ if(*property_value) {
+ mLogLevel = atoi(property_value);
+ }
+
}
DashPlayer::~DashPlayer() {
@@ -187,7 +180,7 @@
}
void DashPlayer::setDataSource(const sp<IStreamSource> & /*source*/) {
- ALOGE("DashPlayer::setDataSource not Implemented...");
+ DP_MSG_ERROR("DashPlayer::setDataSource not Implemented...");
}
status_t DashPlayer::setDataSource(
@@ -198,27 +191,26 @@
if (!strncasecmp(url, "http://", 7) &&
(strlen(url) >= 4 && !strcasecmp(".mpd", &url[strlen(url) - 4]))) {
/* Load the DASH HTTP Live source librery here */
- ALOGV("DashPlayer setDataSource url sting %s",url);
- source = LoadCreateSource(url, headers, mUIDValid, mUID,kHttpDashSource);
+ DP_MSG_LOW("DashPlayer setDataSource url sting %s",url);
+ source = LoadCreateSource(url, headers, mUIDValid, mUID);
if (source != NULL) {
- mSourceType = kHttpDashSource;
msg->setObject("source", source);
msg->post();
return OK;
} else {
- ALOGE("Error creating DASH source");
+ DP_MSG_ERROR("Error creating DASH source");
return UNKNOWN_ERROR;
}
}
else
{
- ALOGE("Unsupported URL");
+ DP_MSG_ERROR("Unsupported URL");
return UNKNOWN_ERROR;
}
}
void DashPlayer::setDataSource(int /*fd*/, int64_t /*offset*/, int64_t /*length*/) {
- ALOGE("DashPlayer::setDataSource not Implemented...");
+ DP_MSG_ERROR("DashPlayer::setDataSource not Implemented...");
}
void DashPlayer::setVideoSurfaceTexture(const sp<IGraphicBufferProducer> &bufferProducer) {
@@ -226,9 +218,9 @@
if (bufferProducer == NULL) {
msg->setObject("native-window", NULL);
- ALOGE("DashPlayer::setVideoSurfaceTexture bufferproducer = NULL ");
+ DP_MSG_ERROR("DashPlayer::setVideoSurfaceTexture bufferproducer = NULL ");
} else {
- ALOGE("DashPlayer::setVideoSurfaceTexture bufferproducer = %p", bufferProducer.get());
+ DP_MSG_ERROR("DashPlayer::setVideoSurfaceTexture bufferproducer = %p", bufferProducer.get());
msg->setObject(
"native-window",
new NativeWindowWrapper(
@@ -291,7 +283,7 @@
switch (msg->what()) {
case kWhatSetDataSource:
{
- ALOGE("kWhatSetDataSource");
+ DP_MSG_ERROR("kWhatSetDataSource");
CHECK(mSource == NULL);
@@ -299,9 +291,8 @@
CHECK(msg->findObject("source", &obj));
mSource = static_cast<Source *>(obj.get());
- if (mSourceType == kHttpDashSource) {
- prepareSource();
- }
+ prepareSource();
+
break;
}
@@ -316,7 +307,7 @@
/* reinstantiation of video decoder and video playback continues. */
/* TODO: Dynamic disible and reenable of video also requies support */
/* from dash source. */
- ALOGV("kWhatSetVideoNativeWindow");
+ DP_MSG_ERROR("kWhatSetVideoNativeWindow");
/*
if existing instance mNativeWindow=NULL, just set mNativeWindow to the new value passed
@@ -331,7 +322,7 @@
CHECK(msg->findObject("native-window", &obj));
mNativeWindow = static_cast<NativeWindowWrapper *>(obj.get());
- ALOGV("kWhatSetVideoNativeWindow valid nativewindow %p", mNativeWindow.get());
+ DP_MSG_ERROR("kWhatSetVideoNativeWindow valid nativewindow %p", mNativeWindow.get());
if (mDriver != NULL) {
sp<DashPlayerDriver> driver = mDriver.promote();
if (driver != NULL) {
@@ -339,12 +330,12 @@
}
}
- ALOGV("kWhatSetVideoNativeWindow nativewindow %d", mScanSourcesPending);
+ DP_MSG_ERROR("kWhatSetVideoNativeWindow nativewindow %d", mScanSourcesPending);
postScanSources();
break;
}
-/* Already existing valid mNativeWindow and valid mVideoDecoder
+ /* Already existing valid mNativeWindow and valid mVideoDecoder
- Perform shutdown sequence
- postScanSources() to instantiate mVideoDecoder with the new native window object.
If no mVideoDecoder existed, and new nativewindow set to NULL push blank buffers to native window (embms audio only switch use case)
@@ -362,8 +353,8 @@
mDeferredActions.push_back(new ShutdownDecoderAction(
false /* audio */, true /* video */));
- ALOGE("kWhatSetVideoNativeWindow old nativewindow %p", mNativeWindow.get());
- ALOGE("kWhatSetVideoNativeWindow new nativewindow %p", obj.get());
+ DP_MSG_ERROR("kWhatSetVideoNativeWindow old nativewindow %p", mNativeWindow.get());
+ DP_MSG_ERROR("kWhatSetVideoNativeWindow new nativewindow %p", obj.get());
mDeferredActions.push_back(
new SetSurfaceAction(static_cast<NativeWindowWrapper *>(obj.get())));
@@ -382,7 +373,7 @@
case kWhatSetAudioSink:
{
- ALOGV("kWhatSetAudioSink");
+ DP_MSG_ERROR("kWhatSetAudioSink");
sp<RefBase> obj;
CHECK(msg->findObject("sink", &obj));
@@ -393,7 +384,7 @@
case kWhatStart:
{
- ALOGE("kWhatStart");
+ DP_MSG_ERROR("kWhatStart");
mVideoIsAVC = false;
mAudioEOS = false;
@@ -401,32 +392,19 @@
mSkipRenderingAudioUntilMediaTimeUs = -1;
mSkipRenderingVideoUntilMediaTimeUs = -1;
mVideoLateByUs = 0;
- mNumFramesTotal = 0;
- mNumFramesDropped = 0;
if (mSource != NULL)
{
mSource->start();
}
-#ifdef QCOM_WFD_SINK
- if (mSourceType == kWfdSource) {
- ALOGV("creating WFDRenderer in NU player");
- mRenderer = new WFDRenderer(
- mAudioSink,
- new AMessage(kWhatRendererNotify, id()));
- }
- else {
-#endif /* QCOM_WFD_SINK */
- mRenderer = new Renderer(
- mAudioSink,
- new AMessage(kWhatRendererNotify, id()));
-#ifdef QCOM_WFD_SINK
- }
-#endif /* QCOM_WFD_SINK */
- // for qualcomm statistics profiling
- mStats = new DashPlayerStats();
- mRenderer->registerStats(mStats);
- looper()->registerHandler(mRenderer);
+
+ mRenderer = new Renderer(
+ mAudioSink,
+ new AMessage(kWhatRendererNotify, id()));
+ // for qualcomm statistics profiling
+ mStats = new DashPlayerStats();
+ mRenderer->registerStats(mStats);
+ looper()->registerHandler(mRenderer);
postScanSources();
break;
@@ -443,22 +421,9 @@
}
mScanSourcesPending = false;
+ DP_MSG_LOW("scanning sources haveAudio=%d, haveVideo=%d haveText=%d",
+ mAudioDecoder != NULL, mVideoDecoder != NULL, mTextDecoder!= NULL);
- //Exit scanSources if source was destroyed
- //Later after source gets recreated and started (setDataSource() and start()) scanSources is posted again
- if (mSource == NULL)
- {
- ALOGE("Source is null. Exit scanSources\n");
- break;
- }
-
- if (mSourceType == kHttpDashSource) {
- ALOGV("scanning sources haveAudio=%d, haveVideo=%d haveText=%d",
- mAudioDecoder != NULL, mVideoDecoder != NULL, mTextDecoder!= NULL);
- } else {
- ALOGV("scanning sources haveAudio=%d, haveVideo=%d",
- mAudioDecoder != NULL, mVideoDecoder != NULL);
- }
if(mNativeWindow != NULL) {
instantiateDecoder(kVideo, &mVideoDecoder);
@@ -467,9 +432,8 @@
if (mAudioSink != NULL) {
instantiateDecoder(kAudio, &mAudioDecoder);
}
- if (mSourceType == kHttpDashSource) {
- instantiateDecoder(kText, &mTextDecoder);
- }
+
+ instantiateDecoder(kText, &mTextDecoder);
status_t err;
if ((err = mSource->feedMoreTSData()) != OK) {
@@ -485,24 +449,17 @@
}
break;
}
- if (mSourceType == kHttpDashSource) {
- if ((mAudioDecoder == NULL && mAudioSink != NULL) ||
- (mVideoDecoder == NULL && mNativeWindow != NULL) ||
- (mTextDecoder == NULL)) {
- msg->post(100000ll);
- mScanSourcesPending = true;
- }
- } else {
- if ((mAudioDecoder == NULL && mAudioSink != NULL) ||
- (mVideoDecoder == NULL && mNativeWindow != NULL)) {
- msg->post(100000ll);
- mScanSourcesPending = true;
- }
- }
- if (mTimeDiscontinuityPending && mRenderer != NULL){
- mRenderer->signalTimeDiscontinuity();
- mTimeDiscontinuityPending = false;
- }
+ if ((mAudioDecoder == NULL && mAudioSink != NULL) ||
+ (mVideoDecoder == NULL && mNativeWindow != NULL) ||
+ (mTextDecoder == NULL)) {
+ msg->post(100000ll);
+ mScanSourcesPending = true;
+ }
+
+ if (mTimeDiscontinuityPending && mRenderer != NULL){
+ mRenderer->signalTimeDiscontinuity();
+ mTimeDiscontinuityPending = false;
+ }
}
break;
}
@@ -528,19 +485,11 @@
CHECK(codecRequest->findInt32("what", &what));
if (what == DashCodec::kWhatFillThisBuffer) {
- ALOGV("@@@@:: Dashplayer :: MESSAGE FROM DASHCODEC +++++++++++++ (%s) kWhatFillThisBuffer",mTrackName);
+ DP_MSG_LOW("@@@@:: Dashplayer :: MESSAGE FROM DASHCODEC +++++++++++++ (%s) kWhatFillThisBuffer",mTrackName);
if ( (track == kText) && (mTextDecoder == NULL)) {
break; // no need to proceed further
}
- //if Player is in pause state, for WFD use case ,store the fill Buffer events and return back
- if((mSourceType == kWfdSource) && (mPauseIndication)) {
- QueueEntry entry;
- entry.mMessageToBeConsumed = msg;
- mDecoderMessageQueue.push_back(entry);
- break;
- }
-
status_t err = feedDecoderInputData(
track, codecRequest);
@@ -552,27 +501,27 @@
else if(nRet == (status_t)UNKNOWN_ERROR ||
nRet == (status_t)ERROR_DRM_CANNOT_HANDLE) {
// reply back to dashcodec if there is an error
- ALOGE("FeedMoreTSData error on track %d ",track);
+ DP_MSG_ERROR("FeedMoreTSData error on track %d ",track);
if (track == kText) {
sendTextPacket(NULL, (status_t)UNKNOWN_ERROR);
} else {
sp<AMessage> reply;
CHECK(codecRequest->findMessage("reply", &reply));
- reply->setInt32("err", UNKNOWN_ERROR);
+ reply->setInt32("err", (status_t)UNKNOWN_ERROR);
reply->post();
}
}
}
} else if (what == DashCodec::kWhatEOS) {
- ALOGV("@@@@:: Dashplayer :: MESSAGE FROM DASHCODEC +++++++++++++++++++++++++++++++ kWhatEOS");
+ DP_MSG_ERROR("@@@@:: Dashplayer :: MESSAGE FROM DASHCODEC +++++++++++++++++++++++++++++++ kWhatEOS");
int32_t err;
CHECK(codecRequest->findInt32("err", &err));
if (err == ERROR_END_OF_STREAM) {
- ALOGW("got %s decoder EOS", mTrackName);
+ DP_MSG_HIGH("got %s decoder EOS", mTrackName);
} else {
- ALOGE("got %s decoder EOS w/ error %d",
+ DP_MSG_ERROR("got %s decoder EOS w/ error %d",
mTrackName,
err);
}
@@ -588,14 +537,14 @@
mRenderer->queueEOS(track, err);
}
else{
- ALOGE("FlushingState for %s. Decoder EOS not queued to renderer", mTrackName);
+ DP_MSG_ERROR("FlushingState for %s. Decoder EOS not queued to renderer", mTrackName);
}
}
} else if (what == DashCodec::kWhatFlushCompleted) {
- ALOGV("@@@@:: Dashplayer :: MESSAGE FROM DASHCODEC +++++++++++++++++++++++++++++++ kWhatFlushCompleted");
+ DP_MSG_ERROR("@@@@:: Dashplayer :: MESSAGE FROM DASHCODEC +++++++++++++++++++++++++++++++ kWhatFlushCompleted");
Mutex::Autolock autoLock(mLock);
- bool needShutdown;
+ bool needShutdown = false;
if (track == kAudio) {
CHECK(IsFlushingState(mFlushingAudio, &needShutdown));
@@ -607,10 +556,10 @@
mVideoLateByUs = 0;
}
- ALOGV("decoder %s flush completed", mTrackName);
+ DP_MSG_MEDIUM("decoder %s flush completed", mTrackName);
if (needShutdown) {
- ALOGV("initiating %s decoder shutdown",
+ DP_MSG_HIGH("initiating %s decoder shutdown",
mTrackName);
if (track == kAudio) {
@@ -625,14 +574,14 @@
finishFlushIfPossible();
} else if (what == DashCodec::kWhatOutputFormatChanged) {
if (track == kAudio) {
- ALOGV("@@@@:: Dashplayer :: MESSAGE FROM DASHCODEC +++++++++++++++++++++++++++++++ kWhatOutputFormatChanged:: audio");
+ DP_MSG_ERROR("@@@@:: Dashplayer :: MESSAGE FROM DASHCODEC +++++++++++++++++++++++++++++++ kWhatOutputFormatChanged:: audio");
int32_t numChannels;
CHECK(codecRequest->findInt32("channel-count", &numChannels));
int32_t sampleRate;
CHECK(codecRequest->findInt32("sample-rate", &sampleRate));
- ALOGW("Audio output format changed to %d Hz, %d channels",
+ DP_MSG_HIGH("Audio output format changed to %d Hz, %d channels",
sampleRate, numChannels);
mAudioSink->close();
@@ -673,33 +622,10 @@
}
} else if (track == kVideo) {
// video
- ALOGV("@@@@:: Dashplayer :: MESSAGE FROM DASHCODEC +++++++++++++++++++++++++++++++ kWhatOutputFormatChanged:: video");
- // No need to notify JAVA layer the message of kWhatOutputFormatChanged which will cause a flicker while changing the resolution
-#if 0
- int32_t width, height;
- CHECK(codecRequest->findInt32("width", &width));
- CHECK(codecRequest->findInt32("height", &height));
-
- int32_t cropLeft, cropTop, cropRight, cropBottom;
- CHECK(codecRequest->findRect(
- "crop",
- &cropLeft, &cropTop, &cropRight, &cropBottom));
-
- ALOGW("Video output format changed to %d x %d "
- "(crop: %d x %d @ (%d, %d))",
- width, height,
- (cropRight - cropLeft + 1),
- (cropBottom - cropTop + 1),
- cropLeft, cropTop);
-
- notifyListener(
- MEDIA_SET_VIDEO_SIZE,
- cropRight - cropLeft + 1,
- cropBottom - cropTop + 1);
-#endif
+ DP_MSG_ERROR("@@@@:: Dashplayer :: MESSAGE FROM DASHCODEC +++++++++++++++++++++++++++++++ kWhatOutputFormatChanged:: video");
}
} else if (what == DashCodec::kWhatShutdownCompleted) {
- ALOGV("%s shutdown completed", mTrackName);
+ DP_MSG_ERROR("%s shutdown completed", mTrackName);
if((track == kAudio && mFlushingAudio == SHUT_DOWN)
|| (track == kVideo && mFlushingVideo == SHUT_DOWN))
@@ -708,7 +634,7 @@
}
if (track == kAudio) {
- ALOGV("@@@@:: Dashplayer :: MESSAGE FROM DASHCODEC +++++++++++++++++++++++++++++++ kWhatShutdownCompleted:: audio");
+ DP_MSG_ERROR("@@@@:: Dashplayer :: MESSAGE FROM DASHCODEC +++++++++++++++++++++++++++++++ kWhatShutdownCompleted:: audio");
if (mAudioDecoder != NULL) {
looper()->unregisterHandler(mAudioDecoder->id());
}
@@ -716,7 +642,7 @@
mFlushingAudio = SHUT_DOWN;
} else if (track == kVideo) {
- ALOGV("@@@@:: Dashplayer :: MESSAGE FROM DASHCODEC +++++++++++++++++++++++++++++++ kWhatShutdownCompleted:: Video");
+ DP_MSG_ERROR("@@@@:: Dashplayer :: MESSAGE FROM DASHCODEC +++++++++++++++++++++++++++++++ kWhatShutdownCompleted:: Video");
if (mVideoDecoder != NULL) {
looper()->unregisterHandler(mVideoDecoder->id());
}
@@ -727,7 +653,7 @@
finishFlushIfPossible();
} else if (what == DashCodec::kWhatError) {
- ALOGE("Received error from %s decoder, aborting playback.",
+ DP_MSG_ERROR("Received error from %s decoder, aborting playback.",
mTrackName);
if(track == kVideo && mTimedTextCEAPresent)
@@ -740,20 +666,20 @@
if((track == kAudio && !IsFlushingState(mFlushingAudio)) ||
(track == kVideo && !IsFlushingState(mFlushingVideo)))
{
- ALOGV("@@@@:: Dashplayer :: MESSAGE FROM DASHCODEC +++++++++++++++++++++++++++++++ DashCodec::kWhatError:: %s",track == kAudio ? "audio" : "video");
- mRenderer->queueEOS(track, UNKNOWN_ERROR);
+ DP_MSG_ERROR("@@@@:: Dashplayer :: MESSAGE FROM DASHCODEC +++++++++++++++++++++++++++++++ DashCodec::kWhatError:: %s",track == kAudio ? "audio" : "video");
+ mRenderer->queueEOS(track, (status_t)UNKNOWN_ERROR);
}
else{
- ALOGE("EOS not queued for %d track", track);
+ DP_MSG_ERROR("EOS not queued for %d track", track);
}
}
} else if (what == DashCodec::kWhatDrainThisBuffer) {
if(track == kAudio || track == kVideo) {
- ALOGV("@@@@:: Dashplayer :: MESSAGE FROM DASHCODEC +++++++++++++++++++++++++++++++ DashCodec::kWhatRenderBuffer:: %s",track == kAudio ? "audio" : "video");
+ DP_MSG_LOW("@@@@:: Dashplayer :: MESSAGE FROM DASHCODEC +++++++++++++++++++++++++++++++ DashCodec::kWhatRenderBuffer:: %s",track == kAudio ? "audio" : "video");
renderBuffer(track, codecRequest);
}
} else {
- ALOGV("Unhandled codec notification %d.", what);
+ DP_MSG_LOW("Unhandled codec notification %d.", what);
}
break;
@@ -770,7 +696,7 @@
int32_t finalResult;
CHECK(msg->findInt32("finalResult", &finalResult));
- ALOGV("@@@@:: Dashplayer :: MESSAGE FROM RENDERER ***************** kWhatRendererNotify:: %s",audio ? "audio" : "video");
+ DP_MSG_LOW("@@@@:: Dashplayer :: MESSAGE FROM RENDERER ***************** kWhatRendererNotify:: %s",audio ? "audio" : "video");
if (audio) {
mAudioEOS = true;
} else {
@@ -778,9 +704,9 @@
}
if (finalResult == ERROR_END_OF_STREAM) {
- ALOGW("reached %s EOS", audio ? "audio" : "video");
+ DP_MSG_ERROR("reached %s EOS", audio ? "audio" : "video");
} else {
- ALOGE("%s track encountered an error (%d)",
+ DP_MSG_ERROR("%s track encountered an error (%d)",
audio ? "audio" : "video", finalResult);
notifyListener(
@@ -789,11 +715,8 @@
if ((mAudioEOS || mAudioDecoder == NULL)
&& (mVideoEOS || mVideoDecoder == NULL)) {
- if ((mSourceType == kHttpDashSource) &&
- (finalResult == ERROR_END_OF_STREAM)) {
+ if (finalResult == ERROR_END_OF_STREAM) {
notifyListener(MEDIA_PLAYBACK_COMPLETE, 0, 0);
- } else if (mSourceType != kHttpDashSource) {
- notifyListener(MEDIA_PLAYBACK_COMPLETE, 0, 0);
}
}
} else if (what == Renderer::kWhatPosition) {
@@ -801,17 +724,13 @@
CHECK(msg->findInt64("positionUs", &positionUs));
CHECK(msg->findInt64("videoLateByUs", &mVideoLateByUs));
- ALOGV("@@@@:: Dashplayer :: MESSAGE FROM RENDERER ***************** kWhatPosition:: position(%lld) VideoLateBy(%lld)",positionUs,mVideoLateByUs);
+ DP_MSG_LOW("@@@@:: Dashplayer :: MESSAGE FROM RENDERER ***************** kWhatPosition:: position(%lld) VideoLateBy(%lld)",positionUs,mVideoLateByUs);
if (mDriver != NULL) {
sp<DashPlayerDriver> driver = mDriver.promote();
if (driver != NULL) {
driver->notifyPosition(positionUs);
- //Notify rendering position used for HLS
mSource->notifyRenderingPosition(positionUs);
-
- driver->notifyFrameStats(
- mNumFramesTotal, mNumFramesDropped);
}
}
} else if (what == Renderer::kWhatFlushComplete) {
@@ -819,20 +738,15 @@
int32_t audio;
CHECK(msg->findInt32("audio", &audio));
- ALOGV("@@@@:: Dashplayer :: MESSAGE FROM RENDERER ***************** kWhatFlushComplete:: %s",audio ? "audio" : "video");
+ DP_MSG_ERROR("@@@@:: Dashplayer :: MESSAGE FROM RENDERER ***************** kWhatFlushComplete:: %s",audio ? "audio" : "video");
}
break;
}
- case kWhatMoreDataQueued:
- {
- break;
- }
-
case kWhatReset:
{
- ALOGE("kWhatReset");
+ DP_MSG_ERROR("kWhatReset");
Mutex::Autolock autoLock(mLock);
if (mRenderer != NULL) {
@@ -852,7 +766,7 @@
// We're currently flushing, postpone the reset until that's
// completed.
- ALOGV("postponing reset mFlushingAudio=%d, mFlushingVideo=%d",
+ DP_MSG_MEDIUM("postponing reset mFlushingAudio=%d, mFlushingVideo=%d",
mFlushingAudio, mFlushingVideo);
mResetPostponed = true;
@@ -889,72 +803,46 @@
status_t nRet = OK;
CHECK(msg->findInt64("seekTimeUs", &seekTimeUs));
- ALOGE("kWhatSeek seekTimeUs=%lld us (%.2f secs)",
+ DP_MSG_ERROR("kWhatSeek seekTimeUs=%lld us (%.2f secs)",
seekTimeUs, seekTimeUs / 1E6);
nRet = mSource->seekTo(seekTimeUs);
- if (mSourceType == kHttpLiveSource) {
- mSource->getNewSeekTime(&newSeekTime);
- ALOGV("newSeekTime %lld", newSeekTime);
- }
- else if (mSourceType == kHttpDashSource) {
- if (nRet == OK) { // if seek success then flush the audio,video decoder and renderer
- mTimeDiscontinuityPending = true;
- bool audPresence = false;
- bool vidPresence = false;
- bool textPresence = false;
- mSource->getMediaPresence(audPresence,vidPresence,textPresence);
- mRenderer->setMediaPresence(true,audPresence); // audio
- mRenderer->setMediaPresence(false,vidPresence); // video
- if( (mVideoDecoder != NULL) &&
- (mFlushingVideo == NONE || mFlushingVideo == AWAITING_DISCONTINUITY) ) {
- flushDecoder( false, true ); // flush video, shutdown
- }
-
- if( (mAudioDecoder != NULL) &&
- (mFlushingAudio == NONE|| mFlushingAudio == AWAITING_DISCONTINUITY) )
- {
- flushDecoder( true, true ); // flush audio, shutdown
- }
- if( mAudioDecoder == NULL ) {
- ALOGV("Audio is not there, set it to shutdown");
- mFlushingAudio = SHUT_DOWN;
- }
- if( mVideoDecoder == NULL ) {
- ALOGV("Video is not there, set it to shutdown");
- mFlushingVideo = SHUT_DOWN;
- }
- }
- else if (nRet != PERMISSION_DENIED) {
- mTimeDiscontinuityPending = true;
+ if (nRet == OK) { // if seek success then flush the audio,video decoder and renderer
+ mTimeDiscontinuityPending = true;
+ bool audPresence = false;
+ bool vidPresence = false;
+ bool textPresence = false;
+ mSource->getMediaPresence(audPresence,vidPresence,textPresence);
+ mRenderer->setMediaPresence(true,audPresence); // audio
+ mRenderer->setMediaPresence(false,vidPresence); // video
+ if( (mVideoDecoder != NULL) &&
+ (mFlushingVideo == NONE || mFlushingVideo == AWAITING_DISCONTINUITY) ) {
+ flushDecoder( false, true ); // flush video, shutdown
}
- // get the new seeked position
- newSeekTime = seekTimeUs;
- ALOGV("newSeekTime %lld", newSeekTime);
- mTimedTextCEASamplesDisc = true;
+ if( (mAudioDecoder != NULL) &&
+ (mFlushingAudio == NONE|| mFlushingAudio == AWAITING_DISCONTINUITY) )
+ {
+ flushDecoder( true, true ); // flush audio, shutdown
+ }
+ if( mAudioDecoder == NULL ) {
+ DP_MSG_LOW("Audio is not there, set it to shutdown");
+ mFlushingAudio = SHUT_DOWN;
+ }
+ if( mVideoDecoder == NULL ) {
+ DP_MSG_LOW("Video is not there, set it to shutdown");
+ mFlushingVideo = SHUT_DOWN;
+ }
}
- if( (newSeekTime >= 0 ) && (mSourceType != kHttpDashSource)) {
- mTimeDiscontinuityPending = true;
- if( (mAudioDecoder != NULL) &&
- (mFlushingAudio == NONE || mFlushingAudio == AWAITING_DISCONTINUITY) ) {
- flushDecoder( true, true );
- }
- if( (mVideoDecoder != NULL) &&
- (mFlushingVideo == NONE || mFlushingVideo == AWAITING_DISCONTINUITY) ) {
- flushDecoder( false, true );
- }
- if( mAudioDecoder == NULL ) {
- ALOGV("Audio is not there, set it to shutdown");
- mFlushingAudio = SHUT_DOWN;
+ else if (nRet != PERMISSION_DENIED) {
+ mTimeDiscontinuityPending = true;
+ }
- }
- if( mVideoDecoder == NULL ) {
- ALOGV("Video is not there, set it to shutdown");
- mFlushingVideo = SHUT_DOWN;
- }
- }
+ // get the new seeked position
+ newSeekTime = seekTimeUs;
+ DP_MSG_LOW("newSeekTime %lld", newSeekTime);
+ mTimedTextCEASamplesDisc = true;
if(mStats != NULL) {
mStats->logSeek(seekTimeUs);
@@ -977,125 +865,97 @@
case kWhatPause:
{
- ALOGE("kWhatPause");
+ DP_MSG_ERROR("kWhatPause");
CHECK(mRenderer != NULL);
mRenderer->pause();
mPauseIndication = true;
-#ifdef QCOM_WFD_SINK
- if (mSourceType == kWfdSource) {
- CHECK(mSource != NULL);
- mSource->pause();
- }
-#endif //QCOM_WFD_SINK
-
- if (mSourceType == kHttpDashSource) {
- Mutex::Autolock autoLock(mLock);
- if (mSource != NULL)
- {
- status_t nRet = mSource->pause();
- }
+ Mutex::Autolock autoLock(mLock);
+ if (mSource != NULL)
+ {
+ status_t nRet = mSource->pause();
}
break;
}
case kWhatResume:
- {
- ALOGE("kWhatResume");
- if (mSourceType == kHttpDashSource) {
- bool disc = mSource->isPlaybackDiscontinued();
- status_t status = OK;
+ {
+ DP_MSG_ERROR("kWhatResume");
+ bool disc = mSource->isPlaybackDiscontinued();
+ status_t status = OK;
- if (disc == true)
+ if (disc == true)
+ {
+ uint64_t nMin = 0, nMax = 0, nMaxDepth = 0;
+ status = mSource->getRepositionRange(&nMin, &nMax, &nMaxDepth);
+ if (status == OK)
{
- uint64_t nMin = 0, nMax = 0, nMaxDepth = 0;
- status = mSource->getRepositionRange(&nMin, &nMax, &nMaxDepth);
+ int64_t seekTimeUs = (int64_t)nMin * 1000ll;
+ DP_MSG_ERROR("kWhatSeek seekTimeUs=%lld us (%.2f secs)", seekTimeUs, seekTimeUs / 1E6);
+ status = mSource->seekTo(seekTimeUs);
if (status == OK)
{
- int64_t seekTimeUs = (int64_t)nMin * 1000ll;
+ // if seek success then flush the audio,video decoder and renderer
+ mTimeDiscontinuityPending = true;
+ bool audPresence = false;
+ bool vidPresence = false;
+ bool textPresence = false;
+ (void)mSource->getMediaPresence(audPresence,vidPresence,textPresence);
+ mRenderer->setMediaPresence(true,audPresence); // audio
+ mRenderer->setMediaPresence(false,vidPresence); // video
+ if( (mVideoDecoder != NULL) &&
+ (mFlushingVideo == NONE || mFlushingVideo == AWAITING_DISCONTINUITY) ) {
+ flushDecoder( false, true ); // flush video, shutdown
+ }
- ALOGE("kWhatSeek seekTimeUs=%lld us (%.2f secs)", seekTimeUs, seekTimeUs / 1E6);
-
- status = mSource->seekTo(seekTimeUs);
- if (status == OK)
+ if( (mAudioDecoder != NULL) &&
+ (mFlushingAudio == NONE|| mFlushingAudio == AWAITING_DISCONTINUITY) )
{
- // if seek success then flush the audio,video decoder and renderer
- mTimeDiscontinuityPending = true;
- bool audPresence = false;
- bool vidPresence = false;
- bool textPresence = false;
- (void)mSource->getMediaPresence(audPresence,vidPresence,textPresence);
- mRenderer->setMediaPresence(true,audPresence); // audio
- mRenderer->setMediaPresence(false,vidPresence); // video
- if( (mVideoDecoder != NULL) &&
- (mFlushingVideo == NONE || mFlushingVideo == AWAITING_DISCONTINUITY) ) {
- flushDecoder( false, true ); // flush video, shutdown
- }
+ flushDecoder( true, true ); // flush audio, shutdown
+ }
+ if( mAudioDecoder == NULL ) {
+ DP_MSG_MEDIUM("Audio is not there, set it to shutdown");
+ mFlushingAudio = SHUT_DOWN;
+ }
+ if( mVideoDecoder == NULL ) {
+ DP_MSG_MEDIUM("Video is not there, set it to shutdown");
+ mFlushingVideo = SHUT_DOWN;
+ }
- if( (mAudioDecoder != NULL) &&
- (mFlushingAudio == NONE|| mFlushingAudio == AWAITING_DISCONTINUITY) )
+ if (mDriver != NULL)
+ {
+ sp<DashPlayerDriver> driver = mDriver.promote();
+ if (driver != NULL)
{
- flushDecoder( true, true ); // flush audio, shutdown
- }
- if( mAudioDecoder == NULL ) {
- ALOGV("Audio is not there, set it to shutdown");
- mFlushingAudio = SHUT_DOWN;
- }
- if( mVideoDecoder == NULL ) {
- ALOGV("Video is not there, set it to shutdown");
- mFlushingVideo = SHUT_DOWN;
- }
-
- if (mDriver != NULL)
- {
- sp<DashPlayerDriver> driver = mDriver.promote();
- if (driver != NULL)
- {
- if( seekTimeUs >= 0 ) {
- mRenderer->notifySeekPosition(seekTimeUs);
- driver->notifyPosition( seekTimeUs );
- }
+ if( seekTimeUs >= 0 ) {
+ mRenderer->notifySeekPosition(seekTimeUs);
+ driver->notifyPosition( seekTimeUs );
}
}
-
- mTimedTextCEASamplesDisc = true;
}
+
+ mTimedTextCEASamplesDisc = true;
}
}
+ }
- if (status != OK)
- {
- //Notify error?
- ALOGE(" Dash Source playback discontinuity check failure");
- notifyListener(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, status);
- }
+ if (status != OK)
+ {
+ //Notify error?
+ DP_MSG_ERROR(" Dash Source playback discontinuity check failure");
+ notifyListener(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, status);
+ }
- Mutex::Autolock autoLock(mLock);
- if (mSource != NULL) {
- status_t nRet = mSource->resume();
- }
- if (mAudioDecoder == NULL || mVideoDecoder == NULL || mTextDecoder == NULL) {
+ Mutex::Autolock autoLock(mLock);
+ if (mSource != NULL) {
+ status_t nRet = mSource->resume();
+ }
+
+ if (mAudioDecoder == NULL || mVideoDecoder == NULL || mTextDecoder == NULL) {
mScanSourcesPending = false;
postScanSources();
- }
- }else if (mSourceType == kWfdSource) {
- CHECK(mSource != NULL);
- mSource->resume();
- int count = 0;
- //check if there are messages stored in the list, then repost them
- while(!mDecoderMessageQueue.empty()) {
- (*mDecoderMessageQueue.begin()).mMessageToBeConsumed->post(); //self post
- mDecoderMessageQueue.erase(mDecoderMessageQueue.begin());
- ++count;
- }
- ALOGE("(%d) stored messages reposted ....",count);
- }else {
- if (mAudioDecoder == NULL || mVideoDecoder == NULL) {
- mScanSourcesPending = false;
- postScanSources();
- }
}
CHECK(mRenderer != NULL);
@@ -1104,16 +964,16 @@
mPauseIndication = false;
break;
- }
+ }
case kWhatPrepareAsync:
if (mSource == NULL)
{
- ALOGE("Source is null in prepareAsync\n");
+ DP_MSG_ERROR("Source is null in prepareAsync\n");
break;
}
- ALOGE("kWhatPrepareAsync");
+ DP_MSG_ERROR("kWhatPrepareAsync");
mSource->prepareAsync();
postIsPrepareDone();
break;
@@ -1121,7 +981,7 @@
case kWhatIsPrepareDone:
if (mSource == NULL)
{
- ALOGE("Source is null when checking for prepare done\n");
+ DP_MSG_ERROR("Source is null when checking for prepare done\n");
break;
}
@@ -1135,31 +995,31 @@
driver->notifyDuration(durationUs);
}
}
- ALOGE("PrepareDone complete\n");
+ DP_MSG_ERROR("PrepareDone complete\n");
notifyListener(MEDIA_PREPARED, 0, 0);
} else if(err == -EWOULDBLOCK) {
msg->post(100000ll);
} else {
- ALOGE("Prepareasync failed\n");
+ DP_MSG_ERROR("Prepareasync failed\n");
notifyListener(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, err);
}
break;
case kWhatSourceNotify:
{
Mutex::Autolock autoLock(mLock);
- ALOGV("kWhatSourceNotify");
+ DP_MSG_ERROR("kWhatSourceNotify");
if(mSource != NULL) {
int64_t track;
sp<AMessage> sourceRequest;
- ALOGD("kWhatSourceNotify - looking for source-request");
+ DP_MSG_MEDIUM("kWhatSourceNotify - looking for source-request");
// attempt to find message by different names
bool msgFound = msg->findMessage("source-request", &sourceRequest);
int32_t handled;
if (!msgFound){
- ALOGD("kWhatSourceNotify source-request not found, trying using sourceRequestID");
+ DP_MSG_MEDIUM("kWhatSourceNotify source-request not found, trying using sourceRequestID");
char srName[] = "source-request00";
srName[strlen("source-request")] += mSRid/10;
srName[strlen("source-request")+sizeof(char)] += mSRid%10;
@@ -1174,15 +1034,13 @@
CHECK(sourceRequest->findInt32("what", &what));
if (what == kWhatBufferingStart) {
-
sourceRequest->findInt64("track", &track);
getTrackName((int)track,mTrackName);
- ALOGE("Source Notified Buffering Start for %s ",mTrackName);
-
+ DP_MSG_ERROR("Source Notified Buffering Start for %s ",mTrackName);
if (mBufferingNotification == false) {
if (track == kVideo && mNativeWindow == NULL)
{
- ALOGE("video decoder not instantiated, no buffering for video",
+ DP_MSG_ERROR("video decoder not instantiated, no buffering for video(%d)",
mBufferingNotification);
}
else
@@ -1192,7 +1050,7 @@
}
}
else {
- ALOGE("Buffering Start Event Already Notified mBufferingNotification(%d)",
+ DP_MSG_MEDIUM("Buffering Start Event Already Notified mBufferingNotification(%d)",
mBufferingNotification);
}
}
@@ -1200,7 +1058,7 @@
sourceRequest->findInt64("track", &track);
getTrackName((int)track,mTrackName);
if (mBufferingNotification) {
- ALOGE("Source Notified Buffering End for %s ",mTrackName);
+ DP_MSG_ERROR("Source Notified Buffering End for %s ",mTrackName);
mBufferingNotification = false;
notifyListener(MEDIA_INFO, MEDIA_INFO_BUFFERING_END, 0);
if(mStats != NULL) {
@@ -1208,14 +1066,14 @@
}
}
else {
- ALOGE("No need to notify Buffering end as mBufferingNotification is (%d) "
+ DP_MSG_MEDIUM("No need to notify Buffering end as mBufferingNotification is (%d) "
,mBufferingNotification);
}
}
+ }
}
- }
else {
- ALOGE("kWhatSourceNotify - Source object does not exist anymore");
+ DP_MSG_ERROR("kWhatSourceNotify - Source object does not exist anymore");
}
break;
}
@@ -1297,14 +1155,14 @@
!mResetInProgress && !mResetPostponed &&
((mVideoDecoder != NULL) && (mFlushingVideo == NONE || mFlushingVideo == AWAITING_DISCONTINUITY)))
{
- ALOGV("Resuming Audio after Shutdown(Discontinuity)");
+ DP_MSG_LOW("Resuming Audio after Shutdown(Discontinuity)");
mFlushingAudio = NONE;
postScanSources();
return;
}
//If reset was postponed after one of the streams is flushed, complete it now
if (mResetPostponed) {
- ALOGV("finishFlushIfPossible Handle reset postpone ");
+ DP_MSG_LOW("finishFlushIfPossible Handle reset postpone ");
if ((mAudioDecoder != NULL) &&
(mFlushingAudio == NONE || mFlushingAudio == AWAITING_DISCONTINUITY )) {
flushDecoder( true, true );
@@ -1317,16 +1175,16 @@
//Check if both audio & video are flushed
if (mFlushingAudio != FLUSHED && mFlushingAudio != SHUT_DOWN) {
- ALOGV("Dont finish flush, audio is in state %d ", mFlushingAudio);
+ DP_MSG_LOW("Dont finish flush, audio is in state %d ", mFlushingAudio);
return;
}
if (mFlushingVideo != FLUSHED && mFlushingVideo != SHUT_DOWN) {
- ALOGV("Dont finish flush, video is in state %d ", mFlushingVideo);
+ DP_MSG_LOW("Dont finish flush, video is in state %d ", mFlushingVideo);
return;
}
- ALOGV("both audio and video are flushed now.");
+ DP_MSG_HIGH("both audio and video are flushed now.");
if ((mRenderer != NULL) && (mTimeDiscontinuityPending) &&
!isSetSurfaceTexturePending) {
@@ -1335,12 +1193,12 @@
}
if (mAudioDecoder != NULL) {
- ALOGV("Resume Audio after flush");
+ DP_MSG_LOW("Resume Audio after flush");
mAudioDecoder->signalResume();
}
if (mVideoDecoder != NULL) {
- ALOGV("Resume Video after flush");
+ DP_MSG_LOW("Resume Video after flush");
mVideoDecoder->signalResume();
}
@@ -1348,24 +1206,23 @@
mFlushingVideo = NONE;
if (mResetInProgress) {
- ALOGE("reset completed");
+ DP_MSG_ERROR("reset completed");
mResetInProgress = false;
finishReset();
} else if (mResetPostponed) {
(new AMessage(kWhatReset, id()))->post();
mResetPostponed = false;
- ALOGV("Handle reset postpone");
+ DP_MSG_LOW("Handle reset postpone");
}else if(isSetSurfaceTexturePending){
- processDeferredActions();
- ALOGE("DashPlayer::finishFlushIfPossible() setsurfacetexturepending=true");
+ processDeferredActions();
+ DP_MSG_ERROR("DashPlayer::finishFlushIfPossible() setsurfacetexturepending=true");
} else if (mAudioDecoder == NULL || mVideoDecoder == NULL) {
- ALOGV("Start scanning for sources after shutdown");
- if ( (mSourceType == kHttpDashSource) &&
- (mTextDecoder != NULL) )
+ DP_MSG_LOW("Start scanning for sources after shutdown");
+ if (mTextDecoder != NULL)
{
if (mSource != NULL) {
- ALOGV("finishFlushIfPossible calling mSource->stop");
+ DP_MSG_LOW("finishFlushIfPossible calling mSource->stop");
mSource->stop();
}
sp<AMessage> codecRequest;
@@ -1394,12 +1251,12 @@
}
if (mSource != NULL) {
- ALOGV("finishReset calling mSource->stop");
+ DP_MSG_ERROR("finishReset calling mSource->stop");
mSource->stop();
mSource.clear();
}
- if ( (mSourceType == kHttpDashSource) && (mTextDecoder != NULL) && (mTextNotify != NULL))
+ if ( (mTextDecoder != NULL) && (mTextNotify != NULL))
{
sp<AMessage> codecRequest;
mTextNotify->findMessage("codec-request", &codecRequest);
@@ -1407,7 +1264,7 @@
mTextNotify = NULL;
looper()->unregisterHandler(mTextDecoder->id());
mTextDecoder.clear();
- ALOGE("Text Dummy Decoder Deleted");
+ DP_MSG_ERROR("Text Dummy Decoder Deleted");
}
if (mSourceNotify != NULL)
{
@@ -1445,7 +1302,7 @@
}
status_t DashPlayer::instantiateDecoder(int track, sp<Decoder> *decoder) {
- ALOGV("@@@@:: instantiateDecoder Called ");
+ DP_MSG_LOW("@@@@:: instantiateDecoder Called ");
if (*decoder != NULL) {
return OK;
}
@@ -1464,27 +1321,12 @@
mStats->setMime(mime);
}
- //TO-DO:: Similarly set here for Decode order
-#ifdef ANDROID_JB_MR2
- if (mVideoIsAVC &&
- ((mSourceType == kHttpLiveSource) || (mSourceType == kHttpDashSource) ||(mSourceType == kWfdSource))) {
- ALOGV("Set Enable smooth streaming in meta data ");
- meta->setInt32(kKeySmoothStreaming, 1);
- }
-#endif
-
- int32_t isDRMSecBuf = 0;
- meta->findInt32(kKeyRequiresSecureBuffers, &isDRMSecBuf);
- if(isDRMSecBuf) {
- mIsSecureInputBuffers = true;
- }
-
if (mSetVideoSize) {
int32_t width = 0;
meta->findInt32(kKeyWidth, &width);
int32_t height = 0;
meta->findInt32(kKeyHeight, &height);
- ALOGE("instantiate video decoder, send wxh = %dx%d",width,height);
+ DP_MSG_HIGH("instantiate video decoder, send wxh = %dx%d",width,height);
notifyListener(MEDIA_SET_VIDEO_SIZE, width, height);
mSetVideoSize = false;
}
@@ -1493,17 +1335,17 @@
sp<AMessage> notify;
if (track == kAudio) {
notify = new AMessage(kWhatAudioNotify ,id());
- ALOGV("Creating Audio Decoder ");
+ DP_MSG_HIGH("Creating Audio Decoder ");
*decoder = new Decoder(notify);
- ALOGV("@@@@:: setting Sink/Renderer pointer to decoder");
+ DP_MSG_LOW("@@@@:: setting Sink/Renderer pointer to decoder");
(*decoder)->setSink(mAudioSink, mRenderer);
- if (mRenderer != NULL) {
+ if (mRenderer != NULL) {
mRenderer->setMediaPresence(true,true);
}
} else if (track == kVideo) {
notify = new AMessage(kWhatVideoNotify ,id());
*decoder = new Decoder(notify, mNativeWindow);
- ALOGV("Creating Video Decoder ");
+ DP_MSG_HIGH("Creating Video Decoder ");
if (mRenderer != NULL) {
mRenderer->setMediaPresence(false,true);
}
@@ -1513,8 +1355,8 @@
sp<AMessage> codecRequest = new AMessage;
codecRequest->setInt32("what", DashCodec::kWhatFillThisBuffer);
mTextNotify->setMessage("codec-request", codecRequest);
- ALOGV("Creating Dummy Text Decoder ");
- if ((mSource != NULL) && (mSourceType == kHttpDashSource)) {
+ DP_MSG_HIGH("Creating Dummy Text Decoder ");
+ if (mSource != NULL) {
mSource->setupSourceData(mTextNotify, track);
}
}
@@ -1522,15 +1364,12 @@
looper()->registerHandler(*decoder);
char value[PROPERTY_VALUE_MAX] = {0};
- if (mSourceType == kHttpLiveSource || mSourceType == kHttpDashSource){
- //Set flushing state to none
- Mutex::Autolock autoLock(mLock);
- if(track == kAudio) {
- mFlushingAudio = NONE;
- } else if (track == kVideo) {
- mFlushingVideo = NONE;
-
- }
+ //Set flushing state to none
+ Mutex::Autolock autoLock(mLock);
+ if(track == kAudio) {
+ mFlushingAudio = NONE;
+ } else if (track == kVideo) {
+ mFlushingVideo = NONE;
}
if( track == kAudio || track == kVideo) {
@@ -1574,19 +1413,7 @@
bool dropAccessUnit;
do {
- status_t err = UNKNOWN_ERROR;
-
- if (mIsSecureInputBuffers && track == kVideo) {
- msg->findBuffer("buffer", &accessUnit);
-
- if (accessUnit == NULL) {
- ALOGE("Dashplayer NULL buffer in message");
- return err;
- } else {
- ALOGV("Dashplayer buffer in message %d %d",
- accessUnit->data(), accessUnit->capacity());
- }
- }
+ status_t err = (status_t)UNKNOWN_ERROR;
err = mSource->dequeueAccessUnit(track, &accessUnit);
@@ -1605,7 +1432,7 @@
bool timeChange = (type & ATSParser::DISCONTINUITY_TIME) != 0;
- ALOGW("%s discontinuity (formatChange=%d, time=%d)",
+ DP_MSG_HIGH("%s discontinuity (formatChange=%d, time=%d)",
mTrackName, formatChange, timeChange);
if (track == kAudio) {
@@ -1621,7 +1448,7 @@
int64_t resumeAtMediaTimeUs;
if (extra->findInt64(
"resume-at-mediatimeUs", &resumeAtMediaTimeUs)) {
- ALOGW("suppressing rendering of %s until %lld us",
+ DP_MSG_HIGH("suppressing rendering of %s until %lld us",
mTrackName, resumeAtMediaTimeUs);
if (track == kAudio) {
@@ -1664,7 +1491,7 @@
}
else if ((track == kText) &&
(err == ERROR_END_OF_STREAM || err == (status_t)UNKNOWN_ERROR)) {
- ALOGE("Text track has encountered error %d", err );
+ DP_MSG_ERROR("Text track has encountered error %d", err );
sendTextPacket(NULL, err);
return err;
}
@@ -1672,7 +1499,6 @@
dropAccessUnit = false;
if (track == kVideo) {
- ++mNumFramesTotal;
if(mStats != NULL) {
mStats->incrementTotalFrames();
@@ -1680,10 +1506,8 @@
if (mVideoLateByUs > 100000ll
&& mVideoIsAVC
- && !mIsSecureInputBuffers
&& !IsAVCReferenceFrame(accessUnit)) {
dropAccessUnit = true;
- ++mNumFramesDropped;
if(mStats != NULL) {
mStats->incrementDroppedFrames();
}
@@ -1691,19 +1515,12 @@
}
} while (dropAccessUnit);
- // ALOGV("returned a valid buffer of %s data", mTrackName);
+ // DP_MSG_LOW("returned a valid buffer of %s data", mTrackName);
-#if 0
- int64_t mediaTimeUs;
- CHECK(accessUnit->meta()->findInt64("timeUs", &mediaTimeUs));
- ALOGV("feeding %s input buffer at media time %.2f secs",
- mTrackName,
- mediaTimeUs / 1E6);
-#endif
if (track == kVideo || track == kAudio) {
reply->setBuffer("buffer", accessUnit);
reply->post();
- } else if (mSourceType == kHttpDashSource && track == kText) {
+ } else if (track == kText) {
sendTextPacket(accessUnit,OK);
if (mSource != NULL) {
mSource->postNextTextSample(accessUnit,mTextNotify,track);
@@ -1713,7 +1530,7 @@
}
void DashPlayer::renderBuffer(bool audio, const sp<AMessage> &msg) {
- // ALOGV("renderBuffer %s", audio ? "audio" : "video");
+ // DP_MSG_LOW("renderBuffer %s", audio ? "audio" : "video");
sp<AMessage> reply;
CHECK(msg->findMessage("reply", &reply));
@@ -1725,7 +1542,7 @@
// so we don't want any output buffers it sent us (from before
// we initiated the flush) to be stuck in the renderer's queue.
- ALOGV("we're still flushing the %s decoder, sending its output buffer"
+ DP_MSG_MEDIUM("we're still flushing the %s decoder, sending its output buffer"
" right back.", audio ? "audio" : "video");
reply->post();
@@ -1745,7 +1562,7 @@
CHECK(buffer->meta()->findInt64("timeUs", &mediaTimeUs));
if (mediaTimeUs < skipUntilMediaTimeUs) {
- ALOGV("dropping %s buffer at time %lld as requested.",
+ DP_MSG_HIGH("dropping %s buffer at time %lld as requested.",
audio ? "audio" : "video",
mediaTimeUs);
@@ -1766,7 +1583,7 @@
if (nFlags & OMX_BUFFERFLAG_EXTRADATA)
{
- ALOGV("kwhatdrainthisbuffer: Decoded sample contains SEI. Parse for CEA encoded cc extradata");
+ DP_MSG_HIGH("kwhatdrainthisbuffer: Decoded sample contains SEI. Parse for CEA encoded cc extradata");
OMX_U8* bufferHandle = NULL;
int64_t nFilledLen = 0;
@@ -1780,16 +1597,16 @@
private_handle_t *privHandle = (private_handle_t *) bufferHandle;
- ALOGV("Decoded fbd bufferHandle fd %d, size %d\n", privHandle->fd, privHandle->size);
+ DP_MSG_LOW("Decoded fbd bufferHandle fd %d, size %d\n", privHandle->fd, privHandle->size);
OMX_U8* buffVaddr = (OMX_U8*)mmap(NULL, privHandle->size,
PROT_READ|PROT_WRITE, MAP_SHARED, privHandle->fd, 0);
- ALOGV("Decoded yuv stream buffVaddr %p\n", buffVaddr);
+ DP_MSG_LOW("Decoded yuv stream buffVaddr %p\n", buffVaddr);
if (buffVaddr == MAP_FAILED)
{
- ALOGE("errno is %d", errno);
+ DP_MSG_ERROR("errno is %d", errno);
}
else
{
@@ -1800,7 +1617,7 @@
((OMX_U8*)pExtra + pExtra->nSize) <= ((OMX_U8*)buffVaddr + nAllocLen) &&
pExtra->eType != OMX_ExtraDataNone )
{
- ALOGV(
+ DP_MSG_LOW(
"============== Extra Data ==============\n"
" Size: %lu\n"
" Version: %lu\n"
@@ -1816,7 +1633,7 @@
OMX_U8 *data_ptr = (OMX_U8 *)userdata->data;
OMX_U32 userdata_size = pExtra->nDataSize - sizeof(userdata->type);
- ALOGV(
+ DP_MSG_LOW(
"-------------- OMX_ExtraDataMP2UserData Userdata -------------\n"
" Stream userdata type: %lu\n"
" userdata size: %lu\n"
@@ -1824,12 +1641,12 @@
userdata->type, userdata_size);
for (uint32_t i = 0; i < userdata_size; i+=4) {
- ALOGE(" %x %x %x %x",
+ DP_MSG_ERROR(" %x %x %x %x",
data_ptr[i], data_ptr[i+1],
data_ptr[i+2], data_ptr[i+3]);
}
- ALOGV(
+ DP_MSG_LOW(
"-------------- End of OMX_ExtraDataMP2UserData Userdata -----------");
/*
@@ -1861,7 +1678,7 @@
&& 0x47 == data_ptr[3] && 0x41 == data_ptr[4] && 0x39 == data_ptr[5] && 0x34 == data_ptr[6]
&& 0x03 == data_ptr[7])
{
- ALOGV("SEI payload user_data_type_code is CEA encoded MPEG_cc_data()");
+ DP_MSG_HIGH("SEI payload user_data_type_code is CEA encoded MPEG_cc_data()");
OMX_U32 cc_data_size = 0;
for(int i = 8; data_ptr[i] != 0xFF /*each cc_data ends with marker bits*/; i++)
@@ -1871,18 +1688,18 @@
if(cc_data_size > 0)
{
- ALOGV(
+ DP_MSG_LOW(
"-------------- MPEG_cc_data() -------------\n"
" cc_data ptr: %p cc_data_size: %lu\n",
&data_ptr[8], cc_data_size);
for (uint32_t i = 8; i < 8 + cc_data_size; i+=4) {
- ALOGV(" %x %x %x %x",
+ DP_MSG_LOW(" %x %x %x %x",
data_ptr[i], data_ptr[i+1],
data_ptr[i+2], data_ptr[i+3]);
}
- ALOGV(
+ DP_MSG_LOW(
"-------------- End of MPEG_cc_data() -------------\n");
sp<ABuffer> accessUnit = new ABuffer((OMX_U8*)&data_ptr[8], cc_data_size);
@@ -1943,7 +1760,7 @@
void DashPlayer::flushDecoder(bool audio, bool needShutdown) {
if ((audio && mAudioDecoder == NULL) || (!audio && mVideoDecoder == NULL)) {
- ALOGI("flushDecoder %s without decoder present",
+ DP_MSG_HIGH("flushDecoder %s without decoder present",
audio ? "audio" : "video");
}
@@ -1987,11 +1804,10 @@
sp<DashPlayer::Source>
DashPlayer::LoadCreateSource(const char * uri, const KeyedVector<String8,String8> *headers,
- bool uidValid, uid_t uid, NuSourceType srcTyp)
+ bool uidValid, uid_t uid)
{
const char* STREAMING_SOURCE_LIB = "libmmipstreamaal.so";
const char* DASH_HTTP_LIVE_CREATE_SOURCE = "CreateDashHttpLiveSource";
- const char* WFD_CREATE_SOURCE = "CreateWFDSource";
void* pStreamingSourceLib = NULL;
typedef DashPlayer::Source* (*SourceFactory)(const char * uri, const KeyedVector<String8, String8> *headers, bool uidValid, uid_t uid);
@@ -2000,52 +1816,41 @@
pStreamingSourceLib = ::dlopen(STREAMING_SOURCE_LIB, RTLD_LAZY);
if (pStreamingSourceLib == NULL) {
- ALOGV("@@@@:: STREAMING Source Library (libmmipstreamaal.so) Load Failed Error : %s ",::dlerror());
+ DP_MSG_ERROR("@@@@:: STREAMING Source Library (libmmipstreamaal.so) Load Failed Error : %s ",::dlerror());
return NULL;
}
- SourceFactory StreamingSourcePtr;
+ SourceFactory StreamingSourcePtr = NULL;
- if(srcTyp == kHttpDashSource) {
-
- /* Get the entry level symbol which gets us the pointer to DASH HTTP Live Source object */
- StreamingSourcePtr = (SourceFactory) dlsym(pStreamingSourceLib, DASH_HTTP_LIVE_CREATE_SOURCE);
- } else if (srcTyp == kWfdSource){
-
- /* Get the entry level symbol which gets us the pointer to WFD Source object */
- StreamingSourcePtr = (SourceFactory) dlsym(pStreamingSourceLib, WFD_CREATE_SOURCE);
-
- }
+ StreamingSourcePtr = (SourceFactory) dlsym(pStreamingSourceLib, DASH_HTTP_LIVE_CREATE_SOURCE);
if (StreamingSourcePtr == NULL) {
- ALOGV("@@@@:: CreateDashHttpLiveSource symbol not found in libmmipstreamaal.so, return NULL ");
+ DP_MSG_ERROR("@@@@:: CreateDashHttpLiveSource symbol not found in libmmipstreamaal.so, return NULL ");
return NULL;
}
- /*Get the Streaming (DASH\WFD) Source object, which will be used to communicate with Source (DASH\WFD) */
+ /*Get the Streaming (DASH) Source object, which will be used to communicate with Source (DASH) */
sp<DashPlayer::Source> StreamingSource = StreamingSourcePtr(uri, headers, uidValid, uid);
if(StreamingSource==NULL) {
- ALOGV("@@@@:: StreamingSource failed to instantiate Source ");
+ DP_MSG_ERROR("@@@@:: StreamingSource failed to instantiate Source ");
return NULL;
}
-
return StreamingSource;
}
status_t DashPlayer::prepareAsync() // only for DASH
{
- if (mSourceType == kHttpDashSource) {
- sp<AMessage> msg = new AMessage(kWhatPrepareAsync, id());
- if (msg == NULL)
- {
- ALOGE("Out of memory, AMessage is null for kWhatPrepareAsync\n");
- return NO_MEMORY;
- }
- msg->post();
- return -EWOULDBLOCK;
+ sp<AMessage> msg = new AMessage(kWhatPrepareAsync, id());
+ if (msg == NULL)
+ {
+ DP_MSG_ERROR("Out of memory, AMessage is null for kWhatPrepareAsync\n");
+ return NO_MEMORY;
}
+ msg->post();
+ return -EWOULDBLOCK;
+
return OK;
}
@@ -2060,8 +1865,8 @@
if (mSource == NULL)
{
- ALOGE("Source is NULL in getParameter\n");
- return UNKNOWN_ERROR;
+ DP_MSG_ERROR("Source is NULL in getParameter\n");
+ return ((status_t)UNKNOWN_ERROR);
}
if (key == KEY_DASH_REPOSITION_RANGE)
{
@@ -2073,11 +1878,11 @@
reply->writeInt64(nMin);
reply->writeInt64(nMax);
reply->writeInt64(nMaxDepth);
- ALOGV("DashPlayer::getParameter KEY_DASH_REPOSITION_RANGE %lld, %lld", nMin, nMax);
+ DP_MSG_LOW("DashPlayer::getParameter KEY_DASH_REPOSITION_RANGE %lld, %lld", nMin, nMax);
}
else
{
- ALOGE("DashPlayer::getParameter KEY_DASH_REPOSITION_RANGE err in NOT OK");
+ DP_MSG_ERROR("DashPlayer::getParameter KEY_DASH_REPOSITION_RANGE err in NOT OK");
}
}
else if(key == INVOKE_ID_GET_TRACK_INFO)
@@ -2121,7 +1926,7 @@
reply->write((const uint8_t *)videoUrl.c_str(), videoSize+1);
}else
{
- ALOGE("DashPlayerStats::getParameter : data_8 is null");
+ DP_MSG_ERROR("DashPlayerStats::getParameter : data_8 is null");
}
}
}
@@ -2129,7 +1934,7 @@
{
if (err != OK)
{
- ALOGE("source getParameter returned error: %d\n",err);
+ DP_MSG_ERROR("source getParameter returned error: %d\n",err);
return err;
}
@@ -2137,7 +1942,7 @@
data_16 = malloc(data_16_Size);
if (data_16 == NULL)
{
- ALOGE("Out of memory in getParameter\n");
+ DP_MSG_ERROR("Out of memory in getParameter\n");
return NO_MEMORY;
}
@@ -2160,7 +1965,7 @@
void * data = malloc(len + 1);
if (data == NULL)
{
- ALOGE("Out of memory in setParameter\n");
+ DP_MSG_ERROR("Out of memory in setParameter\n");
return NO_MEMORY;
}
@@ -2180,7 +1985,7 @@
sp<AMessage> msg = new AMessage(kWhatIsPrepareDone, id());
if (msg == NULL)
{
- ALOGE("Out of memory, AMessage is null for kWhatIsPrepareDone\n");
+ DP_MSG_ERROR("Out of memory, AMessage is null for kWhatIsPrepareDone\n");
return;
}
msg->post();
@@ -2188,7 +1993,7 @@
void DashPlayer::sendTextPacket(sp<ABuffer> accessUnit,status_t err, TimedTextType eTimedTextType)
{
if(!mQCTimedTextListenerPresent)
-{
+ {
return;
}
@@ -2221,7 +2026,7 @@
{
parcel.writeInt32(TIMED_TEXT_FLAG_EOS);
// write size of sample
- ALOGE("sendTextPacket Error End Of Stream EOS");
+ DP_MSG_ERROR("sendTextPacket Error End Of Stream EOS");
mFrameType = TIMED_TEXT_FLAG_EOS;
notifyListener(MEDIA_TIMED_TEXT, 0, mFrameType, &parcel);
return;
@@ -2229,9 +2034,9 @@
int32_t tCodecConfig = 0;
accessUnit->meta()->findInt32("conf", &tCodecConfig);
- if (tCodecConfig)
+ if(tCodecConfig)
{
- ALOGV("Timed text codec config frame");
+ DP_MSG_HIGH("Timed text codec config frame");
parcel.writeInt32(TIMED_TEXT_FLAG_CODEC_CONFIG);
mFrameType = TIMED_TEXT_FLAG_CODEC_CONFIG;
}
@@ -2245,7 +2050,7 @@
accessUnit->meta()->findInt32("disc", &bDisc);
if(bDisc == 1)
{
- ALOGV("sendTextPacket signal discontinuity");
+ DP_MSG_HIGH("sendTextPacket signal discontinuity");
parcel.writeInt32(KEY_TEXT_DISCONTINUITY);
}
@@ -2263,11 +2068,11 @@
parcel.writeInt32(KEY_START_TIME);
parcel.writeInt32((int32_t)(mediaTimeUs / 1000)); // convert micro sec to milli sec
- ALOGV("sendTextPacket Text Track Timestamp (%0.2f) sec",mediaTimeUs / 1E6);
+ DP_MSG_HIGH("sendTextPacket Text Track Timestamp (%0.2f) sec",mediaTimeUs / 1E6);
int32_t height = 0;
if (accessUnit->meta()->findInt32("height", &height)) {
- ALOGV("sendTextPacket Height (%d)",height);
+ DP_MSG_LOW("sendTextPacket Height (%d)",height);
parcel.writeInt32(KEY_HEIGHT);
parcel.writeInt32(height);
}
@@ -2275,7 +2080,7 @@
// width
int32_t width = 0;
if (accessUnit->meta()->findInt32("width", &width)) {
- ALOGE("sendTextPacket width (%d)",width);
+ DP_MSG_LOW("sendTextPacket width (%d)",width);
parcel.writeInt32(KEY_WIDTH);
parcel.writeInt32(width);
}
@@ -2283,7 +2088,7 @@
// Duration
int32_t duration = 0;
if (accessUnit->meta()->findInt32("duration", &duration)) {
- ALOGE("sendTextPacket duration (%d)",duration);
+ DP_MSG_LOW("sendTextPacket duration (%d)",duration);
parcel.writeInt32(KEY_DURATION);
parcel.writeInt32(duration);
}
@@ -2291,7 +2096,7 @@
// start offset
int32_t startOffset = 0;
if (accessUnit->meta()->findInt32("startoffset", &startOffset)) {
- ALOGE("sendTextPacket startOffset (%d)",startOffset);
+ DP_MSG_LOW("sendTextPacket startOffset (%d)",startOffset);
parcel.writeInt32(KEY_START_OFFSET);
parcel.writeInt32(startOffset);
}
@@ -2299,7 +2104,7 @@
// SubInfoSize
int32_t subInfoSize = 0;
if (accessUnit->meta()->findInt32("subSz", &subInfoSize)) {
- ALOGE("sendTextPacket subInfoSize (%d)",subInfoSize);
+ DP_MSG_LOW("sendTextPacket subInfoSize (%d)",subInfoSize);
}
// SubInfo
@@ -2340,19 +2145,16 @@
void DashPlayer::prepareSource()
{
- if (mSourceType == kHttpDashSource)
+ mSourceNotify = new AMessage(kWhatSourceNotify ,id());
+ mQOENotify = new AMessage(kWhatQOE,id());
+ if (mSource != NULL)
{
- mSourceNotify = new AMessage(kWhatSourceNotify ,id());
- mQOENotify = new AMessage(kWhatQOE,id());
- if (mSource != NULL)
- {
- mSource->setupSourceData(mSourceNotify,kTrackAll);
- mSource->setupSourceData(mQOENotify,-1);
- }
+ mSource->setupSourceData(mSourceNotify,kTrackAll);
+ mSource->setupSourceData(mQOENotify,-1);
}
}
-status_t DashPlayer::dump(int fd, const Vector<String16> & /*args*/)
+status_t DashPlayer::dump(int fd, const Vector<String16> &/*args*/)
{
if(mStats != NULL) {
mStats->setFileDescAndOutputStream(fd);
@@ -2364,7 +2166,7 @@
void DashPlayer::setQCTimedTextListener(const bool val)
{
mQCTimedTextListenerPresent = val;
- ALOGE("QCTimedtextlistener turned %s", mQCTimedTextListenerPresent ? "ON" : "OFF");
+ DP_MSG_HIGH("QCTimedtextlistener turned %s", mQCTimedTextListenerPresent ? "ON" : "OFF");
}
void DashPlayer::processDeferredActions() {
@@ -2389,7 +2191,7 @@
// We're currently flushing, postpone the reset until that's
// completed.
- ALOGE("postponing action mFlushingAudio=%d, mFlushingVideo=%d",
+ DP_MSG_ERROR("postponing action mFlushingAudio=%d, mFlushingVideo=%d",
mFlushingAudio, mFlushingVideo);
break;
@@ -2403,7 +2205,7 @@
}
void DashPlayer::performSetSurface(const sp<NativeWindowWrapper> &wrapper) {
- ALOGV("performSetSurface");
+ DP_MSG_HIGH("performSetSurface");
mNativeWindow = wrapper;
@@ -2421,7 +2223,7 @@
}
void DashPlayer::performScanSources() {
- ALOGV("performScanSources");
+ DP_MSG_ERROR("performScanSources");
//if (!mStarted) {
// return;
@@ -2433,7 +2235,7 @@
}
void DashPlayer::performDecoderShutdown(bool audio, bool video) {
- ALOGE("performDecoderShutdown audio=%d, video=%d", audio, video);
+ DP_MSG_ERROR("performDecoderShutdown audio=%d, video=%d", audio, video);
if ((!audio || mAudioDecoder == NULL)
&& (!video || mVideoDecoder == NULL)) {
diff --git a/dashplayer/DashPlayer.h b/dashplayer/DashPlayer.h
index 32a0fab..7ed0aa4 100644
--- a/dashplayer/DashPlayer.h
+++ b/dashplayer/DashPlayer.h
@@ -18,14 +18,16 @@
#define DASH_PLAYER_H_
-#include <media/MediaPlayerInterface.h>
-#include <media/stagefright/foundation/AHandler.h>
-#include <media/stagefright/NativeWindowWrapper.h>
#include "DashPlayerStats.h"
+#include <media/MediaPlayerInterface.h>
+#include <media/stagefright/NativeWindowWrapper.h>
+#include <media/stagefright/foundation/AHandler.h>
#include <media/stagefright/foundation/ABuffer.h>
-#include <cutils/properties.h>
+#include <media/stagefright/foundation/ADebug.h>
+#include <media/stagefright/foundation/AMessage.h>
#define KEY_QCTIMEDTEXT_LISTENER 6000
+
//Keys for playback modes
#define KEY_DASH_SEEK_EVENT 7001
#define KEY_DASH_PAUSE_EVENT 7002
@@ -93,7 +95,6 @@
public:
struct DASHHTTPLiveSource;
- struct WFDSource;
protected:
virtual ~DashPlayer();
@@ -149,7 +150,6 @@
kWhatSetDataSource = '=DaS',
kWhatSetVideoNativeWindow = '=NaW',
kWhatSetAudioSink = '=AuS',
- kWhatMoreDataQueued = 'more',
kWhatStart = 'strt',
kWhatScanSources = 'scan',
kWhatVideoNotify = 'vidN',
@@ -163,8 +163,6 @@
kWhatPrepareAsync = 'pras',
kWhatIsPrepareDone = 'prdn',
kWhatSourceNotify = 'snfy',
- kKeySmoothStreaming = 'ESmS', //bool (int32_t)
- kKeyEnableDecodeOrder = 'EDeO', //bool (int32_t)
};
enum {
@@ -240,7 +238,6 @@
int64_t mSkipRenderingVideoUntilMediaTimeUs;
int64_t mVideoLateByUs;
- int64_t mNumFramesTotal, mNumFramesDropped;
bool mPauseIndication;
@@ -251,19 +248,6 @@
sp<AMessage> mSourceNotify;
sp<AMessage> mQOENotify;
- enum NuSourceType {
- kHttpLiveSource = 0,
- kHttpDashSource,
- kRtspSource,
- kStreamingSource,
- kWfdSource,
- kGenericSource,
- kDefaultSource
- };
- NuSourceType mSourceType;
-
- bool mIsSecureInputBuffers;
-
int32_t mSRid;
status_t instantiateDecoder(int track, sp<Decoder> *decoder);
@@ -283,7 +267,7 @@
void postScanSources();
sp<Source> LoadCreateSource(const char * uri, const KeyedVector<String8,
- String8> *headers, bool uidValid, uid_t uid, NuSourceType srcTyp);
+ String8> *headers, bool uidValid, uid_t uid);
void postIsPrepareDone();
@@ -296,19 +280,11 @@
void processDeferredActions();
- //void performSeek(int64_t seekTimeUs);
- //void performDecoderFlush();
void performDecoderShutdown(bool audio, bool video);
- //void performReset();
void performScanSources();
void performSetSurface(const sp<NativeWindowWrapper> &wrapper);
- struct QueueEntry {
- sp<AMessage> mMessageToBeConsumed;
- };
-
- List<QueueEntry> mDecoderMessageQueue;
-
+ int mLogLevel;
bool mTimedTextCEAPresent;
//Set and reset in cases of seek/resume-out-of-tsb to signal discontinuity in CEA timedtextsamples
diff --git a/dashplayer/DashPlayerDecoder.cpp b/dashplayer/DashPlayerDecoder.cpp
index 1439560..3715bae 100644
--- a/dashplayer/DashPlayerDecoder.cpp
+++ b/dashplayer/DashPlayerDecoder.cpp
@@ -16,19 +16,22 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "DashPlayerDecoder"
-#include <utils/Log.h>
#include "DashPlayerDecoder.h"
#include "DashCodec.h"
#include "ESDS.h"
#include "QCMediaDefs.h"
#include "QCMetaData.h"
-#include <media/stagefright/foundation/ABuffer.h>
-#include <media/stagefright/foundation/ADebug.h>
-#include <media/stagefright/foundation/AMessage.h>
#include <media/stagefright/MediaDefs.h>
#include <media/stagefright/MetaData.h>
#include <media/stagefright/Utils.h>
+#include <cutils/properties.h>
+#include <utils/Log.h>
+
+#define DPD_MSG_ERROR(...) ALOGE(__VA_ARGS__)
+#define DPD_MSG_HIGH(...) if(mLogLevel >= 1){ALOGE(__VA_ARGS__);}
+#define DPD_MSG_MEDIUM(...) if(mLogLevel >= 2){ALOGE(__VA_ARGS__);}
+#define DPD_MSG_LOW(...) if(mLogLevel >= 3){ALOGE(__VA_ARGS__);}
namespace android {
@@ -36,8 +39,16 @@
const sp<AMessage> ¬ify,
const sp<NativeWindowWrapper> &nativeWindow)
: mNotify(notify),
- mNativeWindow(nativeWindow) {
+ mNativeWindow(nativeWindow),
+ mLogLevel(0){
mAudioSink = NULL;
+
+ char property_value[PROPERTY_VALUE_MAX] = {0};
+ property_get("persist.dash.debug.level", property_value, NULL);
+
+ if(*property_value) {
+ mLogLevel = atoi(property_value);
+ }
}
DashPlayer::Decoder::~Decoder() {
@@ -60,7 +71,7 @@
const char *mime;
CHECK(meta->findCString(kKeyMIMEType, &mime));
- ALOGV("@@@@:: Decoder::configure :: mime is --- %s ---",mime);
+ DPD_MSG_LOW("@@@@:: Decoder::configure :: mime is --- %s ---",mime);
sp<AMessage> notifyMsg =
new AMessage(kWhatCodecNotify, id());
@@ -82,7 +93,7 @@
CHECK(meta->findCString(kKeyMIMEType, &mime));
}
- ALOGV("@@@@:: DashCodec created ");
+ DPD_MSG_LOW("@@@@:: DashCodec created ");
mCodec = new DashCodec;
bool needDedicatedLooper = false;
@@ -90,7 +101,7 @@
if (isVideo){
needDedicatedLooper = true;
if(mCodecLooper == NULL) {
- ALOGV("@@@@:: Creating Looper for %s",(isVideo?"Video":"Audio"));
+ DPD_MSG_LOW("@@@@:: Creating Looper for %s",(isVideo?"Video":"Audio"));
mCodecLooper = new ALooper;
mCodecLooper->setName("DashPlayerDecoder");
mCodecLooper->start(false, false, ANDROID_PRIORITY_AUDIO);
@@ -143,21 +154,10 @@
CHECK_EQ(convertMetaDataToMessage(meta, &msg), (status_t)OK);
int32_t value;
- if (meta->findInt32(kKeySmoothStreaming, &value)) {
- msg->setInt32("smooth-streaming", value);
- }
-
if (meta->findInt32(kKeyIsDRM, &value)) {
msg->setInt32("secure-op", 1);
}
- if (meta->findInt32(kKeyRequiresSecureBuffers, &value)) {
- msg->setInt32("requires-secure-buffers", 1);
- }
-
- if (meta->findInt32(kKeyEnableDecodeOrder, &value)) {
- msg->setInt32("decodeOrderEnable", value);
- }
if (meta->findData(kKeyAacCodecSpecificData, &type, &data, &size)) {
if (size > 0 && data != NULL) {
sp<ABuffer> buffer = new ABuffer(size);
@@ -168,11 +168,11 @@
msg->setBuffer("csd-0", buffer);
}
else {
- ALOGE("kKeyAacCodecSpecificData ABuffer Allocation failed");
+ DPD_MSG_ERROR("kKeyAacCodecSpecificData ABuffer Allocation failed");
}
}
else {
- ALOGE("Not a valid data pointer or size == 0");
+ DPD_MSG_ERROR("Not a valid data pointer or size == 0");
}
}
@@ -194,12 +194,7 @@
sp<AMessage> reply;
CHECK(msg->findMessage("reply", &reply));
-#if 0
sp<ABuffer> outBuffer;
- CHECK(msg->findBuffer("buffer", &outBuffer));
-#else
- sp<ABuffer> outBuffer;
-#endif
if (mCSDIndex < mCSD.size()) {
outBuffer = mCSD.editItemAt(mCSDIndex++);
diff --git a/dashplayer/DashPlayerDecoder.h b/dashplayer/DashPlayerDecoder.h
index adf7544..af564dc 100644
--- a/dashplayer/DashPlayerDecoder.h
+++ b/dashplayer/DashPlayerDecoder.h
@@ -20,7 +20,6 @@
#include "DashPlayerRenderer.h"
#include "DashPlayer.h"
-#include <media/stagefright/foundation/AHandler.h>
namespace android {
@@ -57,6 +56,7 @@
Vector<sp<ABuffer> > mCSD;
size_t mCSDIndex;
+ int mLogLevel;
sp<AMessage> makeFormat(const sp<MetaData> &meta);
diff --git a/dashplayer/DashPlayerDriver.cpp b/dashplayer/DashPlayerDriver.cpp
index c78b5b2..23be214 100644
--- a/dashplayer/DashPlayerDriver.cpp
+++ b/dashplayer/DashPlayerDriver.cpp
@@ -16,14 +16,17 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "DashPlayerDriver"
-#include <utils/Log.h>
#include "DashPlayerDriver.h"
-
#include "DashPlayer.h"
-
-#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/ALooper.h>
+#include <cutils/properties.h>
+#include <utils/Log.h>
+
+#define DPD_MSG_ERROR(...) ALOGE(__VA_ARGS__)
+#define DPD_MSG_HIGH(...) if(mLogLevel >= 1){ALOGE(__VA_ARGS__);}
+#define DPD_MSG_MEDIUM(...) if(mLogLevel >= 2){ALOGE(__VA_ARGS__);}
+#define DPD_MSG_LOW(...) if(mLogLevel >= 3){ALOGE(__VA_ARGS__);}
namespace android {
@@ -32,12 +35,11 @@
mSetSurfaceInProgress(false),
mDurationUs(-1),
mPositionUs(-1),
- mNumFramesTotal(0),
- mNumFramesDropped(0),
mLooper(new ALooper),
mState(UNINITIALIZED),
mAtEOS(false),
- mStartupSeekTimeUs(-1) {
+ mStartupSeekTimeUs(-1),
+ mLogLevel(0){
mLooper->setName("DashPlayerDriver Looper");
mLooper->start(
@@ -49,6 +51,14 @@
mLooper->registerHandler(mPlayer);
mPlayer->setDriver(this);
+
+ char property_value[PROPERTY_VALUE_MAX] = {0};
+ property_get("persist.dash.debug.level", property_value, NULL);
+
+ if(*property_value) {
+ mLogLevel = atoi(property_value);
+ }
+
}
DashPlayerDriver::~DashPlayerDriver() {
@@ -106,7 +116,7 @@
return INVALID_OPERATION;
}
- ALOGE("DashPlayerDriver::setVideoSurfaceTexture call and block");
+ DPD_MSG_ERROR("DashPlayerDriver::setVideoSurfaceTexture call and block");
mSetSurfaceInProgress = true;
@@ -125,7 +135,7 @@
}
status_t DashPlayerDriver::prepareAsync() {
- status_t err = UNKNOWN_ERROR;
+ status_t err = (status_t)UNKNOWN_ERROR;
if (mPlayer != NULL) {
err = mPlayer->prepareAsync();
}
@@ -238,7 +248,7 @@
if (mPositionUs < 0) {
*msec = 0;
} else {
- *msec = (mPositionUs + 500ll) / 1000;
+ *msec = (int)((mPositionUs + 500ll) / 1000);
}
return OK;
@@ -250,7 +260,7 @@
if (mDurationUs < 0) {
*msec = 0;
} else {
- *msec = (mDurationUs + 500ll) / 1000;
+ *msec = (int)((mDurationUs + 500ll) / 1000);
}
return OK;
@@ -279,7 +289,7 @@
}
player_type DashPlayerDriver::playerType() {
- return NU_PLAYER;
+ return DASH_PLAYER;
}
void DashPlayerDriver::setQCTimedTextListener(const bool val) {
@@ -290,27 +300,27 @@
status_t ret = INVALID_OPERATION;
if (reply == NULL) {
- ALOGE("reply is a NULL pointer");
+ DPD_MSG_ERROR("reply is a NULL pointer");
return BAD_VALUE;
}
int32_t methodId;
ret = request.readInt32(&methodId);
if (ret != OK) {
- ALOGE("Failed to retrieve the requested method to invoke");
+ DPD_MSG_ERROR("Failed to retrieve the requested method to invoke");
return ret;
}
switch (methodId) {
case KEY_DASH_GET_ADAPTION_PROPERTIES:
{
- ALOGV("calling KEY_DASH_GET_ADAPTION_PROPERTIES");
+ DPD_MSG_HIGH("calling KEY_DASH_GET_ADAPTION_PROPERTIES");
ret = getParameter(methodId,reply);
break;
}
case KEY_DASH_SET_ADAPTION_PROPERTIES:
{
- ALOGV("calling KEY_DASH_SET_ADAPTION_PROPERTIES");
+ DPD_MSG_HIGH("calling KEY_DASH_SET_ADAPTION_PROPERTIES");
int32_t val = 0;
ret = setParameter(methodId,request);
val = (ret == OK)? 1:0;
@@ -320,33 +330,33 @@
}
case KEY_DASH_MPD_QUERY:
{
- ALOGV("calling KEY_DASH_MPD_QUERY");
+ DPD_MSG_HIGH("calling KEY_DASH_MPD_QUERY");
ret = getParameter(methodId,reply);
break;
}
case KEY_DASH_QOE_EVENT:
- ALOGV("calling KEY_DASH_QOE_EVENT");
+ DPD_MSG_HIGH("calling KEY_DASH_QOE_EVENT");
ret = setParameter(methodId,request);
break;
case KEY_DASH_QOE_PERIODIC_EVENT:
- ALOGV("calling KEY_DASH_QOE_PERIODIC_EVENT");
+ DPD_MSG_HIGH("calling KEY_DASH_QOE_PERIODIC_EVENT");
ret = getParameter(methodId,reply);
break;
case KEY_DASH_REPOSITION_RANGE:
- ALOGV("calling KEY_DASH_REPOSITION_RANGE");
+ DPD_MSG_HIGH("calling KEY_DASH_REPOSITION_RANGE");
ret = getParameter(methodId,reply);
break;
case KEY_DASH_SEEK_EVENT:
{
- ALOGV("calling KEY_DASH_SEEK_EVENT seekTo()");
+ DPD_MSG_HIGH("calling KEY_DASH_SEEK_EVENT seekTo()");
int32_t msec;
ret = request.readInt32(&msec);
if (ret != OK)
{
- ALOGE("Invoke: invalid seek value");
+ DPD_MSG_ERROR("Invoke: invalid seek value");
}
else
{
@@ -360,7 +370,7 @@
case KEY_DASH_PAUSE_EVENT:
{
- ALOGV("calling KEY_DASH_PAUSE_EVENT pause()");
+ DPD_MSG_HIGH("calling KEY_DASH_PAUSE_EVENT pause()");
ret = pause();
int32_t val = (ret == OK)? 1:0;
reply->setDataPosition(0);
@@ -370,7 +380,7 @@
case KEY_DASH_RESUME_EVENT:
{
- ALOGV("calling KEY_DASH_RESUME_EVENT pause()");
+ DPD_MSG_HIGH("calling KEY_DASH_RESUME_EVENT pause()");
ret = start();
int32_t val = (ret == OK)? 1:0;
reply->setDataPosition(0);
@@ -380,13 +390,13 @@
case KEY_QCTIMEDTEXT_LISTENER:
{
- ALOGV("calling KEY_QCTIMEDTEXT_LISTENER");
+ DPD_MSG_HIGH("calling KEY_QCTIMEDTEXT_LISTENER");
int32_t val = 0;
ret = request.readInt32(&val);
if (ret != OK)
{
- ALOGE("Invoke KEY_QCTIMEDTEXT_LISTENER: invalid val");
+ DPD_MSG_ERROR("Invoke KEY_QCTIMEDTEXT_LISTENER: invalid val");
}
else
{
@@ -402,14 +412,14 @@
{
// Ignore the invoke call for INVOKE_ID_GET_TRACK_INFO with success return code
// to avoid mediaplayer java exception
- ALOGV("Calling INVOKE_ID_GET_TRACK_INFO to invoke");
+ DPD_MSG_HIGH("Calling INVOKE_ID_GET_TRACK_INFO to invoke");
ret = getParameter(methodId,reply);
break;
}
default:
{
- ALOGE("Invoke:unHandled requested method%d",methodId);
+ DPD_MSG_ERROR("Invoke:unHandled requested method%d",methodId);
ret = INVALID_OPERATION;
break;
}
@@ -423,8 +433,7 @@
}
status_t DashPlayerDriver::setParameter(int key, const Parcel &request) {
-
- status_t err = UNKNOWN_ERROR;
+ status_t err = (status_t)UNKNOWN_ERROR;
if (mPlayer != NULL)
{
err = mPlayer->setParameter(key, request);
@@ -434,7 +443,7 @@
status_t DashPlayerDriver::getParameter(int key, Parcel *reply) {
- status_t err = UNKNOWN_ERROR;
+ status_t err = (status_t)UNKNOWN_ERROR;
if (mPlayer != NULL)
{
err = mPlayer->getParameter(key, reply);
@@ -458,7 +467,7 @@
Mutex::Autolock autoLock(mLock);
CHECK(mSetSurfaceInProgress);
mSetSurfaceInProgress = false;
- ALOGE("DashPlayerDriver::notifySetSurfaceComplete done");
+ DPD_MSG_ERROR("DashPlayerDriver::notifySetSurfaceComplete done");
mCondition.broadcast();
}
@@ -476,13 +485,6 @@
notifyListener(MEDIA_SEEK_COMPLETE);
}
-void DashPlayerDriver::notifyFrameStats(
- int64_t numFramesTotal, int64_t numFramesDropped) {
- Mutex::Autolock autoLock(mLock);
- mNumFramesTotal = numFramesTotal;
- mNumFramesDropped = numFramesDropped;
-}
-
status_t DashPlayerDriver::dump(int fd, const Vector<String16> &args) const {
if(mPlayer != NULL) {
mPlayer->dump(fd, args);
diff --git a/dashplayer/DashPlayerDriver.h b/dashplayer/DashPlayerDriver.h
index d732c34..3949b68 100644
--- a/dashplayer/DashPlayerDriver.h
+++ b/dashplayer/DashPlayerDriver.h
@@ -15,7 +15,6 @@
*/
#include <media/MediaPlayerInterface.h>
-
#include <media/stagefright/foundation/ABase.h>
namespace android {
@@ -67,7 +66,6 @@
void notifyDuration(int64_t durationUs);
void notifyPosition(int64_t positionUs);
void notifySeekComplete();
- void notifyFrameStats(int64_t numFramesTotal, int64_t numFramesDropped);
void notifyListener(int msg, int ext1 = 0, int ext2 = 0, const Parcel *obj=NULL);
void setQCTimedTextListener(const bool val);
@@ -84,8 +82,6 @@
bool mSetSurfaceInProgress;
int64_t mDurationUs;
int64_t mPositionUs;
- int64_t mNumFramesTotal;
- int64_t mNumFramesDropped;
// <<<
sp<ALooper> mLooper;
@@ -103,6 +99,8 @@
int64_t mStartupSeekTimeUs;
+ int mLogLevel;
+
DISALLOW_EVIL_CONSTRUCTORS(DashPlayerDriver);
};
diff --git a/dashplayer/DashPlayerRenderer.cpp b/dashplayer/DashPlayerRenderer.cpp
index f9224f6..bcb7543 100644
--- a/dashplayer/DashPlayerRenderer.cpp
+++ b/dashplayer/DashPlayerRenderer.cpp
@@ -16,14 +16,15 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "DashPlayerRenderer"
-#include <utils/Log.h>
#include "DashPlayerRenderer.h"
-
-#include <media/stagefright/foundation/ABuffer.h>
-#include <media/stagefright/foundation/ADebug.h>
-#include <media/stagefright/foundation/AMessage.h>
#include <cutils/properties.h>
+#include <utils/Log.h>
+
+#define DPR_MSG_ERROR(...) ALOGE(__VA_ARGS__)
+#define DPR_MSG_HIGH(...) if(mLogLevel >= 1){ALOGE(__VA_ARGS__);}
+#define DPR_MSG_MEDIUM(...) if(mLogLevel >= 2){ALOGE(__VA_ARGS__);}
+#define DPR_MSG_LOW(...) if(mLogLevel >= 3){ALOGE(__VA_ARGS__);}
namespace android {
@@ -52,7 +53,8 @@
mWasPaused(false),
mLastPositionUpdateUs(-1ll),
mVideoLateByUs(0ll),
- mStats(NULL){
+ mStats(NULL),
+ mLogLevel(0) {
mAVSyncDelayWindowUs = 40000;
@@ -67,7 +69,14 @@
}
}
- ALOGV("AVsync window in Us %lld", mAVSyncDelayWindowUs);
+ DPR_MSG_LOW("AVsync window in Us %lld", mAVSyncDelayWindowUs);
+
+ char property_value[PROPERTY_VALUE_MAX] = {0};
+ property_get("persist.dash.debug.level", property_value, NULL);
+
+ if(*property_value) {
+ mLogLevel = atoi(property_value);
+ }
}
DashPlayer::Renderer::~Renderer() {
@@ -130,7 +139,7 @@
mPendingPostAudioDrains = false;
mHasAudio = false;
mHasVideo = false;
- ALOGI("signalTimeDiscontinuity mHasAudio %d mHasVideo %d mSyncQueues %d",mHasAudio,mHasVideo,mSyncQueues);
+ DPR_MSG_HIGH("signalTimeDiscontinuity mHasAudio %d mHasVideo %d mSyncQueues %d",mHasAudio,mHasVideo,mSyncQueues);
}
void DashPlayer::Renderer::pause() {
@@ -164,8 +173,8 @@
// This is how long the audio sink will have data to
// play back.
int64_t delayUs =
- mAudioSink->msecsPerFrame()
- * numFramesPendingPlayout * 1000ll;
+ (int64_t)(mAudioSink->msecsPerFrame()
+ * (float)(numFramesPendingPlayout * 1000ll));
// Let's give it more data after about half that time
// has elapsed.
@@ -275,15 +284,6 @@
ssize_t numFramesAvailableToWrite =
mAudioSink->frameCount() - (mNumFramesWritten - numFramesPlayed);
-#if 0
- if (numFramesAvailableToWrite == mAudioSink->frameCount()) {
- ALOGI("audio sink underrun");
- } else {
- ALOGV("audio queue has %d frames left to play",
- mAudioSink->frameCount() - numFramesAvailableToWrite);
- }
-#endif
-
size_t numBytesAvailableToWrite =
numFramesAvailableToWrite * mAudioSink->frameSize();
@@ -304,7 +304,7 @@
int64_t mediaTimeUs;
CHECK(entry->mBuffer->meta()->findInt64("timeUs", &mediaTimeUs));
- ALOGV("rendering audio at media time %.2f secs", mediaTimeUs / 1E6);
+ DPR_MSG_HIGH("rendering audio at media time %.2f secs", (double)mediaTimeUs / 1E6);
mAnchorTimeMediaUs = mediaTimeUs;
@@ -315,11 +315,9 @@
mNumFramesWritten - numFramesPlayed;
int64_t realTimeOffsetUs =
- (mAudioSink->latency() / 2 /* XXX */
- + numFramesPendingPlayout
- * mAudioSink->msecsPerFrame()) * 1000ll;
-
- // ALOGI("realTimeOffsetUs = %lld us", realTimeOffsetUs);
+ (int64_t)(((float)mAudioSink->latency() / 2
+ + (float)numFramesPendingPlayout
+ * mAudioSink->msecsPerFrame()) * 1000ll);
mAnchorTimeRealUs =
ALooper::GetNowUs() + realTimeOffsetUs;
@@ -344,7 +342,7 @@
numBytesAvailableToWrite -= copy;
size_t copiedFrames = copy / mAudioSink->frameSize();
- mNumFramesWritten += copiedFrames;
+ mNumFramesWritten += (uint32_t)copiedFrames;
}
notifyPosition();
@@ -434,13 +432,13 @@
bool tooLate = (mVideoLateByUs > mAVSyncDelayWindowUs);
if (tooLate) {
- ALOGV("video late by %lld us (%.2f secs)",
- mVideoLateByUs, mVideoLateByUs / 1E6);
+ DPR_MSG_HIGH("video late by %lld us (%.2f secs)",
+ mVideoLateByUs, (double)mVideoLateByUs / 1E6);
if(mStats != NULL) {
mStats->recordLate(realTimeUs,nowUs,mVideoLateByUs,mAnchorTimeRealUs);
}
} else {
- ALOGV("rendering video at media time %.2f secs", mediaTimeUs / 1E6);
+ DPR_MSG_HIGH("rendering video at media time %.2f secs", (double)mediaTimeUs / 1E6);
if(mStats != NULL) {
mStats->recordOnTime(realTimeUs,nowUs,mVideoLateByUs);
mStats->incrementTotalRenderingFrames();
@@ -502,7 +500,7 @@
else
{
mPendingPostAudioDrains = true;
- ALOGE("Not rendering Audio Sample with TS: %lld as Video frame is not decoded", audioTimeUs);
+ DPR_MSG_HIGH("Not rendering Audio Sample with TS: %lld as Video frame is not decoded", audioTimeUs);
}
} else {
mVideoQueue.push_back(entry);
@@ -510,7 +508,7 @@
(buffer->meta())->findInt64("timeUs", &videoTimeUs);
if (!mIsFirstVideoframeReceived) {
mIsFirstVideoframeReceived = true;
- ALOGE("Received first video Sample with TS: %lld", videoTimeUs);
+ DPR_MSG_HIGH("Received first video Sample with TS: %lld", videoTimeUs);
if (mPendingPostAudioDrains) {
mPendingPostAudioDrains = false;
postDrainAudioQueue();
@@ -541,7 +539,7 @@
int64_t diff = firstVideoTimeUs - firstAudioTimeUs;
- ALOGV("queueDiff = %.2f secs", diff / 1E6);
+ DPR_MSG_LOW("queueDiff = %.2f secs", (double)diff / 1E6);
if (diff > 100000ll) {
// Audio data starts More than 0.1 secs before video.
@@ -735,7 +733,7 @@
mAudioSink->pause();
}
- ALOGV("now paused audio queue has %d entries, video has %d entries",
+ DPR_MSG_LOW("now paused audio queue has %d entries, video has %d entries",
mAudioQueue.size(), mVideoQueue.size());
mPaused = true;
@@ -785,12 +783,12 @@
{
if (audio)
{
- ALOGV("mHasAudio set to %d from %d",bValue,mHasAudio);
+ DPR_MSG_LOW("mHasAudio set to %d from %d",bValue,mHasAudio);
mHasAudio = bValue;
}
else
{
- ALOGV("mHasVideo set to %d from %d",bValue,mHasVideo);
+ DPR_MSG_LOW("mHasVideo set to %d from %d",bValue,mHasVideo);
mHasVideo = bValue;
}
return OK;
diff --git a/dashplayer/DashPlayerRenderer.h b/dashplayer/DashPlayerRenderer.h
index 9e9b85e..8940414 100644
--- a/dashplayer/DashPlayerRenderer.h
+++ b/dashplayer/DashPlayerRenderer.h
@@ -32,18 +32,6 @@
bool audio,
const sp<ABuffer> &buffer,
const sp<AMessage> ¬ifyConsumed);
-#ifdef QCOM_WFD_SINK
- virtual void queueEOS(bool audio, status_t finalResult);
-
- virtual void flush(bool audio);
-
- virtual void signalTimeDiscontinuity();
-
- virtual void signalAudioSinkChanged();
-
- virtual void pause();
- virtual void resume();
-#else
void queueEOS(bool audio, status_t finalResult);
@@ -56,7 +44,7 @@
void pause();
void resume();
void notifySeekPosition(int64_t seekTime);
-#endif /* QCOM_WFD_SINK */
+
enum {
kWhatEOS = 'eos ',
kWhatFlushComplete = 'fluC',
@@ -127,11 +115,9 @@
void onDrainVideoQueue();
void postDrainVideoQueue();
-#ifdef QCOM_WFD_SINK
- virtual void onQueueBuffer(const sp<AMessage> &msg);
-#else
+
void onQueueBuffer(const sp<AMessage> &msg);
-#endif /* QCOM_WFD_SINK */
+
void onQueueEOS(const sp<AMessage> &msg);
void onFlush(const sp<AMessage> &msg);
void onAudioSinkChanged();
@@ -149,15 +135,13 @@
// for qualcomm statistics profiling
public:
-#ifdef QCOM_WFD_SINK
- virtual void registerStats(sp<DashPlayerStats> stats);
- virtual status_t setMediaPresence(bool audio, bool bValue);
-#else
+
void registerStats(sp<DashPlayerStats> stats);
status_t setMediaPresence(bool audio, bool bValue);
-#endif /* QCOM_WFD_SINK */
+
private:
sp<DashPlayerStats> mStats;
+ int mLogLevel;
DISALLOW_EVIL_CONSTRUCTORS(Renderer);
};
diff --git a/dashplayer/DashPlayerSource.h b/dashplayer/DashPlayerSource.h
index bc63a76..8ee2e58 100644
--- a/dashplayer/DashPlayerSource.h
+++ b/dashplayer/DashPlayerSource.h
@@ -19,7 +19,6 @@
#define DASHPLAYER_SOURCE_H_
#include "DashPlayer.h"
-//#include <media/stagefright/MediaDebug.h>
namespace android {
diff --git a/dashplayer/DashPlayerStats.cpp b/dashplayer/DashPlayerStats.cpp
index 1c084c1..4ce22dc 100644
--- a/dashplayer/DashPlayerStats.cpp
+++ b/dashplayer/DashPlayerStats.cpp
@@ -27,7 +27,6 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <utils/Log.h>
#include "DashPlayerStats.h"
#define NO_MIMETYPE_AVAILABLE "N/A"
diff --git a/dashplayer/DashPlayerStats.h b/dashplayer/DashPlayerStats.h
old mode 100755
new mode 100644
index 9dcb423..f9d4699
--- a/dashplayer/DashPlayerStats.h
+++ b/dashplayer/DashPlayerStats.h
@@ -33,6 +33,8 @@
#include <utils/RefBase.h>
#include <utils/threads.h>
+#include <utils/Log.h>
+
namespace android {