提交 e27e5cfc 编写于 作者: Z Zhang Rui

ffplay: do not post error too early

上级 6cbab4f0
......@@ -2253,10 +2253,14 @@ static int read_thread(void *arg)
ffp->auto_start = 0;
// TODO: 0 it's a bit early to notify complete here
ALOGE("ffp_toggle_buffering: completed\n");
ALOGE("ffp_toggle_buffering: completed: (error=%d)\n", ffp->error);
ffp_toggle_buffering(ffp, 0);
toggle_pause(ffp, 1);
ffp_notify_msg1(ffp, FFP_MSG_COMPLETED);
if (ffp->error) {
ffp_notify_msg1(ffp, FFP_MSG_ERROR);
} else {
ffp_notify_msg1(ffp, FFP_MSG_COMPLETED);
}
}
}
}
......@@ -2275,11 +2279,12 @@ static int read_thread(void *arg)
if (ret == AVERROR_EOF || url_feof(ic->pb))
eof = 1;
if (ic->pb && ic->pb->error) {
// TODO: 9 notify error until a/v finished
last_error = ic->pb->error;
ALOGE("av_read_frame error: %d\n", ic->pb->error);
ffp_notify_msg2(ffp, FFP_MSG_ERROR, last_error);
eof = 1;
ffp->error = ic->pb->error;
ALOGE("av_read_frame error: %d\n", ffp->error);
break;
} else {
ffp->error = 0;
}
SDL_LockMutex(wait_mutex);
SDL_CondWaitTimeout(is->continue_read_thread, wait_mutex, 10);
......
......@@ -440,6 +440,8 @@ typedef struct FFPlayer {
int last_error;
int prepared;
int auto_start;
int error;
int error_count;
MessageQueue msg_queue;
......@@ -515,6 +517,8 @@ inline static void ffp_reset_internal(FFPlayer *ffp)
ffp->last_error = 0;
ffp->prepared = 0;
ffp->auto_start = 0;
ffp->error = 0;
ffp->error_count = 0;
ffp->high_water_mark_in_bytes = DEFAULT_HIGH_WATER_MARK_IN_BYTES;
ffp->max_high_water_mark_in_ms = DEFAULT_MAX_HIGH_WATER_MARK_IN_MS;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册