[FFmpeg-trac] #3127(undetermined:new): Video stream publishing via RTMPT
FFmpeg
trac at avcodec.org
Thu Nov 14 07:30:46 CET 2013
#3127: Video stream publishing via RTMPT
-------------------------------------+-------------------------------------
Reporter: goodvinj | Owner:
Type: defect | Status: new
Priority: important | Component:
Version: git-master | undetermined
Keywords: | Resolution:
Blocking: | Blocked By:
Analyzed by developer: 0 | Reproduced by developer: 0
-------------------------------------+-------------------------------------
Comment (by goodvinj):
I've found the reason of hangs in "avio_open":
"rtmp_http_open" tries to read server reply with unique id and calls
"ffurl_read".
It expects that "ffurl_read" returns AVERROR_EOF on completion, but
"ffurl_read" returns 0.
It's because "ffurl_read" calls "retry_transfer_wrapper" which calls
"http_read" (as transfer_func).
"http_read" returns AVERROR_EOF, but there is the code:
{{{
} else if (ret < 1)
return (ret < 0 && ret != AVERROR_EOF) ? ret : len;
}}}
so "retry_transfer_wrapper" returns len==0 instead of AVERROR_EOF, and
"ffurl_read" returns 0.
Then "rtmp_http_open" calls "ffurl_read" and so on.
I'd fixed this by the following code in "rtmp_http_open":
{{{
for (;;) {
ret = ffurl_read(rt->stream, rt->client_id + off,
sizeof(rt->client_id) - off);
if (ret == 0 || ret == AVERROR_EOF)
break;
if (ret < 0)
goto fail;
off += ret;
if (off == sizeof(rt->client_id)) {
ret = AVERROR(EIO);
goto fail;
}
}
}}}
Next issue occurs in "rtmp_handshake" (it hangs too).
On handshake "rtmp_http_read" is called, "rtmp_http_read" calls
"ffurl_read" and expects AVERROR_EOF on completion. But "ffurl_read"
returns 0 again, so we get an infinite loop there.
I'd changed "rtmp_http_read":
{{{
do {
ret = ffurl_read(rt->stream, buf + off, size);
if (ret < 0 && ret != AVERROR_EOF)
return ret;
if (ret == 0 || ret == AVERROR_EOF) {
if (rt->finishing) {
}}}
----
After these changes I'd reverted all my changes and changed only these
lines in "retry_transfer_wrapper":
{{{
} else if (ret < 1)
return (ret < 0 && ret != AVERROR_EOF) ? ret : len;
}}}
to
{{{
} else if (ret < 1)
return (ret < 0) ? ret : len;
}}}
Now FFMPEG sends video over RTMPT (without librtmp support).
--
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/3127#comment:3>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list