# HG changeset patch # User kcr # Date 1555360564 25200 # Mon Apr 15 13:36:04 2019 -0700 # Node ID 9e0b53f93aac3bb074600a3471cfa9811864a9f7 # Parent aace3d5129630aa8994dbd8addcbe035fb1bc2fb imported patch 13.patch diff --git a/modules/javafx.media/src/main/java/com/sun/media/jfxmedia/MediaPlayer.java b/modules/javafx.media/src/main/java/com/sun/media/jfxmedia/MediaPlayer.java --- a/modules/javafx.media/src/main/java/com/sun/media/jfxmedia/MediaPlayer.java +++ b/modules/javafx.media/src/main/java/com/sun/media/jfxmedia/MediaPlayer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -349,4 +349,8 @@ * after this method is invoked. */ public void dispose(); + /** + * Returns true if we have cached error event. + */ + public boolean isErrorEventCached(); } diff --git a/modules/javafx.media/src/main/java/com/sun/media/jfxmediaimpl/NativeMediaPlayer.java b/modules/javafx.media/src/main/java/com/sun/media/jfxmediaimpl/NativeMediaPlayer.java --- a/modules/javafx.media/src/main/java/com/sun/media/jfxmediaimpl/NativeMediaPlayer.java +++ b/modules/javafx.media/src/main/java/com/sun/media/jfxmediaimpl/NativeMediaPlayer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1411,6 +1411,17 @@ } } + @Override + public boolean isErrorEventCached() { + synchronized (cachedErrorEvents) { + if (cachedErrorEvents.isEmpty()) { + return false; + } else { + return true; + } + } + } + //************************************************************************** //***** Non-JNI methods called by the native layer. These methods are called //***** from the native layer via the invocation API. Their purpose is to diff --git a/modules/javafx.media/src/main/java/com/sun/media/jfxmediaimpl/platform/gstreamer/GSTPlatform.java b/modules/javafx.media/src/main/java/com/sun/media/jfxmediaimpl/platform/gstreamer/GSTPlatform.java --- a/modules/javafx.media/src/main/java/com/sun/media/jfxmediaimpl/platform/gstreamer/GSTPlatform.java +++ b/modules/javafx.media/src/main/java/com/sun/media/jfxmediaimpl/platform/gstreamer/GSTPlatform.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -151,6 +151,13 @@ // Ignore it. } + // Check if error event was set. We will not go to READY or + // HALT state in this case. Error event is basically same + // as HALT. + if (player.isErrorEventCached()) { + break; + } + state = player.getState(); } diff --git a/modules/javafx.media/src/main/native/gstreamer/gstreamer-lite/gst-plugins-good/gst/isomp4/qtdemux.c b/modules/javafx.media/src/main/native/gstreamer/gstreamer-lite/gst-plugins-good/gst/isomp4/qtdemux.c --- a/modules/javafx.media/src/main/native/gstreamer/gstreamer-lite/gst-plugins-good/gst/isomp4/qtdemux.c +++ b/modules/javafx.media/src/main/native/gstreamer/gstreamer-lite/gst-plugins-good/gst/isomp4/qtdemux.c @@ -9948,6 +9948,14 @@ stream->stsd_entries_length = stsd_entry_count = QT_UINT32 (stsd_data + 12); stream->stsd_entries = g_new0 (QtDemuxStreamStsdEntry, stsd_entry_count); +#ifdef GSTREAMER_LITE + // Even if we check stsd header length (stsd_len) to make sure we have at least + // one entry, we still might have actual entry count set to 0. g_new0() will + // return NULL if fail or count is 0. + if (stream->stsd_entries == NULL) { + goto corrupt_file; + } +#endif // GSTREAMER_LITE GST_LOG_OBJECT (qtdemux, "stsd len: %d", stsd_len); GST_LOG_OBJECT (qtdemux, "stsd entry count: %u", stsd_entry_count);