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

火山 RTC 引擎10 ----远端视频 转网易视频格式

一、

1、原网易视频回调

void  onFrameDataCallback(uid_t uid,          /**< uid */void *data,         /**< 数据指针 */uint32_t type,      /**< NERtcVideoType */uint32_t width,     /**< 宽度 */uint32_t height,    /**< 高度 */uint32_t count,     /**< 数据类型个数,即offset及stride的数目 */uint32_t offset[4], /**< 每类数据偏移 */uint32_t stride[4], /**< 每类数据步进 */uint32_t rotation,  /**< NERtcVideoRotation */void *user_data     /**< 用户透传数据 */){//40267293  刘亚晓  40223353 小黑8Json::Value values;values["account"] = uid;/*bool bAudioMode = false;if (width <= 320)bAudioMode = true;elsebAudioMode = false;std::string im = std::to_string(uid);if (!BExistIm(im) || BAudioModeOfIm(im) != bAudioMode){ResetAudioMode(im, bAudioMode);// 在UI线程中执行更新UI的操作if (uiCallback)uiCallback(uid,bAudioMode);}*/std::string json = values.toStyledString();int64_t time = GetCurTimeStamp();uint32_t size = width * height * 3 / 2;VideoManager::GetInstance()->video_frame_mng_.AddVideoFrame(false, time, (char*)data, size, width, height, json, nim_comp::VideoFrameMng::Ft_I420, false, offset, stride);//	VideoManager::GetInstance()->video_frame_mng2_.AddVideoFrame(false, time, (char*)data, size, width, height, json, nim_comp::VideoFrameMng::Ft_I420, false, offset, stride);return;}

2、火山视频格式转网易

	bool ChatroomForm::OnFrameDataCallback_ByterRTC(bytertc::IVideoFrame* video_frame){if (!video_frame) return false;bytertc::VideoFrameType type = video_frame->frameType();bytertc::VideoPixelFormat format = video_frame->pixelFormat();bytertc::VideoContentType contentType = video_frame->videoContentType();int width = video_frame->width();int height = video_frame->height();const int planeCount = video_frame->numberOfPlanes();if (planeCount < 3) return false; // I420 需要至少3个planeuint8_t* y_plane = video_frame->getPlaneData(0);uint8_t* u_plane = video_frame->getPlaneData(1);uint8_t* v_plane = video_frame->getPlaneData(2);uint32_t stride[4] = {static_cast<uint32_t>(video_frame->getPlaneStride(0)),static_cast<uint32_t>(video_frame->getPlaneStride(1)),static_cast<uint32_t>(video_frame->getPlaneStride(2)),0};uint8_t* base_ptr = y_plane;uint32_t offset[4] = {0,static_cast<uint32_t>(u_plane - base_ptr),static_cast<uint32_t>(v_plane - base_ptr),0};Json::Value values;values["account"] = "40267293";std::string json = values.toStyledString();int64_t time = GetCurTimeStamp();uint32_t size = width * height * 3 / 2;VideoManager::GetInstance()->video_frame_mng_.AddVideoFrame(false, time, (char*)base_ptr, size, width, height, json, nim_comp::VideoFrameMng::Ft_I420, false, offset, stride);return true;}

相关文章:

  • Houdini POP入门学习07 - 分组
  • 算法岗面试经验分享-大模型篇
  • 学校时钟系统,标准考场时钟系统,AI亮相2025高考,赛思时钟系统为教育公平筑起“精准防线”
  • 软件开发工程师如何在项目开发中了解学习 ISO 13485
  • WPS2024 软件下载及安装教程!
  • Java多线程实现之Thread类深度解析
  • AI电销机器人智能的发展趋势是什么?
  • 无需改造业务系统,数据导出行为也能“可控、可审、可溯”
  • 验证回文串
  • 根据万维钢·精英日课6的内容,使用AI(2025)可以参考以下方法:
  • Docker拉取MySQL后数据库连接失败的解决方案
  • 解决:Android studio 编译后报错\app\src\main\cpp\CMakeLists.txt‘ to exist
  • 如何在Android Studio中导出apk文件
  • 使用LangGraph和LangSmith构建多智能体人工智能系统
  • 快速排序算法改进:随机快排-荷兰国旗划分详解
  • Python异步编程:深入理解协程的原理与实践指南
  • AI辅助办公让公司陷入数据泄密危机
  • 今日行情明日机会——20250609
  • Prometheus+ Grafana 监控系统入门
  • Java网络编程中IP详解
  • 我做的网站怎样推广/有网站模板怎么建站
  • 婚纱摄影网站建设方案/推广普通话手抄报图片大全
  • 网站建站的步骤流程/百度seo规则
  • wordpress button/seo技术团队
  • 做卡贴质量好的网站/上海高端网站定制
  • 网站设计制作系统哪个好/软文推广系统