[FFmpeg-devel] [PATCH] rtmpproto: Don't mistake app for playpath.

Michael Niedermayer michaelni at gmx.at
Sun Oct 19 16:40:00 CEST 2014


On Sun, Oct 19, 2014 at 02:12:14PM +0200, Kacper Michajłow wrote:
> App is always first in the url path. This commit fixes the case when URL is
> provides as "rtmp://server[:port]/app" and playpath is declared in
> AVOption.
> 
> Signed-off-by: Kacper Michajłow <kasper93 at gmail.com>
> ---
>  libavformat/rtmpproto.c | 33 +++++++++++++++++++--------------
>  1 file changed, 19 insertions(+), 14 deletions(-)
> 
> diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
> index 286e9e8..36dbfcf 100644
> --- a/libavformat/rtmpproto.c
> +++ b/libavformat/rtmpproto.c
> @@ -2594,7 +2594,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
>  {
>      RTMPContext *rt = s->priv_data;
>      char proto[8], hostname[256], path[1024], auth[100], *fname;
> -    char *old_app, *qmark, fname_buffer[1024];
> +    char *old_app, *qmark, *n, fname_buffer[1024];
>      uint8_t buf[2048];
>      int port;
>      AVDictionary *opts = NULL;
> @@ -2609,11 +2609,13 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
>                   hostname, sizeof(hostname), &port,
>                   path, sizeof(path), s->filename);
>
> -    if (strchr(path, ' ')) {
> +    n = strchr(path, ' ');
> +    if (n) {
>          av_log(s, AV_LOG_WARNING,
>                 "Detected librtmp style URL parameters, these aren't supported "
>                 "by the libavformat internal RTMP handler currently enabled. "
>                 "See the documentation for the correct way to pass parameters.\n");
> +        *n = '\0'; // Trim not supported part
>      }
>
>      if (auth[0]) {
> @@ -2712,8 +2714,8 @@ reconnect:
>          char *next = *path ? path + 1 : path;
>          char *p = strchr(next, '/');
>          if (!p) {
> -            fname = next;
> -            rt->app[0] = '\0';
> +            fname = NULL;
> +            av_strlcpy(rt->app, next, APP_MAX_LENGTH);
>          } else {
>              // make sure we do not mismatch a playpath for an application instance
>              char *c = strchr(p + 1, ':');

this breaks urls like:
-rtmp_app myapp -rtmp_live 0 -i rtmp://11.22.33.44/foo


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

DNS cache poisoning attacks, popular search engine, Google internet authority
dont be evil, please
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141019/bc0d44b8/attachment.asc>


More information about the ffmpeg-devel mailing list