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
Родитель 1505666b0a
Коммит 32de0d2510
5 изменённых файлов: 51 добавлений и 3 удалений

Просмотреть файл

@ -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("MediaStreamGrph", getter_AddRefs(mThread), event);
}
if (mCurrentTaskMessageQueue.IsEmpty()) {

Просмотреть файл

@ -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)
{

Просмотреть файл

@ -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
{

Просмотреть файл

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

Просмотреть файл

@ -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");