versatica / mediasoup-broadcaster-demo

mediasoup broadcaster demo (libmediasoupclient)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

webrtc library needs to be build with tests

copiltembel opened this issue · comments

I guess because of the usage of "webrtc::FakePeriodicVideoTrackSource", the webrtc library needs to be build including tests. This is described here, but not specifically noted in this project, which cannot be build without it.

Please report which version of branch you are using. Anyway I think that webrtc::FakePeriodicVideoTrackSource is just used by libmediasoupclient tests, which do not need to be built (there is a build option to not compile them).

@jmillan ?

I'm using v3

I think this project needs the webrtc::FakePeriodicVideoTrackSource

In CMakeLists.txt:

Create a library with required webrtc extra code and link against it.

file(GLOB_RECURSE WEBRTC_EXTRAS
${LIBWEBRTC_BINARY_PATH}/pc/pc_test_utils/fake_audio_capture_module.o
${LIBWEBRTC_BINARY_PATH}/rtc_base/task_queue_for_test/task_queue_for_test.o
${LIBWEBRTC_BINARY_PATH}/media/rtc_media_tests_utils/fake_frame_source.o
)

set(WEBRTC_EXTRA_OBJS ${WEBRTC_EXTRAS})

add_library (webrtc_extras STATIC ${WEBRTC_EXTRA_OBJS})
set_target_properties(webrtc_extras PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries (${PROJECT_NAME} PUBLIC webrtc_extras)

That should be moved to the CMakelist in test folder, right @jmillan?

Note that v3 branch is work in progress yet.

Also in src/MediaStreamTrackFactory.cpp:

// Video track creation.
rtc::scoped_refptrwebrtc::VideoTrackInterface createVideoTrack(const std::string& label)
{
if (!factory)
createFactory();

auto video_track_source = new rtc::RefCountedObjectwebrtc::FakePeriodicVideoTrackSource(
false /* remote */);

return factory->CreateVideoTrack(
rtc::CreateRandomUuid(), video_track_source);
}

Note that v3 branch is work in progress yet.

Ah, OK, forgot about it.

That should be moved to the CMakelist in test folder, right @jmillan?

It is in test CMakelists.txt indeed

I guess because of the usage of "webrtc::FakePeriodicVideoTrackSource", the webrtc library needs to be build including tests. This is described here, but not specifically noted in this project, which cannot be build without it.

Yes, I'm about to add such info know. Thanks for commenting.

Done here

Thanks for reporting!

Done where?

NOTE 2: When building libwebrtc, you need to include rtc_include_tests=true into arguments given to gn gen.

Ok, so here the question. Do we need that or not? I mean: libwebrtc does NOT need libwebrtc to be built with rtc_include_tests=true, right? libmediasoupclient just need that to build its own tests, is this ok? If so, I suggest not building libmediasoup client tests by default, but just with the build option explicitly set to true and, if so, clarify in the docs that libwebrtc must be built with rtc_enable_tests=true.

rtc_include_tests=true is needed:

  • in order to run libmediasoupclient tests.
  • in order to run mediasoup-broadcaster-demo. (which is this project, where this issue is opened)

Done where?

The only missing thing was documenting the need to build libwebrtc with such flag in order to use this demo project.

The only missing thing was documenting the need to build libwebrtc with such flag in order to use this demo project.

Or to run libmediasoup tests.

Or to run libmediasoup tests.

Yes, that's documented in libmediasoup docs already.

My suggestion would be to just copy the fake video/audio producers' code from the libwebrtc and paste them into this project. Then you don't need the libwebrtc build with tests (which - at least for me - it's a real challenge); then you can also simplify your CMakeLists.txt.
Your call.

PRs are welcome :-)