зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
a1cfe22210
Коммит
fbf116232d
|
@ -1,4 +1,5 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
/* -*- 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
|
/* 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,
|
* 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/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
@ -9,6 +10,7 @@
|
||||||
#include "mozilla/ClearOnShutdown.h"
|
#include "mozilla/ClearOnShutdown.h"
|
||||||
#include "mozilla/Unused.h"
|
#include "mozilla/Unused.h"
|
||||||
#include "CubebUtils.h"
|
#include "CubebUtils.h"
|
||||||
|
#include "Tracing.h"
|
||||||
|
|
||||||
#ifdef MOZ_WEBRTC
|
#ifdef MOZ_WEBRTC
|
||||||
#include "webrtc/MediaEngineWebRTC.h"
|
#include "webrtc/MediaEngineWebRTC.h"
|
||||||
|
@ -881,6 +883,9 @@ long
|
||||||
AudioCallbackDriver::DataCallback(const AudioDataValue* aInputBuffer,
|
AudioCallbackDriver::DataCallback(const AudioDataValue* aInputBuffer,
|
||||||
AudioDataValue* aOutputBuffer, long aFrames)
|
AudioDataValue* aOutputBuffer, long aFrames)
|
||||||
{
|
{
|
||||||
|
TRACE_AUDIO_CALLBACK_BUDGET(aFrames, mSampleRate);
|
||||||
|
TRACE_AUDIO_CALLBACK();
|
||||||
|
|
||||||
// Don't add the callback until we're inited and ready
|
// Don't add the callback until we're inited and ready
|
||||||
if (!mAddedMixer) {
|
if (!mAddedMixer) {
|
||||||
mGraphImpl->mMixer.AddCallback(this);
|
mGraphImpl->mMixer.AddCallback(this);
|
||||||
|
|
|
@ -1129,6 +1129,7 @@ MediaStreamGraphImpl::RunMessageAfterProcessing(UniquePtr<ControlMessage> aMessa
|
||||||
void
|
void
|
||||||
MediaStreamGraphImpl::RunMessagesInQueue()
|
MediaStreamGraphImpl::RunMessagesInQueue()
|
||||||
{
|
{
|
||||||
|
TRACE_AUDIO_CALLBACK();
|
||||||
MOZ_ASSERT(OnGraphThread());
|
MOZ_ASSERT(OnGraphThread());
|
||||||
// Calculate independent action times for each batch of messages (each
|
// Calculate independent action times for each batch of messages (each
|
||||||
// batch corresponding to an event loop task). This isolates the performance
|
// batch corresponding to an event loop task). This isolates the performance
|
||||||
|
@ -1146,6 +1147,7 @@ MediaStreamGraphImpl::RunMessagesInQueue()
|
||||||
void
|
void
|
||||||
MediaStreamGraphImpl::UpdateGraph(GraphTime aEndBlockingDecisions)
|
MediaStreamGraphImpl::UpdateGraph(GraphTime aEndBlockingDecisions)
|
||||||
{
|
{
|
||||||
|
TRACE_AUDIO_CALLBACK();
|
||||||
MOZ_ASSERT(OnGraphThread());
|
MOZ_ASSERT(OnGraphThread());
|
||||||
MOZ_ASSERT(aEndBlockingDecisions >= mProcessedTime);
|
MOZ_ASSERT(aEndBlockingDecisions >= mProcessedTime);
|
||||||
// The next state computed time can be the same as the previous: it
|
// The next state computed time can be the same as the previous: it
|
||||||
|
@ -1241,6 +1243,7 @@ MediaStreamGraphImpl::UpdateGraph(GraphTime aEndBlockingDecisions)
|
||||||
void
|
void
|
||||||
MediaStreamGraphImpl::Process()
|
MediaStreamGraphImpl::Process()
|
||||||
{
|
{
|
||||||
|
TRACE_AUDIO_CALLBACK();
|
||||||
MOZ_ASSERT(OnGraphThread());
|
MOZ_ASSERT(OnGraphThread());
|
||||||
// Play stream contents.
|
// Play stream contents.
|
||||||
bool allBlockedForever = true;
|
bool allBlockedForever = true;
|
||||||
|
@ -1345,6 +1348,7 @@ MediaStreamGraphImpl::UpdateMainThreadState()
|
||||||
bool
|
bool
|
||||||
MediaStreamGraphImpl::OneIteration(GraphTime aStateEnd)
|
MediaStreamGraphImpl::OneIteration(GraphTime aStateEnd)
|
||||||
{
|
{
|
||||||
|
TRACE_AUDIO_CALLBACK();
|
||||||
// Changes to LIFECYCLE_RUNNING occur before starting or reviving the graph
|
// Changes to LIFECYCLE_RUNNING occur before starting or reviving the graph
|
||||||
// thread, and so the monitor need not be held to check mLifecycleState.
|
// thread, and so the monitor need not be held to check mLifecycleState.
|
||||||
// LIFECYCLE_THREAD_NOT_STARTED is possible when shutting down offline
|
// LIFECYCLE_THREAD_NOT_STARTED is possible when shutting down offline
|
||||||
|
@ -1551,6 +1555,7 @@ public:
|
||||||
}
|
}
|
||||||
NS_IMETHOD Run() override
|
NS_IMETHOD Run() override
|
||||||
{
|
{
|
||||||
|
TRACE();
|
||||||
if (mGraph) {
|
if (mGraph) {
|
||||||
mGraph->RunInStableState(mSourceIsMSG);
|
mGraph->RunInStableState(mSourceIsMSG);
|
||||||
}
|
}
|
||||||
|
@ -2772,6 +2777,7 @@ SourceMediaStream::PullNewData(
|
||||||
StreamTime aDesiredUpToTime,
|
StreamTime aDesiredUpToTime,
|
||||||
nsTArray<RefPtr<SourceMediaStream::NotifyPullPromise>>& aPromises)
|
nsTArray<RefPtr<SourceMediaStream::NotifyPullPromise>>& aPromises)
|
||||||
{
|
{
|
||||||
|
TRACE_AUDIO_CALLBACK();
|
||||||
MutexAutoLock lock(mMutex);
|
MutexAutoLock lock(mMutex);
|
||||||
if (!mPullEnabled || mFinished) {
|
if (!mPullEnabled || mFinished) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "nsIRunnable.h"
|
#include "nsIRunnable.h"
|
||||||
#include "nsIThread.h"
|
#include "nsIThread.h"
|
||||||
#include "nsITimer.h"
|
#include "nsITimer.h"
|
||||||
|
#include "AsyncLogger.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,7 @@ TrackUnionStream::TrackUnionStream()
|
||||||
}
|
}
|
||||||
void TrackUnionStream::ProcessInput(GraphTime aFrom, GraphTime aTo, uint32_t aFlags)
|
void TrackUnionStream::ProcessInput(GraphTime aFrom, GraphTime aTo, uint32_t aFlags)
|
||||||
{
|
{
|
||||||
|
TRACE();
|
||||||
if (IsFinishedOnGraphThread()) {
|
if (IsFinishedOnGraphThread()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "mozilla/ErrorNames.h"
|
#include "mozilla/ErrorNames.h"
|
||||||
#include "mtransport/runnable_utils.h"
|
#include "mtransport/runnable_utils.h"
|
||||||
#include "nsAutoPtr.h"
|
#include "nsAutoPtr.h"
|
||||||
|
#include "Tracing.h"
|
||||||
|
|
||||||
// scoped_ptr.h uses FF
|
// scoped_ptr.h uses FF
|
||||||
#ifdef FF
|
#ifdef FF
|
||||||
|
@ -1183,6 +1184,7 @@ MediaEngineWebRTCMicrophoneSource::NotifyInputData(MediaStreamGraph* aGraph,
|
||||||
TrackRate aRate,
|
TrackRate aRate,
|
||||||
uint32_t aChannels)
|
uint32_t aChannels)
|
||||||
{
|
{
|
||||||
|
TRACE_AUDIO_CALLBACK();
|
||||||
// If some processing is necessary, packetize and insert in the WebRTC.org
|
// 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.
|
// code. Otherwise, directly insert the mic data in the MSG, bypassing all processing.
|
||||||
if (PassThrough()) {
|
if (PassThrough()) {
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
#include "transportlayer.h"
|
#include "transportlayer.h"
|
||||||
#include "transportlayerdtls.h"
|
#include "transportlayerdtls.h"
|
||||||
#include "transportlayerice.h"
|
#include "transportlayerice.h"
|
||||||
|
#include "Tracing.h"
|
||||||
|
|
||||||
#include "webrtc/base/bind.h"
|
#include "webrtc/base/bind.h"
|
||||||
#include "webrtc/base/keep_ref_until_done.h"
|
#include "webrtc/base/keep_ref_until_done.h"
|
||||||
|
@ -1931,12 +1932,13 @@ MediaPipelineTransmit::PipelineListener::NotifyRealtimeTrackData(
|
||||||
aMedia.GetDuration());
|
aMedia.GetDuration());
|
||||||
|
|
||||||
if (aMedia.GetType() == MediaSegment::VIDEO) {
|
if (aMedia.GetType() == MediaSegment::VIDEO) {
|
||||||
|
TRACE_COMMENT("Video");
|
||||||
// We have to call the upstream NotifyRealtimeTrackData and
|
// We have to call the upstream NotifyRealtimeTrackData and
|
||||||
// MediaStreamVideoSink will route them to SetCurrentFrames.
|
// MediaStreamVideoSink will route them to SetCurrentFrames.
|
||||||
MediaStreamVideoSink::NotifyRealtimeTrackData(aGraph, aOffset, aMedia);
|
MediaStreamVideoSink::NotifyRealtimeTrackData(aGraph, aOffset, aMedia);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
TRACE_COMMENT("Audio");
|
||||||
NewData(aMedia, aGraph->GraphRate());
|
NewData(aMedia, aGraph->GraphRate());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2022,6 +2024,7 @@ MediaPipelineTransmit::PipelineListener::NewData(const MediaSegment& aMedia,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const VideoSegment* video = static_cast<const VideoSegment*>(&aMedia);
|
const VideoSegment* video = static_cast<const VideoSegment*>(&aMedia);
|
||||||
|
|
||||||
for (VideoSegment::ConstChunkIterator iter(*video); !iter.IsEnded();
|
for (VideoSegment::ConstChunkIterator iter(*video); !iter.IsEnded();
|
||||||
iter.Next()) {
|
iter.Next()) {
|
||||||
mConverter->QueueVideoChunk(*iter, !mEnabled);
|
mConverter->QueueVideoChunk(*iter, !mEnabled);
|
||||||
|
@ -2234,6 +2237,7 @@ private:
|
||||||
|
|
||||||
void NotifyPullImpl(StreamTime aDesiredTime)
|
void NotifyPullImpl(StreamTime aDesiredTime)
|
||||||
{
|
{
|
||||||
|
TRACE();
|
||||||
uint32_t samplesPer10ms = mRate / 100;
|
uint32_t samplesPer10ms = mRate / 100;
|
||||||
|
|
||||||
// mSource's rate is not necessarily the same as the graph rate, since there
|
// mSource's rate is not necessarily the same as the graph rate, since there
|
||||||
|
|
Загрузка…
Ссылка в новой задаче