[Live-devel] hi all, I found a bug in mediaServer source code.
ken chow
kenchow.cn at gmail.com
Mon Dec 8 03:04:12 PST 2014
sorry, I don't know how to report a bug in a proper way, but I saw the only
one mailing list can communicate with authors. here is the thing.
>From my client PLAY request like this:
<pre>
PLAY rtsp://
192.168.1.201:556/20141208-064059100-Talon0001-192.168.1.201-Cam0.avi
RTSP/1.0
Authorization: Digest username="admin", realm="LIVE555 Streaming Media",
nonce="fc0667548cd2dff1882b8a9550854fad", uri="/rtsp://
192.168.1.201:556/20141208-064059100-Talon0001-192.168.1.201-Cam0.avi",
response="b203600cffa9ec487011edc4a92b1ce5"
CSeq: 6
User-Agent: ORCI RTSP Client 1.0
Rate-Control: yes
Range: clock=20141208T064100.000Z-
Session: 81A6879B
</pre>
I met the problem that is *Range* field, my client didn't fill end time,
which means playing from 20141208T064100.000Z to end of file.
This is implementing in file: RTSPCommon.cpp line: 248 code:
<pre>
} else if (sscanf(paramStr, "clock = %n", &numCharsMatched3) == 0 &&
numCharsMatched3 > 0) {
rangeStart = rangeEnd = 0.0;
char const* utcTimes = ¶mStr[numCharsMatched3];
size_t len = strlen(utcTimes) + 1;
char* as = new char[len];
char* ae = new char[len];
int sscanfResult = sscanf(utcTimes, "%[^-]-%s", as, ae);
/*********************line248*********************************/
if (sscanfResult == 2) {
absStartTime = as;
absEndTime = ae;
} else if (sscanfResult == 1) {
absStartTime = as;
delete[] ae;
} else {
delete[] as; delete[] ae;
return False;
}
} else if (sscanf(paramStr, "smtpe = %n", &numCharsMatched4) == 0 &&
numCharsMatched4 > 0) {
</pre>
If the range like the above that I'v offered, the sscanf(utcTimes,
"%[^-]-%s", as, ae) will have a problem.
Another thing:
file: RTSPServer.cpp line: 2002 code:
<pre>
for (i = 0; i < fNumStreamStates; ++i) {
if (subsession == NULL /* means: aggregated operation */ ||
fNumStreamStates == 1) {
if (fStreamStates[i].subsession != NULL) {
if (sawScaleHeader) {
fStreamStates[i].subsession->setStreamScale(fOurSessionId,
fStreamStates[i].streamToken, scale);
}
if (absStart != NULL) { /******************line
2002***************************************************/
// Special case handling for seeking by 'absolute' time:
fStreamStates[i].subsession->seekStream(fOurSessionId,
fStreamStates[i].streamToken, absStart, absEnd);
} else {
// Seeking by relative (NPT) time:
u_int64_t numBytes;
if (!sawRangeHeader || startTimeIsNow) {
// We're resuming streaming without seeking, so we just do a 'null' seek
// (to get our NPT, and to specify when to end streaming):
fStreamStates[i].subsession->nullSeekStream(fOurSessionId,
fStreamStates[i].streamToken,
rangeEnd, numBytes);
} else {
// We do a real 'seek':
double streamDuration = 0.0; // by default; means: stream until the end
of the media
if (rangeEnd > 0.0 && (rangeEnd+0.001) < duration) {
// the 0.001 is because we limited the values to 3 decimal places
// We want the stream to end early. Set the duration we want:
streamDuration = rangeEnd - rangeStart;
if (streamDuration < 0.0) streamDuration = -streamDuration;
// should happen only if scale < 0.0
}
fStreamStates[i].subsession->seekStream(fOurSessionId,
fStreamStates[i].streamToken,
rangeStart, streamDuration, numBytes);
}
}
</pre>
That if condition should have included NULL != absEnd.
Then, my client works well with mediaServer, Please see the attachment that
I modified two files, if the modifying inappropriate, I wish someone would
tell me.
Thank you.
<http://about.me/kenchowcn>
Ken Chow
about.me/kenchowcn
[image: Ken Chow on about.me]
<http://about.me/kenchowcn>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20141208/77f59243/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RTSPServer.cpp
Type: text/x-c++src
Size: 97227 bytes
Desc: not available
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20141208/77f59243/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RTSPCommon.cpp
Type: text/x-c++src
Size: 13483 bytes
Desc: not available
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20141208/77f59243/attachment-0003.bin>
More information about the live-devel
mailing list