[player] Fix problem where player_playback_cb triggers after playback stop

This commit is contained in:
ejurgensen 2016-12-27 22:11:11 +01:00
parent 3e24f857fa
commit c92ebf9dfb
2 changed files with 17 additions and 2 deletions

View File

@ -236,6 +236,12 @@ input_read(struct evbuffer *evbuf, size_t want, short *flags)
*flags = 0;
if (!tid_input)
{
DPRINTF(E_LOG, L_PLAYER, "Bug! Read called, but playback not running\n");
return -1;
}
pthread_mutex_lock(&input_buffer.mutex);
#ifdef DEBUG

View File

@ -355,6 +355,15 @@ pb_timer_start(void)
struct itimerspec tick;
int ret;
ret = event_add(pb_timer_ev, NULL);
if (ret < 0)
{
DPRINTF(E_LOG, L_PLAYER, "Could not add playback timer\n");
return -1;
}
tick.it_interval = tick_interval;
tick.it_value = tick_interval;
@ -379,6 +388,8 @@ pb_timer_stop(void)
struct itimerspec tick;
int ret;
event_del(pb_timer_ev);
memset(&tick, 0, sizeof(struct itimerspec));
#ifdef HAVE_TIMERFD
@ -3245,8 +3256,6 @@ player_init(void)
goto evnew_fail;
}
event_add(pb_timer_ev, NULL);
cmdbase = commands_base_new(evbase_player, NULL);
ret = outputs_init();