[Live-devel] RTSP URL is error when cross compiled and mixed with C for arm platform

Ross Finlayson finlayson at live555.com
Sat Mar 28 13:39:37 PDT 2015


> I cross compiled the dynamic library of live555 for ARM linux first, and then mixed compiled the modified example “testH264VideoStreaming.cpp”

You should first verify that the *unmodified* “testH264VideoStreamer” (sic) application code works OK for you.  Then, and only then, should you modify the supplied code.


> The only problem is that the URL is wrong, so I tracked back to the live555 library, and in the RTSPServer.cpp, in the function rtspURLPrefix(), the address in urlBuffer is wrong when using sprintf, the portNumHostOrder is defined as unsigned short, then %hu is right, but when urlBuffer is printed out, 8554 is printed out as 20552, it seems the output is in its octonary format, do have one have this problem similar with. Thank you. 

The library code is correct.  Note that port numbers are stored (in the “Port” class; see “groupsock/include/NetAddress.hh”) in network byte order.  That’s why the implementation of "RTSPServer::rtspURLPrefix()” calls “ntohs()” on the port number before putting it into a “rtsp://“ URL.

Therefore - assuming that the “ntohs()” (etc.) functions are working correctly on your system - the problem must be in the way that you are giving your RTSP server its port number.  Note that the code for “testH264VideoStreamer” (and other applications that create RTSP servers) call “RTSPServer::createNew()”, passing the port number parameter as an integer in host order (e.g., 554 or 8554).  You should do the same in your application.

You’ll note, however, that “RTSPServer::createNew()” actually takes a “Port” object as parameter.  If you instead give it an integer as parameter (as all of the application examples do), then this integer will be automatically converted to a “Port” object.  This is done using the “Port()” constructor that’s defined in “groupsock/include/NetAddress.hh”, line 96 (and implemented (in “groupsock/NetAddress.cpp”) by calling “htons()” on the integer parameter, before storing it (in network byte order).


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20150329/2380d65c/attachment.html>


More information about the live-devel mailing list