#WebRTC task_queue crashes on PostTask

1 messages · Page 1 of 1 (latest)

deep quartz
#

hello i am trying to use WebRTC task_queue on a 32 bit application
i built the webrtc.lib using this commands

gn gen out/Release --args="is_debug=false is_component_build=false target_cpu=\"x86\" enable_crashpad=false rtc_include_tests=false is_clang=true rtc_enable_sctp=false use_custom_libcxx=false rtc_libvpx_build_vp9=false rtc_use_h264=false use_lld=false use_rtti=true visual_studio_version=\"2022\""

and here is my code

#include <iostream>
#include <thread>
#include <chrono>

#include "api/task_queue/default_task_queue_factory.h"
#include "api/task_queue/task_queue_factory.h"


int main() {
    // 1. ENABLE THREAD AFFINITY (THE MISSING PIECE)

    // 2. Factory
    auto factory = webrtc::CreateDefaultTaskQueueFactory(nullptr);

    // 3. Queue
    auto queue = factory->CreateTaskQueue("zre", webrtc::TaskQueueFactory::Priority::NORMAL);

    // 4. Post tasks
    queue->PostTask([] {
        std::cout << "Hello world!";
        });

    queue->PostDelayedTask([] {
       std::cout << "Future!";
        }, webrtc::TimeDelta::Seconds(2));

    std::this_thread::sleep_for(std::chrono::seconds(5));

    int im;
    std::cin >> im;
    return 0;
}

when i run this app i got this crash and i am confused what might have triggered this error

The thread 9124 has exited with code 0 (0x0).
Exception thrown at 0x00F5F94B in neteqTest.exe: 0xC0000005: Access violation executing location 0x00F5F94B.
worthy pulsarBOT
#

When your question is answered use !solved or the button below to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.