diff --git a/dom/media/GraphDriver.cpp b/dom/media/GraphDriver.cpp index 3c2e32823f76..4c01c5e9351d 100644 --- a/dom/media/GraphDriver.cpp +++ b/dom/media/GraphDriver.cpp @@ -1,4 +1,5 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ @@ -9,6 +10,7 @@ #include "mozilla/ClearOnShutdown.h" #include "mozilla/Unused.h" #include "CubebUtils.h" +#include "Tracing.h" #ifdef MOZ_WEBRTC #include "webrtc/MediaEngineWebRTC.h" @@ -881,6 +883,9 @@ long AudioCallbackDriver::DataCallback(const AudioDataValue* aInputBuffer, AudioDataValue* aOutputBuffer, long aFrames) { + TRACE_AUDIO_CALLBACK_BUDGET(aFrames, mSampleRate); + TRACE_AUDIO_CALLBACK(); + // Don't add the callback until we're inited and ready if (!mAddedMixer) { mGraphImpl->mMixer.AddCallback(this); diff --git a/dom/media/MediaStreamGraph.cpp b/dom/media/MediaStreamGraph.cpp index 2651813b4f0a..4b575ccfe596 100644 --- a/dom/media/MediaStreamGraph.cpp +++ b/dom/media/MediaStreamGraph.cpp @@ -1129,6 +1129,7 @@ MediaStreamGraphImpl::RunMessageAfterProcessing(UniquePtr aMessa void MediaStreamGraphImpl::RunMessagesInQueue() { + TRACE_AUDIO_CALLBACK(); MOZ_ASSERT(OnGraphThread()); // Calculate independent action times for each batch of messages (each // batch corresponding to an event loop task). This isolates the performance @@ -1146,6 +1147,7 @@ MediaStreamGraphImpl::RunMessagesInQueue() void MediaStreamGraphImpl::UpdateGraph(GraphTime aEndBlockingDecisions) { + TRACE_AUDIO_CALLBACK(); MOZ_ASSERT(OnGraphThread()); MOZ_ASSERT(aEndBlockingDecisions >= mProcessedTime); // The next state computed time can be the same as the previous: it @@ -1241,6 +1243,7 @@ MediaStreamGraphImpl::UpdateGraph(GraphTime aEndBlockingDecisions) void MediaStreamGraphImpl::Process() { + TRACE_AUDIO_CALLBACK(); MOZ_ASSERT(OnGraphThread()); // Play stream contents. bool allBlockedForever = true; @@ -1345,6 +1348,7 @@ MediaStreamGraphImpl::UpdateMainThreadState() bool MediaStreamGraphImpl::OneIteration(GraphTime aStateEnd) { + TRACE_AUDIO_CALLBACK(); // Changes to LIFECYCLE_RUNNING occur before starting or reviving the graph // thread, and so the monitor need not be held to check mLifecycleState. // LIFECYCLE_THREAD_NOT_STARTED is possible when shutting down offline @@ -1551,6 +1555,7 @@ public: } NS_IMETHOD Run() override { + TRACE(); if (mGraph) { mGraph->RunInStableState(mSourceIsMSG); } @@ -2772,6 +2777,7 @@ SourceMediaStream::PullNewData( StreamTime aDesiredUpToTime, nsTArray>& aPromises) { + TRACE_AUDIO_CALLBACK(); MutexAutoLock lock(mMutex); if (!mPullEnabled || mFinished) { return false; diff --git a/dom/media/MediaStreamGraphImpl.h b/dom/media/MediaStreamGraphImpl.h index 59e6c79e4c12..7cf8cc999300 100644 --- a/dom/media/MediaStreamGraphImpl.h +++ b/dom/media/MediaStreamGraphImpl.h @@ -23,6 +23,7 @@ #include "nsIRunnable.h" #include "nsIThread.h" #include "nsITimer.h" +#include "AsyncLogger.h" namespace mozilla { diff --git a/dom/media/TrackUnionStream.cpp b/dom/media/TrackUnionStream.cpp index 86f5bcda62bc..0e14a0697b5d 100644 --- a/dom/media/TrackUnionStream.cpp +++ b/dom/media/TrackUnionStream.cpp @@ -68,6 +68,7 @@ TrackUnionStream::TrackUnionStream() } void TrackUnionStream::ProcessInput(GraphTime aFrom, GraphTime aTo, uint32_t aFlags) { + TRACE(); if (IsFinishedOnGraphThread()) { return; } diff --git a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp index 6ce74c510604..7c2c2b6a0d3b 100644 --- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp +++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp @@ -17,6 +17,7 @@ #include "mozilla/ErrorNames.h" #include "mtransport/runnable_utils.h" #include "nsAutoPtr.h" +#include "Tracing.h" // scoped_ptr.h uses FF #ifdef FF @@ -1183,6 +1184,7 @@ MediaEngineWebRTCMicrophoneSource::NotifyInputData(MediaStreamGraph* aGraph, TrackRate aRate, uint32_t aChannels) { + TRACE_AUDIO_CALLBACK(); // If some processing is necessary, packetize and insert in the WebRTC.org // code. Otherwise, directly insert the mic data in the MSG, bypassing all processing. if (PassThrough()) { diff --git a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp index 599c2cfb12df..21a489a27fba 100644 --- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp +++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp @@ -50,6 +50,7 @@ #include "transportlayer.h" #include "transportlayerdtls.h" #include "transportlayerice.h" +#include "Tracing.h" #include "webrtc/base/bind.h" #include "webrtc/base/keep_ref_until_done.h" @@ -1931,12 +1932,13 @@ MediaPipelineTransmit::PipelineListener::NotifyRealtimeTrackData( aMedia.GetDuration()); if (aMedia.GetType() == MediaSegment::VIDEO) { + TRACE_COMMENT("Video"); // We have to call the upstream NotifyRealtimeTrackData and // MediaStreamVideoSink will route them to SetCurrentFrames. MediaStreamVideoSink::NotifyRealtimeTrackData(aGraph, aOffset, aMedia); return; } - + TRACE_COMMENT("Audio"); NewData(aMedia, aGraph->GraphRate()); } @@ -2022,6 +2024,7 @@ MediaPipelineTransmit::PipelineListener::NewData(const MediaSegment& aMedia, } } else { const VideoSegment* video = static_cast(&aMedia); + for (VideoSegment::ConstChunkIterator iter(*video); !iter.IsEnded(); iter.Next()) { mConverter->QueueVideoChunk(*iter, !mEnabled); @@ -2234,6 +2237,7 @@ private: void NotifyPullImpl(StreamTime aDesiredTime) { + TRACE(); uint32_t samplesPer10ms = mRate / 100; // mSource's rate is not necessarily the same as the graph rate, since there