暂停ExoPlayer并将应用程序置于后台时,我总是收到错误消息。该流包含Widevine受保护的内容以及在服务器端插入的广告。 我怀疑受保护内容和不受保护内容的混合会导致错误,但不知道从哪里开始。在未受保护的预贴式广告中,将应用置于后台并恢复运行实际上只能运行一次,但是在主要内容中第二次尝试时会失败。
SurfaceUtils
记录以下消息:native window cannot handle protected buffers: the consumer should either be a hardware composer or support hardware protection
。
有人知道这实际上意味着什么吗?不幸的是,我对ExoPlayer的内部运作不太熟悉。
SurfaceUtils.cpp
中返回错误的代码在这里可能会有所帮助:
// Make sure to check whether either Stagefright or the video decoder
// requested protected buffers.
if (usage & GRALLOC_USAGE_PROTECTED) {
// Check if the ANativeWindow sends images directly to SurfaceFlinger.
int queuesToNativeWindow = 0;
err = nativeWindow->query(
nativeWindow, NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER, &queuesToNativeWindow);
if (err != NO_ERROR) {
ALOGE("error authenticating native window: %s (%d)", strerror(-err), -err);
return err;
}
// Check if the consumer end of the ANativeWindow can handle protected content.
int isConsumerProtected = 0;
err = nativeWindow->query(
nativeWindow, NATIVE_WINDOW_CONSUMER_IS_PROTECTED, &isConsumerProtected);
if (err != NO_ERROR) {
ALOGE("error query native window: %s (%d)", strerror(-err), -err);
return err;
}
// Deny queuing into native window if neither condition is satisfied.
if (queuesToNativeWindow != 1 && isConsumerProtected != 1) {
ALOGE("native window cannot handle protected buffers: the consumer should either be a hardware composer or support hardware protection");
return PERMISSION_DENIED;
}
}