예제 #1
0
static bool
GMPDecryptsAndGeckoDecodesAAC(mozIGeckoMediaPluginService* aGMPService,
                              const nsAString& aKeySystem,
                              const nsAString& aContentType,
                              DecoderDoctorDiagnostics* aDiagnostics)
{
  MOZ_ASSERT(HaveGMPFor(aGMPService,
                        NS_ConvertUTF16toUTF8(aKeySystem),
                        NS_LITERAL_CSTRING(GMP_API_DECRYPTOR)));
  MOZ_ASSERT(IsAACContentType(aContentType));

  if (HaveGMPFor(aGMPService,
    NS_ConvertUTF16toUTF8(aKeySystem),
    NS_LITERAL_CSTRING(GMP_API_AUDIO_DECODER),
    NS_LITERAL_CSTRING("aac"))) {
    // We do have a GMP for AAC -> Gecko itself does *not* decode AAC.
    return false;
  }
#if defined(MOZ_WIDEVINE_EME) && defined(XP_WIN)
  // Widevine CDM doesn't include an AAC decoder. So if WMF can't
  // decode AAC, and a codec wasn't specified, be conservative
  // and reject the MediaKeys request, since our policy is to prevent
  //  the Adobe GMP's unencrypted AAC decoding path being used to
  // decode content decrypted by the Widevine CDM.
  if (aKeySystem.EqualsLiteral("com.widevine.alpha") &&
      !WMFDecoderModule::HasAAC()) {
    if (aDiagnostics) {
      aDiagnostics->SetKeySystemIssue(
        DecoderDoctorDiagnostics::eWidevineWithNoWMF);
    }
    return false;
  }
#endif
  return MP4Decoder::CanHandleMediaType(aContentType, aDiagnostics);
}
예제 #2
0
static bool
IsSupportedAudio(mozIGeckoMediaPluginService* aGMPService,
                 const nsAString& aKeySystem,
                 const nsAString& aAudioType)
{
  return IsAACContentType(aAudioType) &&
         (GMPDecryptsAndDecodesAAC(aGMPService, aKeySystem) ||
          GMPDecryptsAndGeckoDecodesAAC(aGMPService, aKeySystem, aAudioType));
}
예제 #3
0
static bool
GMPDecryptsAndGeckoDecodesAAC(mozIGeckoMediaPluginService* aGMPService,
                              const nsAString& aKeySystem,
                              const nsAString& aContentType)
{
  MOZ_ASSERT(HaveGMPFor(aGMPService,
                        NS_ConvertUTF16toUTF8(aKeySystem),
                        NS_LITERAL_CSTRING(GMP_API_DECRYPTOR)));
  MOZ_ASSERT(IsAACContentType(aContentType));
  return
    (!HaveGMPFor(aGMPService,
                 NS_ConvertUTF16toUTF8(aKeySystem),
                 NS_LITERAL_CSTRING(GMP_API_AUDIO_DECODER),
                 NS_LITERAL_CSTRING("aac"))
#ifdef XP_WIN
    // Clearkey on Windows advertises that it can decode in its GMP info
    // file, but uses Windows Media Foundation to decode. That's not present
    // on Windows XP, and on some Vista, Windows N, and KN variants without
    // certain services packs. So don't try to use gmp-clearkey for decoding
    // if we don't have a decoder here.
    || (aKeySystem.EqualsLiteral("org.w3.clearkey") && !WMFDecoderModule::HasAAC())
#endif
    ) && MP4Decoder::CanHandleMediaType(aContentType);
}