Bug 1270110 - Bail on unsupported libspeechd versions. r=smaug
libspeechd does not have a version getter function, so we need to look for a recent
API addition to know we are on a newer version.
MozReview-Commit-ID: FpXwGYMxxDB
--- a/dom/media/webspeech/synth/speechd/SpeechDispatcherService.cpp
+++ b/dom/media/webspeech/synth/speechd/SpeechDispatcherService.cpp
@@ -339,16 +339,23 @@ SpeechDispatcherService::Setup()
speechdLib = PR_LoadLibrary("libspeechd.so.2");
if (!speechdLib) {
NS_WARNING("Failed to load speechd library");
return;
}
+ if (!PR_FindFunctionSymbol(speechdLib, "spd_get_volume")) {
+ // There is no version getter function, so we rely on a symbol that was
+ // introduced in release 0.8.2 in order to check for ABI compatibility.
+ NS_WARNING("Unsupported version of speechd detected");
+ return;
+ }
+
for (uint32_t i = 0; i < ArrayLength(kSpeechDispatcherSymbols); i++) {
*kSpeechDispatcherSymbols[i].function =
PR_FindFunctionSymbol(speechdLib, kSpeechDispatcherSymbols[i].functionName);
if (!*kSpeechDispatcherSymbols[i].function) {
NS_WARNING(nsPrintfCString("Failed to find speechd symbol for'%s'",
kSpeechDispatcherSymbols[i].functionName).get());
return;