<div dir="ltr">HI Ross,<div><br><div>Thank you so much for your time, yes, I test the example testH264VideoStreaming single routine, it is work fine on my arm platform, they can parse the right URL according to my host ip, and the client can receive stream from the server,</div><div><br></div><div>the problem only came out when I mix compiled with C code, same rtspserver initialization setup step is called from my main C code, I did not change anything with <span style="font-size:12.8000001907349px">RTSPServer::createNew(), and using the default 8554 as the port, </span></div><div><span style="font-size:12.8000001907349px">I printed out  protNumHostOrder right wasy after it assigned from "ntohs()" in rtspURLPrefix() function, </span></div><div><span style="font-size:12.8000001907349px">"printf(  "***** %hu****\n", portNumHostOrder,)"</span></div><div><span style="font-size:12.8000001907349px">and it return 8554, that is mean the port is parsed correctly.</span></div><div><span style="font-size:12.8000001907349px">next I printed the "urlBuffer" after assigning by "sprintf(urlBuffer, "rtsp://%s:%hu/", AddressString(ourAddress).val(), portNumHostOrder)" , it return </span><span style="font-size:12.8000001907349px"> "rtsp://******:20552".</span></div><div><span style="font-size:12.8000001907349px">that's mean this error only happened when "sprintf", 20552 </span>is octonary format of 8554,  so same problem with AddressString, my host ip is 10.0.4.1, it was return 12.0.4.1, "AddressString()" function also using sprintf to return the network order ip</div><div><br></div><div>so I have no idea on this, the compile environment seems all the same, I am still trying to figure out if anything is wrong in my way mixing compiled the routine.</div><div><br></div><div>XINGJUN</div>







<div class="gmail_extra"><br><div class="gmail_quote">On Sat, Mar 28, 2015 at 1:39 PM, Ross Finlayson <span dir="ltr"><<a href="mailto:finlayson@live555.com" target="_blank">finlayson@live555.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><blockquote type="cite"><div>I cross compiled the dynamic library of live555 for ARM linux first, and then mixed compiled the modified example “testH264VideoStreaming.cpp” </div></blockquote><div><br></div>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.</div><div><br></div><div><br></div><div><span class=""><blockquote type="cite"><div><div dir="ltr"><div>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. </div></div></div></blockquote><div><br></div></span>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 “<a>rtsp://“</a> URL.</div><div><br></div><div>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.</div><div><br></div><div>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).</div><span class="HOEnZb"><font color="#888888"><br><br><div>
<span style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Ross Finlayson<br>Live Networks, Inc.<br><a href="http://www.live555.com/" target="_blank">http://www.live555.com/</a></span></span>
</div><div><br></div>
<br></font></span></div><br>_______________________________________________<br>
live-devel mailing list<br>
<a href="mailto:live-devel@lists.live555.com">live-devel@lists.live555.com</a><br>
<a href="http://lists.live555.com/mailman/listinfo/live-devel" target="_blank">http://lists.live555.com/mailman/listinfo/live-devel</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Xingjun Chen<br><br></div>
</div></div></div>