Bug 1247056 - Handle PulseAudio init error in DecDoc - r=jwwang

MozReview-Commit-ID: 8qa0MO35mRD

--HG--
extra : rebase_source : b557992bb78c0d6c776adf83740bbc07b831c898
This commit is contained in:
Gerald Squelart 2016-09-18 19:41:36 -07:00
parent 2e32eccffc
commit 7368a3ff17
4 changed files with 28 additions and 5 deletions

View File

@ -134,6 +134,7 @@ MediaPlatformDecoderNotFound=The video on this page cant be played. Your syst
MediaCannotPlayNoDecoders=Cannot play media. No decoders for requested formats: %S
# LOCALIZATION NOTE: %S is a comma-separated list of codecs (e.g. 'video/mp4, video/webm')
MediaNoDecoders=No decoders for some of the requested formats: %S
MediaCannotInitializePulseAudio=Unable to use PulseAudio
# LOCALIZATION NOTE: Do not translate "MediaRecorder".
MediaRecorderMultiTracksNotSupported=MediaRecorder does not support recording multiple tracks of the same type at this time.
# LOCALIZATION NOTE: %S is the ID of the MediaStreamTrack passed to MediaStream.addTrack(). Do not translate "MediaStreamTrack" and "AudioChannel".

View File

@ -264,6 +264,9 @@ static const NotificationAndReportStringId sMediaCannotPlayNoDecoders =
static const NotificationAndReportStringId sMediaNoDecoders =
{ dom::DecoderDoctorNotificationType::Can_play_but_some_missing_decoders,
"MediaNoDecoders" };
static const NotificationAndReportStringId sCannotInitializePulseAudio =
{ dom::DecoderDoctorNotificationType::Cannot_initialize_pulseaudio,
"MediaCannotInitializePulseAudio" };
static const NotificationAndReportStringId*
sAllNotificationsAndReportStringIds[] =
@ -273,7 +276,8 @@ sAllNotificationsAndReportStringIds[] =
&sMediaUnsupportedBeforeWindowsVista,
&sMediaPlatformDecoderNotFound,
&sMediaCannotPlayNoDecoders,
&sMediaNoDecoders
&sMediaNoDecoders,
&sCannotInitializePulseAudio
};
static void
@ -757,14 +761,32 @@ DecoderDoctorDiagnostics::StoreEvent(nsIDocument* aDocument,
return;
}
// TODO: Handle event here.
// Don't keep events for later processing, just handle them now.
#ifdef MOZ_PULSEAUDIO
switch (aEvent.mDomain) {
case DecoderDoctorEvent::eAudioSinkStartup:
if (aEvent.mResult == NS_ERROR_DOM_MEDIA_CUBEB_INITIALIZATION_ERR) {
DD_INFO("DecoderDoctorDocumentWatcher[%p, doc=%p]::AddDiagnostics() - unable to initialize PulseAudio",
this, aDocument);
ReportAnalysis(aDocument, sCannotInitializePulseAudio,
false, NS_LITERAL_STRING("*"));
} else if (aEvent.mResult == NS_OK) {
DD_INFO("DecoderDoctorDocumentWatcher[%p, doc=%p]::AddDiagnostics() - now able to initialize PulseAudio",
this, aDocument);
ReportAnalysis(aDocument, sCannotInitializePulseAudio,
true, NS_LITERAL_STRING("*"));
}
break;
}
#endif // MOZ_PULSEAUDIO
}
static const char*
EventDomainString(DecoderDoctorEvent::Domain aDomain)
{
switch (aDomain) {
// TODO
case DecoderDoctorEvent::eAudioSinkStartup:
return "audio-sink-startup";
}
return "?";
}

View File

@ -15,7 +15,7 @@ namespace mozilla {
struct DecoderDoctorEvent {
enum Domain {
// TODO
eAudioSinkStartup,
} mDomain;
nsresult mResult;
};

View File

@ -391,7 +391,7 @@ pref("media.gmp.storage.version.expected", 1);
// Filter what triggers user notifications.
// See DecoderDoctorDocumentWatcher::ReportAnalysis for details.
pref("media.decoder-doctor.notifications-allowed", "MediaWMFNeeded,MediaWidevineNoWMFNoSilverlight");
pref("media.decoder-doctor.notifications-allowed", "MediaWMFNeeded,MediaWidevineNoWMFNoSilverlight,MediaCannotInitializePulseAudio");
// Whether we report partial failures.
pref("media.decoder-doctor.verbose", false);
// Whether DD should consider WMF-disabled a WMF failure, useful for testing.