summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-06-12 20:44:57 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-06-12 20:44:57 +0200
commitdc1c79be1bfc76839b1fd277a55e6baad4379498 (patch)
treed2c7f66e872b9bcb1b0816a31ba5b13deecd7e8b
parent2a622c2369e399907297465b14328b2389bb524c (diff)
parent65a80ee1ec854dc4e5d090fa5b2be9afeae312d3 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: avfilter: Log an error if avfilter fails to configure a link. avconv: support only native pthreads. rtmp: Fix a possible access to invalid memory location when the playpath is too short. Conflicts: ffmpeg.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--ffmpeg.c20
-rw-r--r--libavfilter/avfilter.c12
-rw-r--r--libavformat/rtmpproto.c4
3 files changed, 19 insertions, 17 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index e7db67a93d..6baf070d86 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -86,14 +86,8 @@
#include <conio.h>
#endif
-#if HAVE_THREADS
#if HAVE_PTHREADS
#include <pthread.h>
-#else
-//#include "libavcodec/w32pthreads.h"
-#undef HAVE_THREADS
-#define HAVE_THREADS 0
-#endif
#endif
#include <time.h>
@@ -181,7 +175,7 @@ static int print_stats = 1;
static int debug_ts = 0;
static int current_time;
-#if HAVE_THREADS
+#if HAVE_PTHREADS
/* signal to input threads that they should exit; set by the main thread */
static int transcoding_finished;
#endif
@@ -271,7 +265,7 @@ typedef struct InputFile {
from ctx.nb_streams if new streams appear during av_read_frame() */
int rate_emu;
-#if HAVE_THREADS
+#if HAVE_PTHREADS
pthread_t thread; /* thread reading from this file */
int finished; /* the thread has exited */
int joined; /* the thread has been joined */
@@ -3334,7 +3328,7 @@ static int check_keyboard_interaction(int64_t cur_time)
return 0;
}
-#if HAVE_THREADS
+#if HAVE_PTHREADS
static void *input_thread(void *arg)
{
InputFile *f = arg;
@@ -3446,7 +3440,7 @@ static int get_input_packet_mt(InputFile *f, AVPacket *pkt)
static int get_input_packet(InputFile *f, AVPacket *pkt)
{
-#if HAVE_THREADS
+#if HAVE_PTHREADS
if (nb_input_files > 1)
return get_input_packet_mt(f, pkt);
#endif
@@ -3479,7 +3473,7 @@ static int transcode(void)
timer_start = av_gettime();
-#if HAVE_THREADS
+#if HAVE_PTHREADS
if ((ret = init_input_threads()) < 0)
goto fail;
#endif
@@ -3629,7 +3623,7 @@ static int transcode(void)
/* dump report by using the output first video and audio streams */
print_report(0, timer_start, cur_time);
}
-#if HAVE_THREADS
+#if HAVE_PTHREADS
free_input_threads();
#endif
@@ -3676,7 +3670,7 @@ static int transcode(void)
fail:
av_freep(&no_packet);
-#if HAVE_THREADS
+#if HAVE_PTHREADS
free_input_threads();
#endif
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index f8fc483bd9..65ad457384 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -231,8 +231,12 @@ int avfilter_config_links(AVFilterContext *filter)
"callbacks on all outputs\n");
return AVERROR(EINVAL);
}
- } else if ((ret = config_link(link)) < 0)
+ } else if ((ret = config_link(link)) < 0) {
+ av_log(link->src, AV_LOG_ERROR,
+ "Failed to configure output pad on %s\n",
+ link->src->name);
return ret;
+ }
switch (link->type) {
case AVMEDIA_TYPE_VIDEO:
@@ -277,8 +281,12 @@ int avfilter_config_links(AVFilterContext *filter)
}
if ((config_link = link->dstpad->config_props))
- if ((ret = config_link(link)) < 0)
+ if ((ret = config_link(link)) < 0) {
+ av_log(link->src, AV_LOG_ERROR,
+ "Failed to configure input pad on %s\n",
+ link->dst->name);
return ret;
+ }
link->init_state = AVLINK_INIT;
}
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 6e53e9e4a9..5ac6151e4a 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -1141,11 +1141,11 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
goto fail;
}
- if (!strchr(fname, ':') &&
+ if (!strchr(fname, ':') && len >= 4 &&
(!strcmp(fname + len - 4, ".f4v") ||
!strcmp(fname + len - 4, ".mp4"))) {
memcpy(rt->playpath, "mp4:", 5);
- } else if (!strcmp(fname + len - 4, ".flv")) {
+ } else if (len >= 4 && !strcmp(fname + len - 4, ".flv")) {
fname[len - 4] = '\0';
} else {
rt->playpath[0] = 0;