vlc_player_input_HandleState: Assertion `player->started && input->started'
I'm reaching an assertion failed:
286 test_libvlc_media_player: ../../src/player/input.c:237: vlc_player_input_HandleState: Assertion `player->started && input->started' failed.
with the following test diff:
diff --git a/test/libvlc/media_player.c b/test/libvlc/media_player.c
index c4107e86b7..e872d55e8e 100644
--- a/test/libvlc/media_player.c
+++ b/test/libvlc/media_player.c
@@ -247,6 +247,34 @@ static void test_media_player_pause_stop(const char** argv, int argc)
libvlc_release (vlc);
}
+static void test_media_player_play_and_pause_stop(const char** argv, int argc)
+{
+ libvlc_instance_t *vlc;
+ libvlc_media_t *md;
+ libvlc_media_player_t *mi;
+ const char * file = "mock://length=1000";
+
+ test_log ("Testing pause and stop of %s\n", file);
+
+ vlc = libvlc_new (argc, argv);
+ assert (vlc != NULL);
+
+ md = libvlc_media_new_location (vlc, file);
+ assert (md != NULL);
+ libvlc_media_add_option (md, "play-and-pause");
+
+ mi = libvlc_media_player_new_from_media (md);
+ assert (mi != NULL);
+
+ libvlc_media_release (md);
+
+ play_and_wait(mi);
+
+ libvlc_media_player_stop_async (mi);
+ libvlc_media_player_release (mi);
+ libvlc_release (vlc);
+}
+
struct track
{
const char *id;
@@ -702,6 +730,8 @@ int main (void)
test_media_player_set_media (test_defaults_args, test_defaults_nargs);
test_media_player_play_stop (test_defaults_args, test_defaults_nargs);
test_media_player_pause_stop (test_defaults_args, test_defaults_nargs);
+ for(int i=0; i< 1000; ++i)
+ test_media_player_play_and_pause_stop (test_defaults_args, test_defaults_nargs);
test_media_player_tracks (test_defaults_args, test_defaults_nargs);
test_media_player_programs (test_defaults_args, test_defaults_nargs);
test_media_player_multiple_instance (test_defaults_args, test_defaults_nargs);
Backtrace:
Thread 64 "test_libvlc_med" received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff14f9640 (LWP 165126)]
0x00007ffff58e134c in __pthread_kill_implementation () from /usr/lib/libc.so.6
(gdb) bt
#0 0x00007ffff58e134c in __pthread_kill_implementation () from /usr/lib/libc.so.6
#1 0x00007ffff58944b8 in raise () from /usr/lib/libc.so.6
#2 0x00007ffff587e534 in abort () from /usr/lib/libc.so.6
#3 0x00007ffff587e45c in __assert_fail_base.cold () from /usr/lib/libc.so.6
#4 0x00007ffff588d116 in __assert_fail () from /usr/lib/libc.so.6
#5 0x00007ffff6c063bc in vlc_player_input_HandleState (input=0x616000045380, state=<optimized out>, state_date=6720606039) at ../../src/player/input.c:237
#6 0x00007ffff6c0e03f in vlc_player_input_HandleStateEvent (state_date=6720606039, state=<optimized out>, input=<optimized out>) at ../../src/player/input.c:272
#7 input_thread_Events (input_thread=<optimized out>, event=0x7ffff14f8030, user_data=<optimized out>) at ../../src/player/input.c:767
#8 0x00007ffff6bb30c6 in input_SendEvent (event=0x7ffff14f8030, p_input=0x61e000021080) at ../../src/input/event.h:35
#9 input_SendEventState (state_date=<optimized out>, i_state=3, p_input=0x61e000021080) at ../../src/input/event.h:138
#10 input_ChangeState (state_date=<optimized out>, i_state=3, p_input=0x61e000021080) at ../../src/input/input.c:3222
#11 ControlPause (p_input=0x61e000021080, i_control_date=<optimized out>) at ../../src/input/input.c:1667
#12 0x00007ffff6bc725b in Control (p_input=<optimized out>, i_type=<optimized out>, param=...) at ../../src/input/input.c:2031
#13 0x00007ffff6bcdf69 in MainLoop (p_input=0x61e000021080, b_interactive=<optimized out>) at ../../src/input/input.c:674
#14 0x00007ffff6bd43e1 in Run (data=0x61e000021080) at ../../src/input/input.c:434
#15 0x00007ffff58df5c2 in start_thread () from /usr/lib/libc.so.6
#16 0x00007ffff5964584 in clone () from /usr/lib/libc.so.6
(gdb) thread apply all bt
Thread 64 (Thread 0x7ffff14f9640 (LWP 165126) "test_libvlc_med"):
#0 0x00007ffff58e134c in __pthread_kill_implementation () from /usr/lib/libc.so.6
#1 0x00007ffff58944b8 in raise () from /usr/lib/libc.so.6
#2 0x00007ffff587e534 in abort () from /usr/lib/libc.so.6
#3 0x00007ffff587e45c in __assert_fail_base.cold () from /usr/lib/libc.so.6
#4 0x00007ffff588d116 in __assert_fail () from /usr/lib/libc.so.6
#5 0x00007ffff6c063bc in vlc_player_input_HandleState (input=0x616000045380, state=<optimized out>, state_date=6720606039) at ../../src/player/input.c:237
#6 0x00007ffff6c0e03f in vlc_player_input_HandleStateEvent (state_date=6720606039, state=<optimized out>, input=<optimized out>) at ../../src/player/input.c:272
#7 input_thread_Events (input_thread=<optimized out>, event=0x7ffff14f8030, user_data=<optimized out>) at ../../src/player/input.c:767
#8 0x00007ffff6bb30c6 in input_SendEvent (event=0x7ffff14f8030, p_input=0x61e000021080) at ../../src/input/event.h:35
#9 input_SendEventState (state_date=<optimized out>, i_state=3, p_input=0x61e000021080) at ../../src/input/event.h:138
#10 input_ChangeState (state_date=<optimized out>, i_state=3, p_input=0x61e000021080) at ../../src/input/input.c:3222
#11 ControlPause (p_input=0x61e000021080, i_control_date=<optimized out>) at ../../src/input/input.c:1667
#12 0x00007ffff6bc725b in Control (p_input=<optimized out>, i_type=<optimized out>, param=...) at ../../src/input/input.c:2031
#13 0x00007ffff6bcdf69 in MainLoop (p_input=0x61e000021080, b_interactive=<optimized out>) at ../../src/input/input.c:674
#14 0x00007ffff6bd43e1 in Run (data=0x61e000021080) at ../../src/input/input.c:434
#15 0x00007ffff58df5c2 in start_thread () from /usr/lib/libc.so.6
#16 0x00007ffff5964584 in clone () from /usr/lib/libc.so.6
Thread 63 (Thread 0x7ffff15fa640 (LWP 165125) "test_libvlc_med"):
#0 0x00007ffff595da9d in syscall () from /usr/lib/libc.so.6
#1 0x00007ffff6de7016 in sys_futex (val3=-1, addr2=0x0, to=0x0, val=2, op=137, addr=0x61700001f898) at ../../src/linux/thread.c:76
#2 vlc_futex_wait (flags=0, to=0x0, val=2, addr=addr@entry=0x61700001f898) at ../../src/linux/thread.c:87
#3 vlc_atomic_wait (addr=addr@entry=0x61700001f898, val=val@entry=2) at ../../src/linux/thread.c:103
#4 0x00007ffff6d7bfff in vlc_mutex_lock (mtx=0x61700001f898) at ../../src/misc/threads.c:119
#5 vlc_mutex_lock (mtx=0x61700001f898) at ../../src/misc/threads.c:105
#6 0x00007ffff6d7ce60 in vlc_cond_wait_finish (mutex=0x61700001f898, cond=<optimized out>, waiter=<optimized out>) at ../../src/misc/threads.c:287
#7 vlc_cond_wait (cond=cond@entry=0x61700001f9b8, mutex=mutex@entry=0x61700001f898) at ../../src/misc/threads.c:299
#8 0x00007ffff6bec7a2 in vlc_player_destructor_Thread (data=<optimized out>) at ../../src/player/player.c:214
#9 0x00007ffff58df5c2 in start_thread () from /usr/lib/libc.so.6
#10 0x00007ffff5964584 in clone () from /usr/lib/libc.so.6
Thread 62 (Thread 0x7ffff16fb640 (LWP 165124) "test_libvlc_med"):
#0 0x00007ffff595da9d in syscall () from /usr/lib/libc.so.6
#1 0x00007ffff6de7016 in sys_futex (val3=-1, addr2=0x0, to=0x0, val=0, op=137, addr=0x7ffff16fabf0) at ../../src/linux/thread.c:76
#2 vlc_futex_wait (flags=0, to=0x0, val=0, addr=addr@entry=0x7ffff16fabf0) at ../../src/linux/thread.c:87
#3 vlc_atomic_wait (addr=addr@entry=0x7ffff16fabf0, val=val@entry=0) at ../../src/linux/thread.c:103
#4 0x00007ffff6d7cd72 in vlc_cond_wait (cond=<optimized out>, mutex=mutex@entry=0x60c000057ac0) at ../../src/misc/threads.c:298
#5 0x00007ffff6d4b945 in QueueTake (executor=0x60c000057ac0) at ../../src/misc/executor.c:98
#6 ThreadRun (userdata=0x60400036b190) at ../../src/misc/executor.c:126
#7 0x00007ffff58df5c2 in start_thread () from /usr/lib/libc.so.6
#8 0x00007ffff5964584 in clone () from /usr/lib/libc.so.6
Thread 61 (Thread 0x7ffff17fc640 (LWP 165123) "test_libvlc_med"):
#0 0x00007ffff595da9d in syscall () from /usr/lib/libc.so.6
--Type <RET> for more, q to quit, c to continue without paging--c
#1 0x00007ffff6de7016 in sys_futex (val3=-1, addr2=0x0, to=0x0, val=0, op=137, addr=0x7ffff17fbbf0) at ../../src/linux/thread.c:76
#2 vlc_futex_wait (flags=0, to=0x0, val=0, addr=addr@entry=0x7ffff17fbbf0) at ../../src/linux/thread.c:87
#3 vlc_atomic_wait (addr=addr@entry=0x7ffff17fbbf0, val=val@entry=0) at ../../src/linux/thread.c:103
#4 0x00007ffff6d7cd72 in vlc_cond_wait (cond=<optimized out>, mutex=mutex@entry=0x60c000057a00) at ../../src/misc/threads.c:298
#5 0x00007ffff6d4b945 in QueueTake (executor=0x60c000057a00) at ../../src/misc/executor.c:98
#6 ThreadRun (userdata=0x60400036b150) at ../../src/misc/executor.c:126
#7 0x00007ffff58df5c2 in start_thread () from /usr/lib/libc.so.6
#8 0x00007ffff5964584 in clone () from /usr/lib/libc.so.6
Thread 60 (Thread 0x7ffff18fd640 (LWP 165122) "test_libvlc_med"):
#0 0x00007ffff595da9d in syscall () from /usr/lib/libc.so.6
#1 0x00007ffff6de7016 in sys_futex (val3=-1, addr2=0x0, to=0x0, val=0, op=137, addr=0x7ffff18fcbf0) at ../../src/linux/thread.c:76
#2 vlc_futex_wait (flags=0, to=0x0, val=0, addr=addr@entry=0x7ffff18fcbf0) at ../../src/linux/thread.c:87
#3 vlc_atomic_wait (addr=addr@entry=0x7ffff18fcbf0, val=val@entry=0) at ../../src/linux/thread.c:103
#4 0x00007ffff6d7cd72 in vlc_cond_wait (cond=<optimized out>, mutex=mutex@entry=0x60c000057940) at ../../src/misc/threads.c:298
#5 0x00007ffff6d4b945 in QueueTake (executor=0x60c000057940) at ../../src/misc/executor.c:98
#6 ThreadRun (userdata=0x60400036b110) at ../../src/misc/executor.c:126
#7 0x00007ffff58df5c2 in start_thread () from /usr/lib/libc.so.6
#8 0x00007ffff5964584 in clone () from /usr/lib/libc.so.6
Thread 59 (Thread 0x7ffff19fe640 (LWP 165121) "test_libvlc_med"):
#0 0x00007ffff595da9d in syscall () from /usr/lib/libc.so.6
#1 0x00007ffff6de7016 in sys_futex (val3=-1, addr2=0x0, to=0x0, val=0, op=137, addr=0x7ffff19fdbf0) at ../../src/linux/thread.c:76
#2 vlc_futex_wait (flags=0, to=0x0, val=0, addr=addr@entry=0x7ffff19fdbf0) at ../../src/linux/thread.c:87
#3 vlc_atomic_wait (addr=addr@entry=0x7ffff19fdbf0, val=val@entry=0) at ../../src/linux/thread.c:103
#4 0x00007ffff6d7cd72 in vlc_cond_wait (cond=<optimized out>, mutex=mutex@entry=0x60c000057880) at ../../src/misc/threads.c:298
#5 0x00007ffff6d4b945 in QueueTake (executor=0x60c000057880) at ../../src/misc/executor.c:98
#6 ThreadRun (userdata=0x60400036b0d0) at ../../src/misc/executor.c:126
#7 0x00007ffff58df5c2 in start_thread () from /usr/lib/libc.so.6
#8 0x00007ffff5964584 in clone () from /usr/lib/libc.so.6
Thread 58 (Thread 0x7ffff1aff640 (LWP 165120) "test_libvlc_med"):
#0 0x00007ffff595da9d in syscall () from /usr/lib/libc.so.6
#1 0x00007ffff6de7016 in sys_futex (val3=-1, addr2=0x0, to=0x0, val=0, op=137, addr=0x7ffff1afebf0) at ../../src/linux/thread.c:76
#2 vlc_futex_wait (flags=0, to=0x0, val=0, addr=addr@entry=0x7ffff1afebf0) at ../../src/linux/thread.c:87
#3 vlc_atomic_wait (addr=addr@entry=0x7ffff1afebf0, val=val@entry=0) at ../../src/linux/thread.c:103
#4 0x00007ffff6d7cd72 in vlc_cond_wait (cond=<optimized out>, mutex=mutex@entry=0x60c0000577c0) at ../../src/misc/threads.c:298
#5 0x00007ffff6d4b945 in QueueTake (executor=0x60c0000577c0) at ../../src/misc/executor.c:98
#6 ThreadRun (userdata=0x60400036b090) at ../../src/misc/executor.c:126
#7 0x00007ffff58df5c2 in start_thread () from /usr/lib/libc.so.6
#8 0x00007ffff5964584 in clone () from /usr/lib/libc.so.6
Thread 1 (Thread 0x7ffff52b48c0 (LWP 165059) "test_libvlc_med"):
#0 0x00007ffff58dc15a in __futex_abstimed_wait_common () from /usr/lib/libc.so.6
#1 0x00007ffff58e10e4 in __pthread_clockjoin_ex () from /usr/lib/libc.so.6
#2 0x00007ffff6deb4c8 in vlc_join (th=..., result=result@entry=0x0) at ../../src/posix/thread.c:197
#3 0x00007ffff6bfb5cc in vlc_player_Delete (player=0x61700001f880) at ../../src/player/player.c:1892
#4 0x00007ffff750145a in libvlc_media_player_destroy (p_mi=0x60b0019da940) at ../../lib/media_player.c:809
#5 libvlc_media_player_release (p_mi=p_mi@entry=0x60b0019da940) at ../../lib/media_player.c:832
#6 0x000055555555ef3a in test_media_player_play_and_pause_stop (argv=0x55555556d440 <test_defaults_args>, argc=4) at ../../test/libvlc/media_player.c:274
#7 main () at ../../test/libvlc/media_player.c:734
It seems that the SET_STATE pause is racing against the stop() change.