#endif
#define APP_MAX_LENGTH 1024
-#define PLAYPATH_MAX_LENGTH 512
#define TCURL_MAX_LENGTH 1024
#define FLASHVER_MAX_LENGTH 64
#define RTMP_PKTDATA_DEFAULT_SIZE 4096
next += size + 3 + 4;
}
if (p != rt->flv_data + rt->flv_size) {
- av_log(NULL, AV_LOG_WARNING, "Incomplete flv packets in "
+ av_log(rt, AV_LOG_WARNING, "Incomplete flv packets in "
"RTMP_PT_METADATA packet\n");
rt->flv_size = p - rt->flv_data;
}
}
if (!rt->playpath) {
- rt->playpath = av_malloc(PLAYPATH_MAX_LENGTH);
+ int max_len = 1;
+ if (fname)
+ max_len = strlen(fname) + 5; // add prefix "mp4:"
+ rt->playpath = av_malloc(max_len);
if (!rt->playpath) {
ret = AVERROR(ENOMEM);
goto fail;
fname[len - 4] = '\0';
rt->playpath[0] = 0;
}
- av_strlcat(rt->playpath, fname, PLAYPATH_MAX_LENGTH);
+ av_strlcat(rt->playpath, fname, max_len);
} else {
rt->playpath[0] = '\0';
}
return 0;
fail:
+ av_freep(&rt->playpath);
+ av_freep(&rt->tcurl);
+ av_freep(&rt->flashver);
av_dict_free(opts);
rtmp_close(s);
return ret;