libeplayer3: this may improve recovery from broken streams

This commit is contained in:
martii
2013-03-03 20:55:39 +01:00
committed by Stefan Seyfried
parent dc95df1150
commit a01b70f226

View File

@@ -36,6 +36,9 @@
#include <errno.h>
#include <sys/poll.h>
#include <pthread.h>
#ifdef MARTII
#include <sys/prctl.h>
#endif
#include <libavutil/avutil.h>
#include <libavformat/avformat.h>
@@ -329,6 +332,12 @@ static char* searchMeta(AVDictionary * metadata, char* ourTag)
/* **************************** */
static void FFMPEGThread(Context_t *context) {
#ifdef MARTII
char threadname[17];
strncpy(threadname, __func__, sizeof(threadname));
threadname[16] = 0;
prctl (PR_SET_NAME, (unsigned long)&threadname);
#endif
AVPacket packet;
off_t currentReadPosition = 0; /* last read position */
off_t lastReverseSeek = 0; /* max address to read before seek again in reverse play */
@@ -1504,6 +1513,10 @@ static int container_ffmpeg_stop(Context_t *context) {
ffmpeg_err("Container not running\n");
return cERR_CONTAINER_FFMPEG_ERR;
}
#ifdef MARTII
if (context->playback)
context->playback->isPlaying = 0;
#endif
while ( (hasPlayThreadStarted != 0) && (--wait_time) > 0 ) {
ffmpeg_printf(10, "Waiting for ffmpeg thread to terminate itself, will try another %d times\n", wait_time);