ultravideo / uvgRTP

An open-source library for RTP/SRTP media delivery
BSD 2-Clause "Simplified" License
296 stars 84 forks source link

Building in Visual Studio 14 fails #181

Closed ingura closed 1 year ago

ingura commented 1 year ago

Hi ,

I have an issue: Cmake generates the x64 project files without a complaint. When moving to build on VS 14 here is the result:

6>  srtcp.cc
6>  wrapper_c.cc
6>  Generating Code...
8>------ Build started: Project: ALL_BUILD, Configuration: Debug x64 ------
8>  Building Custom Rule D:/workBench/TestsLibs/_Fresh/Streaming/uvgRTP-master/CMakeLists.txt
9>------ Skipped Build: Project: INSTALL, Configuration: Debug x64 ------
9>Project not selected to build for this solution configuration 
10>------ Skipped Build: Project: PACKAGE, Configuration: Debug x64 ------
10>Project not selected to build for this solution configuration 
========== Build: 7 succeeded, 1 failed, 0 up-to-date, 2 skipped ==========

Specifically there are 4 error preventing uvgrtp project from building: image

What could be the issue here? Thank you

jrsnen commented 1 year ago

Hi,

The problems seem to be caused by the old VS version that doesn't support all features used in uvgRTP. I guess these could be fixed since there are not too many of them. The first two are just initializer lists that have to be written open, but I'm not immediately sure what the solution for the last two, some sort cast I guess. Could you test how to fix the last two since I don't have vs 2015 immediately available? You can also do a PR.

BR, Joni

ingura commented 1 year ago

Thank you

ingura commented 1 year ago

Yes VS 14 needs a little bit of hand holding. For anyone else having the same issue replace:

list { ssrc, ourItems } with chunk as follows:

uvgrtp::frame::rtcp_sdes_chunk chunk = uvgrtp::frame::rtcp_sdes_chunk();
chunk.ssrc = ssrc_;
chunk.items = ourItems_;
...
!construct_sdes_chunk(frame, write_ptr, chunk)

The later 2 issues are const void * casting issues that get resolved by replacing

inet_ntop(AF_INET, &addr.sin_addr, c_string, INET_ADDRSTRLEN)

with

const void* voidPinAddr;
voidPinAddr = &addr.sin_addr;
PVOID pvoidInAddr = const_cast<PVOID>(voidPinAddr);
inet_ntop(AF_INET, pvoidInAddr, c_string, INET_ADDRSTRLEN);
jrsnen commented 1 year ago

Thanks! I also added these fixes to the master. Can you verify that ce3aa62b3f4c79181b67234cd74b195f9fff2a3f compiles?

ingura commented 1 year ago

Yes, thank you!

jrsnen commented 1 year ago

Thanks!