当前位置: 首页 > news >正文

手机miracast投屏到ops设备没有画面随机问题分析

问题

手机Miracast投屏至OPS设备时有弹窗,无视频画面,手机端显示连接投屏成功。

问题根因

随机出现无视频画面是因为下面两个函数调用的时序不稳定,可能会导致sharedDecoder_->Start没有被调用。
sharedDecoder_ 对象是在AppendSurface接口里面创建的,如果start比AppendSurface先调用,则sharedDecoder_ 没有创建,isPlaying_ 不会置为true,等AppendSurface调用时isPlaying_的值为false,也不会调用sharedDecoder_->Start。

voidMediaController::Start(){SHARING_LOGI("tttt MediaController::Start.");automediaChannel=mediaChannel_.lock();RETURN_IF_NULL(mediaChannel);autodispatcher=mediaChannel->GetDispatcher();RETURN_IF_NULL(dispatcher);{std::lock_guard<std::mutex>lock(playAudioMutex_);if(nullptr!=audioPlayController_){if(audioPlayController_->Start(dispatcher)){isPlaying_=true;}}}{std::lock_guard<std::mutex>lock(playVideoMutex_);if(sharedDecoder_&&sharedDecoder_->SurfaceCount()>0){if(sharedDecoder_->Start(dispatcher)){isPlaying_=true;}}}SHARING_LOGI("tttt MediaController::Start end.");}
boolMediaController::AppendSurface(sptr<Surface>surface,SceneType sceneType){RETURN_FALSE_IF_NULL(surface);SHARING_LOGI("tttt MediaController::AppendSurface.");std::lock_guard<std::mutex>lock(playVideoMutex_);if(!EnsureSharedDecoder()){SHARING_LOGE("cannot create shared decoder, mediachannelId: %{public}u.",mediachannelId_);returnfalse;}uint64_tsurfaceId=surface->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_){automediaChannel=mediaChannel_.lock();if(mediaChannel){autodispatcher=mediaChannel->GetDispatcher();if(dispatcher){sharedDecoder_->Start(dispatcher);}}}returntrue;}

解决方法

AppendSurface调用时,每次都调用sharedDecoder_->Start。

@@-139,6+143,7@@boolMediaController::AppendSurface(sptr<Surface>surface,SceneType sceneType){RETURN_FALSE_IF_NULL(surface);+SHARING_LOGI("tttt MediaController::AppendSurface.");std::lock_guard<std::mutex>lock(playVideoMutex_);if(!EnsureSharedDecoder()){SHARING_LOGE("cannot create shared decoder, mediachannelId: %{public}u.",mediachannelId_);@@-156,12+161,15@@boolMediaController::AppendSurface(sptr<Surface>surface,SceneType sceneType)returnfalse;}-if(isPlaying_){+SHARING_LOGI("tttt MediaController::AppendSurface, isPlaying_=%{public}d",isPlaying_.load());+//if (isPlaying_) {+if(true){automediaChannel=mediaChannel_.lock();if(mediaChannel){autodispatcher=mediaChannel->GetDispatcher();if(dispatcher){sharedDecoder_->Start(dispatcher);+isPlaying_=true;}}}
http://www.jsqmd.com/news/1115533/

相关文章:

  • 秦纪一(第1部分,共3部分)
  • 用BERTopic做科研趋势分析:从论文元数据挖掘技术热点
  • 工业4-20mA电流环发射器设计与STM32F723应用
  • PIC32MZ驱动WS2812全攻略:从硬件到高级效果实现
  • ClickHouse EXPLAIN 完全实战指南:AST / SYNTAX / QUERY TREE / PLAN / PIPELINE 一文搞懂
  • MTKClient深度指南:三步法救砖联发科设备与专业调试方案
  • STM32L4S5ZI与KMX62 IMU的稳定性控制实现
  • 柔性供应链架构设计:应对多批次小订单生产的管理逻辑与技术演进
  • 具身智能的“ChatGPT时刻”:TVA技术演进与前景展望(3)
  • 银河麒麟ARM性能优化:解决SQLite数据库打开慢、查询卡顿、加载延迟问题
  • AI自动生成论文可靠吗?2026年精选11款写论文的AI指南,帮你规避学术不端雷区
  • 计算机毕业设计之基于弹幕挖掘的视频数据分析技术研究
  • 仪器硬件的AC-DC和DC-DC国产工业电源模块技术选型指南:三个经验推荐重点技术指标,功率余量丨EMC设计丨工况防护
  • 学习C++之头文件引入
  • 如何高效管理Minecraft数据:NBTExplorer专业NBT编辑工具实战指南
  • 计算机毕业设计之基于大数据技术的社交媒体事件热度分析系统的设计与实现
  • 如何做好Code Review——附十大中高风险安全漏洞排查指南
  • Pytest+Playwright自动化测试:pytest.ini配置详解与最佳实践
  • MC6470与TM4C1299KCZAD实现高精度运动控制
  • Java 对接 CoAP 完整方案
  • 告别公式复制烦恼:LaTeX2Word-Equation一键转换解决方案
  • 手机租赁商家如何选择监管锁?从技术、安全和运维能力看,什么样的监管锁才靠谱?
  • 深度学习训练核心:计算图与反向传播机制详解
  • 如何一次性解决所有Windows DLL缺失问题:VisualCppRedist AIO完整指南
  • Databricks上构建高可靠邮件分类LLM流水线
  • 标准化软件和定制开发的区别是什么?(实战干货笔记)
  • 运动耳机什么牌子好?盘点十款健身、跑步、游泳多场景适用机型
  • 2026年口碑最佳梳子厂家,选这5家不踩雷
  • 工业机器视觉工程师未来的出路在哪里
  • STC3115电池监控芯片与STM32F405RG的集成应用