【webrtc】ModuleRtpRtcpImpl2: RtpRtcp DEPRECATED_Create 废弃了

博客介绍了在m98版本的WebRTC中,RtpRtcp::Create静态工厂方法被废弃,并引入了ModuleRtpRtcpImpl2作为替代。这个新模块不仅自己创建实例,还提供了便利的迁移方法。尽管video/rtp_video_stream_receiver.cc未做改动,但ModuleRtpRtcpImpl2实现了RTCPReceiver接口,专门用于接收侧。此外,文章讨论了RtpRtcp::DEPRECATED_Create在发送侧的使用频率较低。

  • 基于m98 代码。

Deprecate the static RtpRtcp::Create() method.

  • 提交记录
  • RtpRtcp::Create factory method 工厂方法废弃了。
std::unique_ptr<RtpRtcp> RtpRtcp::DEPRECATED_Create(
    const Configu
#include "api/audio_codecs/builtin_audio_decoder_factory.h" #include "api/audio_codecs/builtin_audio_encoder_factory.h" #include "api/create_peerconnection_factory.h" #include "api/media_stream_interface.h" #include "modules/audio_device/include/audio_device_module.h" // 初始化 WebRTC 工厂实例 rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> CreatePcFactory() { webrtc::PeerConnectionFactoryDependencies dependencies; auto adm = webrtc::AudioDeviceModule::Create( webrtc::AudioDeviceModule::kPlatformDefaultAudio); dependencies.task_queue_factory = webrtc::CreateDefaultTaskQueueFactory(); dependencies.adm = adm; dependencies.audio_encoder_factory = webrtc::CreateBuiltinAudioEncoderFactory(); dependencies.audio_decoder_factory = webrtc::CreateBuiltinAudioDecoderFactory(); return webrtc::CreateModularPeerConnectionFactory(dependencies); } void StartRecording(rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface>& pc_factory, std::string output_file_path) { // 创建音频源 rtc::scoped_refptr<webrtc::AudioSourceInterface> audio_source = pc_factory->CreateAudioSource(webrtc::AudioSource::Options()); // 添加到媒体流中 rtc::scoped_refptr<webrtc::MediaStreamInterface> local_media_stream = pc_factory->CreateLocalMediaStream("stream_label"); rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track = pc_factory->CreateAudioTrack("audio_label", audio_source); local_media_stream->AddTrack(audio_track); // 配置录音文件写入器 cricket::FileRecord record(output_file_path, true /* overwrite */); if (!record.Init()) { RTC_LOG(LS_ERROR) << "Failed to initialize file recorder."; return; } // 开始记录音频数据 audio_source->RegisterAudioObserver(&record); bool success = audio_source->StartCapture(); if (!success) { RTC_LOG(LS_ERROR) << "Failed to start audio capture."; } }用c++运行一下
最新发布
05-09
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

等风来不如迎风去

你的鼓励是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值