[rtmpdump] [PATCH] Allow rtmpsrv to respect live streams
NhJm
nhjm449 at gmail.com
Sat Jun 2 02:28:52 CEST 2012
Why was duplicate if (r->Link.extras.o_num){...} code added?
Plus, checking if an application name contains 'live' is *not* an okay way
to check if a stream is live.
On Fri, Jun 1, 2012 at 6:41 PM, Steven Penny <svnpenn at gmail.com> wrote:
> Currently rtmpsrv does not add the "--live" parameter even when reading a
> live
> stream. This ultimately causes rtmpdump to fail. Current workarounds
> involve
> adding "--live" to the printed command and re-running rtmpdump. I pulled
> this
> code from KSV repo
>
> http://github.com/K-S-V/Scripts/downloads
>
> Change has been tested to work with
>
> http://www.ar.aljazeerasport.tv
>
> but any live stream should also be affected.
> ---
> rtmpsrv.c | 42 ++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 42 insertions(+), 0 deletions(-)
>
> diff --git a/rtmpsrv.c b/rtmpsrv.c
> index 9aa62f3..13d3e94 100644
> --- a/rtmpsrv.c
> +++ b/rtmpsrv.c
> @@ -96,6 +96,7 @@ STREAMING_SERVER *rtmpServer = 0; // server
> structure pointer
> STREAMING_SERVER *startStreaming(const char *address, int port);
> void stopStreaming(STREAMING_SERVER * server);
> void AVreplace(AVal *src, const AVal *orig, const AVal *repl);
> +AVal AVcopy(AVal src);
>
> static const AVal av_dquote = AVC("\"");
> static const AVal av_escdquote = AVC("\\\"");
> @@ -599,6 +600,17 @@ ServeInvoke(STREAMING_SERVER *server, RTMP * r,
> RTMPPacket *packet, unsigned int
> if (obj.o_num > 5)
> r->Link.length = AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 5));
> */
> + double StartFlag = 0;
> + AMFObjectProperty *Start = AMF_GetProp(&obj, NULL, 4);
> + if (!(Start->p_type == AMF_INVALID))
> + StartFlag = AMFProp_GetNumber(Start);
> + r->Link.app = AVcopy(r->Link.app);
> + if (StartFlag == -1000 || (r->Link.app.av_val &&
> strstr(r->Link.app.av_val, "live")))
> + {
> + StartFlag = -1000;
> + server->arglen += 7;
> + server->argc += 1;
> + }
> if (r->Link.tcUrl.av_len)
> {
> len = server->arglen + r->Link.playpath.av_len + 4 +
> @@ -666,6 +678,17 @@ ServeInvoke(STREAMING_SERVER *server, RTMP * r,
> RTMPPacket *packet, unsigned int
> ptr = dumpAMF(&r->Link.extras, ptr, argv, &argc);
> AMF_Reset(&r->Link.extras);
> }
> + if (StartFlag == -1000)
> + {
> + argv[argc].av_val = ptr + 1;
> + argv[argc++].av_len = 6;
> + ptr += sprintf(ptr, " --live");
> + }
> + if (r->Link.extras.o_num)
> + {
> + ptr = dumpAMF(&r->Link.extras, ptr, argv, &argc);
> + AMF_Reset(&r->Link.extras);
> + }
> argv[argc].av_val = ptr + 1;
> argv[argc++].av_len = 2;
> argv[argc].av_val = ptr + 5;
> @@ -1178,3 +1201,22 @@ AVreplace(AVal *src, const AVal *orig, const AVal
> *repl)
> src->av_val = dest;
> src->av_len = dptr - dest;
> }
> +
> +AVal
> +AVcopy(AVal src)
> +{
> + AVal dst;
> + if (src.av_len)
> + {
> + dst.av_val = malloc(src.av_len + 1);
> + memcpy(dst.av_val, src.av_val, src.av_len);
> + dst.av_val[src.av_len] = '\0';
> + dst.av_len = src.av_len;
> + }
> + else
> + {
> + dst.av_val = NULL;
> + dst.av_len = 0;
> + }
> + return dst;
> +}
> --
> 1.7.9
>
> _______________________________________________
> rtmpdump mailing list
> rtmpdump at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/rtmpdump
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mplayerhq.hu/pipermail/rtmpdump/attachments/20120601/ada168c6/attachment.html>
More information about the rtmpdump
mailing list