Bug 1444976 - Trace some initial real-time media stuff. r=pehrsons

MozReview-Commit-ID: 7mmDHVS2t8f

--HG--
extra : rebase_source : ac56722792f99aadd8e359ef9ae4b30f6dc78076
extra : source : 7b9d0ce0b1cb20540d1c5bf4c77596359b5cb73e
This commit is contained in:
Paul Adenot 2018-04-12 17:51:35 +02:00
Родитель a1cfe22210
Коммит fbf116232d
6 изменённых файлов: 20 добавлений и 1 удалений

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

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

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

@ -1129,6 +1129,7 @@ MediaStreamGraphImpl::RunMessageAfterProcessing(UniquePtr<ControlMessage> 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<RefPtr<SourceMediaStream::NotifyPullPromise>>& aPromises)
{
TRACE_AUDIO_CALLBACK();
MutexAutoLock lock(mMutex);
if (!mPullEnabled || mFinished) {
return false;

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

@ -23,6 +23,7 @@
#include "nsIRunnable.h"
#include "nsIThread.h"
#include "nsITimer.h"
#include "AsyncLogger.h"
namespace mozilla {

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

@ -68,6 +68,7 @@ TrackUnionStream::TrackUnionStream()
}
void TrackUnionStream::ProcessInput(GraphTime aFrom, GraphTime aTo, uint32_t aFlags)
{
TRACE();
if (IsFinishedOnGraphThread()) {
return;
}

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

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

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

@ -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<const VideoSegment*>(&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