[vlc-devel] commit: jvlc tests: avoid a libvlc_media_player race condition ( Filippo Carone )
Pierre d'Herbemont
pdherbemont at free.fr
Sun Jul 20 12:07:52 CEST 2008
On Jul 20, 2008, at 11:25 AM, git version control wrote:
> vlc | branch: master | Filippo Carone <littlejohn at videolan.org> |
> Sun Jul 20 11:24:33 2008 +0200|
> [b1f976cd8a843b72efb13e8deb9571b18244b982]
>
> jvlc tests: avoid a libvlc_media_player race condition
>
>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b1f976cd8a843b72efb13e8deb9571b18244b982
> ---
>
> ...nstanceTest.java => LibVlcMediaPlayerTest.java} | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/bindings/java/core/src/test/java/org/videolan/jvlc/
> internal/LibVlcMediaInstanceTest.java b/bindings/java/core/src/test/
> java/org/videolan/jvlc/internal/LibVlcMediaPlayerTest.java
> similarity index 97%
> rename from bindings/java/core/src/test/java/org/videolan/jvlc/
> internal/LibVlcMediaInstanceTest.java
> rename to bindings/java/core/src/test/java/org/videolan/jvlc/
> internal/LibVlcMediaPlayerTest.java
> index 3b97110..e421e23 100644
> --- a/bindings/java/core/src/test/java/org/videolan/jvlc/internal/
> LibVlcMediaInstanceTest.java
> +++ b/bindings/java/core/src/test/java/org/videolan/jvlc/internal/
> LibVlcMediaPlayerTest.java
> @@ -35,7 +35,7 @@ import
> org.videolan.jvlc.internal.LibVlc.LibVlcMediaInstance;
> import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
>
>
> -public class LibVlcMediaInstanceTest
> +public class LibVlcMediaPlayerTest
> {
>
> private LibVlc libvlc = LibVlc.SYNC_INSTANCE;
> @@ -127,11 +127,12 @@ public class LibVlcMediaInstanceTest
> }
>
> @Test
> - public void mediaInstanceStop2()
> + public void mediaInstanceStop2() throws Exception
> {
> LibVlcMediaDescriptor md =
> libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
> LibVlcMediaInstance mi =
> libvlc.libvlc_media_player_new_from_media(md, exception);
> libvlc.libvlc_media_player_play(mi, exception);
> + Thread.sleep(100);
You should poll here, waiting for a correct state
/* Wait a correct state */
libvlc_state_t state;
do {
state = libvlc_media_player_get_state (mi, &ex);
msleep(10000);
catch ();
} while( state != libvlc_Playing &&
state != libvlc_Error &&
state != libvlc_MediaPlayerEndReached );
assert( state == libvlc_Playing || state ==
libvlc_MediaPlayerEndReached );
Pierre.
More information about the vlc-devel
mailing list