void
MediaDrmJavaCallbacksSupport::OnRejectPromise(int aPromiseId, jni::String::Param aMessage)
{
  MOZ_ASSERT(NS_IsMainThread());
  nsCString reason = aMessage->ToCString();
  MDRMN_LOG("OnRejectPromise aMessage(%s) ", reason.get());
  // Current implementation assume all the reject from MediaDrm is due to invalid state.
  // Other cases should be handled before calling into MediaDrmProxy API.
  mDecryptorProxyCallback->RejectPromise(aPromiseId,
                                         NS_ERROR_DOM_INVALID_STATE_ERR,
                                         reason);
}
void
MediaDrmJavaCallbacksSupport::OnSessionError(jni::ByteArray::Param aSessionId,
                                             jni::String::Param aMessage)
{
  MOZ_ASSERT(NS_IsMainThread());
  nsCString sessionId(reinterpret_cast<char*>(aSessionId->GetElements().Elements()),
                      aSessionId->Length());
  nsCString errorMessage = aMessage->ToCString();
  MDRMN_LOG("SessionId(%s)", sessionId.get());
  // TODO: We cannot get system error code from media drm API.
  // Currently use -1 as an error code.
  mDecryptorProxyCallback->SessionError(sessionId,
                                        NS_ERROR_DOM_INVALID_STATE_ERR,
                                        -1,
                                        errorMessage);
}
Beispiel #3
0
    static void SpeculativeConnect(jni::String::Param uriStr)
    {
        if (!NS_IsMainThread()) {
            // We will be on the main thread if the call was queued on the Java
            // side during startup. Otherwise, the call was not queued, which
            // means Gecko is already sufficiently loaded, and we don't really
            // care about speculative connections at this point.
            return;
        }

        nsCOMPtr<nsIIOService> ioServ = do_GetIOService();
        nsCOMPtr<nsISpeculativeConnect> specConn = do_QueryInterface(ioServ);
        if (!specConn) {
            return;
        }

        nsCOMPtr<nsIURI> uri = ResolveURI(uriStr->ToCString());
        if (!uri) {
            return;
        }
        specConn->SpeculativeConnect(uri, nullptr);
    }