Bug 839650: Add debugs to MediaStreamGraph to ease investigation of issues in the future r=roc

This commit is contained in:
Randell Jesup 2013-03-07 03:53:45 -05:00
parent 2165aff0bc
commit 1d6e4a068a
5 changed files with 51 additions and 3 deletions

View File

@ -123,6 +123,14 @@ MediaStreamGraphImpl::ExtractPendingInput(SourceMediaStream* aStream,
MediaTimeToSeconds(aStream->mBuffer.GetEnd())));
if (t > aStream->mBuffer.GetEnd()) {
*aEnsureNextIteration = true;
#ifdef DEBUG
if (aStream->mListeners.Length() == 0) {
LOG(PR_LOG_ERROR, ("No listeners in NotifyPull aStream=%p desired=%f current end=%f",
aStream, MediaTimeToSeconds(t),
MediaTimeToSeconds(aStream->mBuffer.GetEnd())));
aStream->DumpTrackInfo();
}
#endif
for (uint32_t j = 0; j < aStream->mListeners.Length(); ++j) {
MediaStreamListener* l = aStream->mListeners[j];
{
@ -389,7 +397,16 @@ MediaStreamGraphImpl::WillUnderrun(MediaStream* aStream, GraphTime aTime,
GraphTime bufferEnd =
StreamTimeToGraphTime(aStream, aStream->GetBufferEnd(),
INCLUDE_TRAILING_BLOCKED_INTERVAL);
NS_ASSERTION(bufferEnd >= mCurrentTime, "Buffer underran");
#ifdef DEBUG
if (bufferEnd < mCurrentTime) {
LOG(PR_LOG_ERROR, ("MediaStream %p underrun, "
"bufferEnd %f < mCurrentTime %f (%lld < %lld), Streamtime %lld",
aStream, MediaTimeToSeconds(bufferEnd), MediaTimeToSeconds(mCurrentTime),
bufferEnd, mCurrentTime, aStream->GetBufferEnd()));
aStream->DumpTrackInfo();
NS_ASSERTION(bufferEnd >= mCurrentTime, "Buffer underran");
}
#endif
// We should block after bufferEnd.
if (bufferEnd <= aTime) {
LOG(PR_LOG_DEBUG, ("MediaStream %p will block due to data underrun, "
@ -1216,7 +1233,7 @@ MediaStreamGraphImpl::RunInStableState()
// the graph might exit immediately on finding it has no streams. The
// first message for a new graph must create a stream.
nsCOMPtr<nsIRunnable> event = new MediaStreamGraphThreadRunnable(this);
NS_NewThread(getter_AddRefs(mThread), event);
NS_NewNamedThread("MediaStreamGraph", getter_AddRefs(mThread), event);
}
if (mCurrentTaskMessageQueue.IsEmpty()) {

View File

@ -365,6 +365,9 @@ public:
*/
virtual void DestroyImpl();
StreamTime GetBufferEnd() { return mBuffer.GetEnd(); }
#ifdef DEBUG
void DumpTrackInfo() { return mBuffer.DumpTrackInfo(); }
#endif
void SetAudioOutputVolumeImpl(void* aKey, float aVolume);
void AddAudioOutputImpl(void* aKey)
{

View File

@ -8,6 +8,30 @@
namespace mozilla {
#ifdef PR_LOGGING
extern PRLogModuleInfo* gMediaStreamGraphLog;
#define LOG(type, msg) PR_LOG(gMediaStreamGraphLog, type, msg)
#else
#define LOG(type, msg)
#endif
#ifdef DEBUG
void
StreamBuffer::DumpTrackInfo() const
{
LOG(PR_LOG_ALWAYS, ("DumpTracks: mTracksKnownTime %lld", mTracksKnownTime));
for (uint32_t i = 0; i < mTracks.Length(); ++i) {
Track* track = mTracks[i];
if (track->IsEnded()) {
LOG(PR_LOG_ALWAYS, ("Track[%d] %d: ended", i, track->GetID()));
} else {
LOG(PR_LOG_ALWAYS, ("Track[%d] %d: %lld", i, track->GetID(),
track->GetEndTimeRoundDown()));
}
}
}
#endif
StreamTime
StreamBuffer::GetEnd() const
{

View File

@ -234,6 +234,10 @@ public:
*/
StreamTime GetEnd() const;
#ifdef DEBUG
void DumpTrackInfo() const;
#endif
Track* FindTrack(TrackID aID);
class TrackIter {

View File

@ -859,7 +859,7 @@ MediaManager::Get() {
if (!sSingleton) {
sSingleton = new MediaManager();
NS_NewThread(getter_AddRefs(sSingleton->mMediaThread));
NS_NewNamedThread("MediaManager", getter_AddRefs(sSingleton->mMediaThread));
LOG(("New Media thread for gum"));
NS_ASSERTION(NS_IsMainThread(), "Only create MediaManager on main thread");