问题手机Miracast投屏至OPS设备时有弹窗无视频画面手机端显示连接投屏成功。问题根因随机出现无视频画面是因为下面两个函数调用的时序不稳定可能会导致sharedDecoder_-Start没有被调用。sharedDecoder_ 对象是在AppendSurface接口里面创建的如果start比AppendSurface先调用则sharedDecoder_ 没有创建isPlaying_ 不会置为true等AppendSurface调用时isPlaying_的值为false也不会调用sharedDecoder_-Start。voidMediaController::Start(){SHARING_LOGI(tttt MediaController::Start.);automediaChannelmediaChannel_.lock();RETURN_IF_NULL(mediaChannel);autodispatchermediaChannel-GetDispatcher();RETURN_IF_NULL(dispatcher);{std::lock_guardstd::mutexlock(playAudioMutex_);if(nullptr!audioPlayController_){if(audioPlayController_-Start(dispatcher)){isPlaying_true;}}}{std::lock_guardstd::mutexlock(playVideoMutex_);if(sharedDecoder_sharedDecoder_-SurfaceCount()0){if(sharedDecoder_-Start(dispatcher)){isPlaying_true;}}}SHARING_LOGI(tttt MediaController::Start end.);}boolMediaController::AppendSurface(sptrSurfacesurface,SceneType sceneType){RETURN_FALSE_IF_NULL(surface);SHARING_LOGI(tttt MediaController::AppendSurface.);std::lock_guardstd::mutexlock(playVideoMutex_);if(!EnsureSharedDecoder()){SHARING_LOGE(cannot create shared decoder, mediachannelId: %{public}u.,mediachannelId_);returnfalse;}uint64_tsurfaceIdsurface-GetUniqueId();if(sharedDecoder_-HasSurface(surfaceId)){SHARING_LOGE(surface is in use, %{public}PRIx64.,surfaceId);returnfalse;}if(!sharedDecoder_-AddSurface(surface,sceneType)){SHARING_LOGE(AddSurface failed, mediachannelId: %{public}u.,mediachannelId_);returnfalse;}SHARING_LOGI(tttt MediaController::AppendSurface, isPlaying_%{public}d,isPlaying_.load());if(isPlaying_){automediaChannelmediaChannel_.lock();if(mediaChannel){autodispatchermediaChannel-GetDispatcher();if(dispatcher){sharedDecoder_-Start(dispatcher);}}}returntrue;}解决方法AppendSurface调用时每次都调用sharedDecoder_-Start。-139,6143,7boolMediaController::AppendSurface(sptrSurfacesurface,SceneType sceneType){RETURN_FALSE_IF_NULL(surface);SHARING_LOGI(tttt MediaController::AppendSurface.);std::lock_guardstd::mutexlock(playVideoMutex_);if(!EnsureSharedDecoder()){SHARING_LOGE(cannot create shared decoder, mediachannelId: %{public}u.,mediachannelId_);-156,12161,15boolMediaController::AppendSurface(sptrSurfacesurface,SceneType sceneType)returnfalse;}-if(isPlaying_){SHARING_LOGI(tttt MediaController::AppendSurface, isPlaying_%{public}d,isPlaying_.load());//if (isPlaying_) {if(true){automediaChannelmediaChannel_.lock();if(mediaChannel){autodispatchermediaChannel-GetDispatcher();if(dispatcher){sharedDecoder_-Start(dispatcher);isPlaying_true;}}}