运行AppRTC for ios,RtcEventLog问题

时间:2018-01-05 07:47:28

标签: ios webrtc openwebrtc

我想在AppRTCMobile中添加一个界面,这个界面可以启动webrtc调用模块,以实现两个手机之间的音频通话(局域网,已经知道IP地址和端口号),但是当我成功运行,每当RtcEventLog调用该方法时发生异常,软件就会崩溃。我不知道Calling Call是否合理。在没有解决方案的情况下,我真诚地感谢您的帮助。 在源代码下面,请帮我找到问题。

    std::unique_ptr<RtcEventLog> event_log = webrtc::RtcEventLog::Create();
    webrtc::Call::Config callConfig = webrtc::Call::Config(event_log.get());
    callConfig.bitrate_config.max_bitrate_bps = 500*1000;
    callConfig.bitrate_config.min_bitrate_bps = 100*1000;
    callConfig.bitrate_config.start_bitrate_bps = 250*1000;

    webrtc::AudioState::Config audio_state_config = webrtc::AudioState::Config();
    cricket::VoEWrapper* g_voe  = nullptr;
    rtc::scoped_refptr<webrtc::AudioDecoderFactory> g_audioDecoderFactory;
    g_audioDecoderFactory = webrtc::CreateBuiltinAudioDecoderFactory();
    g_voe = new cricket::VoEWrapper();
    audio_state_config.audio_processing = webrtc::AudioProcessing::Create();
    g_voe->base()->Init(NULL,audio_state_config.audio_processing,g_audioDecoderFactory);
    audio_state_config.voice_engine = g_voe->engine();

    audio_state_config.audio_mixer = webrtc::AudioMixerImpl::Create();
    callConfig.audio_state = AudioState::Create(audio_state_config);
    std::unique_ptr<RtcEventLog> event_logg = webrtc::RtcEventLog::Create();
    callConfig.event_log = event_logg.get();
    g_call = webrtc::Call::Create(callConfig);



    g_audioSendTransport = new AudioLoopbackTransport();
    webrtc::AudioSendStream::Config config(g_audioSendTransport);
    g_audioSendChannelId = g_voe->base()->CreateChannel();
    config.voe_channel_id = g_audioSendChannelId;
    g_audioSendStream = g_call->CreateAudioSendStream(config);


    webrtc::AudioReceiveStream::Config AudioReceiveConfig;
    AudioReceiveConfig.decoder_factory = g_audioDecoderFactory;
    g_audioReceiveChannelId = g_voe->base()->CreateChannel();
    AudioReceiveConfig.voe_channel_id = g_audioReceiveChannelId;
    g_audioReceiveStream = g_call->CreateAudioReceiveStream(AudioReceiveConfig);

    g_audioSendStream->Start();
    g_audioReceiveStream->Start();

Here's a screenshot of the error that occurred when the crash occurred. Please tell me if you want to know more.

1 个答案:

答案 0 :(得分:0)

你的代码在event_log _-&gt; LogAudioPlayout()崩溃了...... 很明显,event_log_对象已经发布了。

由unique_ptr或scoped_refptr管理的对象将在执行后释放,但这些对象仍可能在您的情况下使用,这将导致崩溃问题。所以将这些对象放在全局内存中或保留它们。