[WFD]播放DRM视频时,SINK端显示全黑画面或者默认图片

来源:互联网 发布:js div显示 编辑:程序博客网 时间:2024/06/10 00:02

[WFD]播放DRM视频时,SINK端显示全黑画面或者默认图片

[DESCRIPTION]

假设WFD SINK为TV ,和手机通过WFD连接上后,TV画面显示正常。
但是打开第三方视频播放软件(如iFlix)播放视频,或者播放本地DRM视频时,TV端画面显示全黑或者是一张默认图片(如下图)。

4.27tp-26.png (63.29 KB, 下载次数: 0 )

下载附件  保存到相册

2016-4-27 16:51 上传



[SOLUTION]

此现象为正常现象,通常是WFD SOURCE或者WFD SINK不支持HDCP导致。
代码实现逻辑如下:
1.SOURCE和SINK沟通协商是否支持HDCP,是否需要建立hdcp连接,并将最终将协商结果反应在
mUsingHDCP上。
若SOURCE没有打开宏MTK_DX_HDCP_SUPPORT,不支持HDCP,则在M3阶段不会发送
“wfd_content_protection”参数;
若SINK端不支持HDCP,则在M3 Response里不会回复“wfd_content_protectio”对应value为
“none”.
frameworks\av\media\libstagefright\WIFIdisplay\
source\WifiDisplaySource.cpp
status_t WifiDisplaySource::sendM3(int32_t sessionID) {
...
AString body =
#if defined(MTK_DX_HDCP_SUPPORT) || defined(WFD_HDCP_TX_SUPPORT)
"wfd_content_protection\r\n"
#endif
"wfd_video_formats\r\n"
"wfd_audio_codecs\r\n"
"wfd_client_rtp_ports\r\n";
...
}
status_t WifiDisplaySource:nReceiveM3Response(
...
mUsingHDCP = false;
if (!params->findParameter("wfd_content_protection", &value)) {
ALOGI("Sink doesn't appear to support content protection.");
} else if (value == "none") {
ALOGI("Sink does not support content protection.");
} else {
#if HDCP_ENABLE_CONTROL
char v[PROPERTY_VALUE_MAX];
if (property_get("media.stagefright_wfd.hdcp.off", v, NULL)
&& (!strcmp(v, "1") ))
{
ALOGD("turn off HDCP !");
}
else
#endif
{
mUsingHDCP = true;
...
}
2.WifiDisplaySource将通过mUsingHDCP,决定是否设置secure标志给WifiDisplayAdapter-
>WifiDisplayDevice.
frameworks\av\media\libstagefright\wifidisplay\
source\WifiDisplaySource.cpp
void WifiDisplaySource:nMessageReceived(const sp &msg) {
...
case kWhatPlaybackSessionNotify:
{
...
if (mClient != NULL) {
ALOGD("laybackSession::kWhatSessionEstablished HDCP = %d\n", mUsingHDCP);
if (!mSinkSupportsVideo) {
mClient->onDisplayConnected(
NULL, // SurfaceTexture
0, // width,
0, // height,
mUsingHDCP
? IRemoteDisplayClient::kDisplayFlagSecure
: 0,
0);
} else {
size_t width, height;
CHECK(VideoFormats::GetConfiguration(
mChosenVideoResolutionType,
mChosenVideoResolutionIndex,
&width,
&height,
NULL /* framesPerSecond */,
NULL /* interlaced */));
mClient->onDisplayConnected(
mClientInfo.mPlaybackSession
->getSurfaceTexture(),
width,
height,
mUsingHDCP
? IRemoteDisplayClient::kDisplayFlagSecure
: 0,
playbackSessionID);
}
}
...
}
3.在surface ondraw的过程中,若播放secure内容时,通过hw->isSecure()来确认是否是有建立
hdcp安全通道,选择是显示默认图片还是直接显示视频画面。
frameworks\native\services\surfaceflinger\Layer.cpp
void Layer:nDraw(const sp& hw, const Region& clip,
bool useIdentityTransform) const
{
...
//若app有对播放内容做保护isSeCure()=true;若没有建立HDCP连接,则hw-
>isSecure()=false,所以最终blackOutLayer为true。
bool blackOutLayer = isProtected() || (isSecure() && !hw->isSecure());
if (!blackOutLayer) {
...
} else {
#ifdef MTK_AOSP_ENHANCEMENT
char value[PROPERTY_VALUE_MAX];
property_get("debug.sf.no_security_img", value, "0");
if ((atoi(value) == 0) && (false == hw->isSecure()))
engine.setupLayerProtectImage();
else
#endif
engine.setupLayerBlackedOut();
}
...
}
所以该问题请先确认WFD SOURCE和SINK是否支持HDCP,若有一方不支持,该问题即为正常现象。


0 0
原创粉丝点击