前面我们分析了VideoCaptureInputTest的实现,从中了解到了VideoCaptureInput的基本用法:
1.VideoCaptureInput类成员分析:
关键成员变量:
- encoder_thread_,对输入video数据进行处理的主线程
- capture_event_,控制encoder_thread_执行,通过Wait()函数阻塞线程,当数据ready后,通过Set()函数激活
- module_process_thread_,没搞明白
- frame_callback_,通过callback方法获取video数据
- stats_proxy_,发送端video数据信息的变量,需要即时更新
- local_renderer_,本地图像渲染
- incoming_frame_,当前收到的frame
- VideoCaptureInput构造函数,初始化相关变量
- EncoderThreadFunction,encoder_thread_的具体实现
- IncomingCapturedFrame,将数据保存至captured_frame_,并驱动EncodeProcess
2. 创建VideoCaptureInput对象
- ThreadWrapper::CreateThread(EncoderThreadFunction>..)
- capture_event_(EventWrapper::Create())
VideoCaptureInput::VideoCaptureInput(
ProcessThread* module_process_thread,
VideoCaptureCallback* frame_callback,
VideoRenderer* local_renderer,
SendStatisticsProxy* stats_proxy,
CpuOveruseObserver* overuse_observer,
EncodingTimeObserver* encoding_time_observer)
: capture_cs_(CriticalSectionWrapper::CreateCriticalSection()),
module_process_thread_(module_process_thread),
frame_callback_(frame_callback),
local_renderer_(local_renderer),
stats_proxy_(stats_proxy),
incoming_frame_cs_(CriticalSectionWrapper::CreateCriticalSection()),
//创建encode thread
encoder_thread_(ThreadWrapper::CreateThread(EncoderThreadFunction),

本文深入分析了WebRTC中的VideoCaptureInput类,详细阐述了其成员变量的作用,如encoder_thread_用于数据处理,capture_event_用于线程同步,以及frame_callback_用于获取视频数据。接着,介绍了如何创建VideoCaptureInput对象、启动编码线程,以及视频数据的编码处理流程。在数据输入部分,重点讲解了IncomingCapturedFrame如何驱动编码过程。
最低0.47元/天 解锁文章
558

被折叠的 条评论
为什么被折叠?



