[Live-devel] bug: ntohl() portability, and eof check of bytesRead2 in RTSPClient::describeURL()

Anon Sricharoenchai anon.hui at gmail.com
Tue Jun 30 05:50:01 PDT 2009


Hi,

I've found some bugs as described below.

== ntohl() portability ==

To be fully portable, all the line like,

   ntohl(*(unsigned*)(bPacket->data()))

in the file liveMedia/MultiFramedRTPSource.cpp, should use uint32_t,
rather than unsigned,

   ntohl(*(uint32_t*)(bPacket->data()))

This also apply to all ntohl() appearing in liveMedia/RTCP.cpp and
liveMedia/MPEG1or2VideoRTPSource.cpp.

Also note that,  the prototype of ntohl() is,

   uint32_t ntohl(uint32_t);


== indefinite loop when socket reach eof ==

In function, RTSPClient::describeURL(), the line,

   if (bytesRead2 < 0) break;

should rather be,

   if (bytesRead2 <= 0) break;

Else, it will loop indefinitely, when the socket reach eof state at this point.

This same line or problem seem to also appear in function
RTSPClient::getMediaSessionParameter().


More information about the live-devel mailing list