mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 05:45:37 +00:00
Bug 1289678 - Don't count audio stream creation failures when retrying on Telemetry. r=kinetik
When failing to create an audio stream, we fallback to a SystemClockDriver marked as being a "fallback driver". When failing again to open an audio stream after re-trying, we can check whether we came from a fallback driver, and not report the failure again to telemetry. MozReview-Commit-ID: FAdQ0pCtC3m
This commit is contained in:
parent
cb60cc4703
commit
0cb3352625
@ -294,12 +294,25 @@ ThreadedDriver::Stop()
|
||||
SystemClockDriver::SystemClockDriver(MediaStreamGraphImpl* aGraphImpl)
|
||||
: ThreadedDriver(aGraphImpl),
|
||||
mInitialTimeStamp(TimeStamp::Now()),
|
||||
mLastTimeStamp(TimeStamp::Now())
|
||||
mLastTimeStamp(TimeStamp::Now()),
|
||||
mIsFallback(false)
|
||||
{}
|
||||
|
||||
SystemClockDriver::~SystemClockDriver()
|
||||
{ }
|
||||
|
||||
void
|
||||
SystemClockDriver::MarkAsFallback()
|
||||
{
|
||||
mIsFallback = true;
|
||||
}
|
||||
|
||||
bool
|
||||
SystemClockDriver::IsFallback()
|
||||
{
|
||||
return mIsFallback;
|
||||
}
|
||||
|
||||
void
|
||||
ThreadedDriver::RunThread()
|
||||
{
|
||||
@ -545,6 +558,7 @@ AudioCallbackDriver::AudioCallbackDriver(MediaStreamGraphImpl* aGraphImpl)
|
||||
, mAddedMixer(false)
|
||||
, mInCallback(false)
|
||||
, mMicrophoneActive(false)
|
||||
, mFromFallback(false)
|
||||
{
|
||||
STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver ctor for graph %p", aGraphImpl));
|
||||
}
|
||||
@ -636,13 +650,20 @@ AudioCallbackDriver::Init()
|
||||
StaticMutexAutoUnlock unlock(AudioInputCubeb::Mutex());
|
||||
#endif
|
||||
NS_WARNING("Could not create a cubeb stream for MediaStreamGraph, falling back to a SystemClockDriver");
|
||||
CubebUtils::ReportCubebStreamInitFailure(firstStream);
|
||||
// Only report failures when we're not coming from a driver that was
|
||||
// created itself as a fallback driver because of a previous audio driver
|
||||
// failure.
|
||||
if (!mFromFallback) {
|
||||
CubebUtils::ReportCubebStreamInitFailure(firstStream);
|
||||
}
|
||||
// Fall back to a driver using a normal thread.
|
||||
MonitorAutoLock lock(GraphImpl()->GetMonitor());
|
||||
SetNextDriver(new SystemClockDriver(GraphImpl()));
|
||||
NextDriver()->SetGraphTime(this, mIterationStart, mIterationEnd);
|
||||
mGraphImpl->SetCurrentDriver(NextDriver());
|
||||
NextDriver()->Start();
|
||||
SystemClockDriver* nextDriver = new SystemClockDriver(GraphImpl());
|
||||
SetNextDriver(nextDriver);
|
||||
nextDriver->MarkAsFallback();
|
||||
nextDriver->SetGraphTime(this, mIterationStart, mIterationEnd);
|
||||
mGraphImpl->SetCurrentDriver(nextDriver);
|
||||
nextDriver->Start();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -689,6 +710,8 @@ AudioCallbackDriver::Start()
|
||||
mPreviousDriver = nullptr;
|
||||
} else {
|
||||
LIFECYCLE_LOG("Dropping driver reference for SystemClockDriver.");
|
||||
MOZ_ASSERT(mPreviousDriver->AsSystemClockDriver());
|
||||
mFromFallback = mPreviousDriver->AsSystemClockDriver()->IsFallback();
|
||||
mPreviousDriver = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ class MediaStreamGraphImpl;
|
||||
|
||||
class AudioCallbackDriver;
|
||||
class OfflineClockDriver;
|
||||
class SystemClockDriver;
|
||||
|
||||
/**
|
||||
* A driver is responsible for the scheduling of the processing, the thread
|
||||
@ -165,6 +166,10 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual SystemClockDriver* AsSystemClockDriver() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell the driver it has to stop and return the current time of the graph, so
|
||||
* another driver can start from the right point in time.
|
||||
@ -296,13 +301,20 @@ public:
|
||||
MediaTime GetIntervalForIteration() override;
|
||||
void WaitForNextIteration() override;
|
||||
void WakeUp() override;
|
||||
|
||||
void MarkAsFallback();
|
||||
bool IsFallback();
|
||||
SystemClockDriver* AsSystemClockDriver() {
|
||||
return this;
|
||||
}
|
||||
|
||||
private:
|
||||
// Those are only modified (after initialization) on the graph thread. The
|
||||
// graph thread does not run during the initialization.
|
||||
TimeStamp mInitialTimeStamp;
|
||||
TimeStamp mLastTimeStamp;
|
||||
// This is true if this SystemClockDriver runs the graph because we could not
|
||||
// open an audio stream.
|
||||
bool mIsFallback;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -525,6 +537,9 @@ private:
|
||||
* True if microphone is being used by this process. This is synchronized by
|
||||
* the graph's monitor. */
|
||||
bool mMicrophoneActive;
|
||||
/* True if this driver was created from a driver created because of a previous
|
||||
* AudioCallbackDriver failure. */
|
||||
bool mFromFallback;
|
||||
};
|
||||
|
||||
class AsyncCubebTask : public Runnable
|
||||
|
Loading…
Reference in New Issue
Block a user