changeset 11240:e5476af3577b

8214808: Better framerate computation Reviewed-by: kcr, rhalade
author almatvee
date Wed, 09 Jan 2019 12:33:31 -0800
parents 48a61e3593de
children f8b8ead4ac56
files modules/javafx.media/src/main/java/com/sun/media/jfxmedia/MediaPlayer.java modules/javafx.media/src/main/java/com/sun/media/jfxmediaimpl/NativeMediaPlayer.java modules/javafx.media/src/main/java/com/sun/media/jfxmediaimpl/platform/gstreamer/GSTPlatform.java modules/javafx.media/src/main/native/gstreamer/gstreamer-lite/gst-plugins-good/gst/isomp4/qtdemux.c
diffstat 4 files changed, 33 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/modules/javafx.media/src/main/java/com/sun/media/jfxmedia/MediaPlayer.java	Fri Dec 21 15:30:42 2018 -0800
+++ b/modules/javafx.media/src/main/java/com/sun/media/jfxmedia/MediaPlayer.java	Wed Jan 09 12:33:31 2019 -0800
@@ -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();
 }
--- a/modules/javafx.media/src/main/java/com/sun/media/jfxmediaimpl/NativeMediaPlayer.java	Fri Dec 21 15:30:42 2018 -0800
+++ b/modules/javafx.media/src/main/java/com/sun/media/jfxmediaimpl/NativeMediaPlayer.java	Wed Jan 09 12:33:31 2019 -0800
@@ -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
--- a/modules/javafx.media/src/main/java/com/sun/media/jfxmediaimpl/platform/gstreamer/GSTPlatform.java	Fri Dec 21 15:30:42 2018 -0800
+++ b/modules/javafx.media/src/main/java/com/sun/media/jfxmediaimpl/platform/gstreamer/GSTPlatform.java	Wed Jan 09 12:33:31 2019 -0800
@@ -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();
                 }
 
--- a/modules/javafx.media/src/main/native/gstreamer/gstreamer-lite/gst-plugins-good/gst/isomp4/qtdemux.c	Fri Dec 21 15:30:42 2018 -0800
+++ b/modules/javafx.media/src/main/native/gstreamer/gstreamer-lite/gst-plugins-good/gst/isomp4/qtdemux.c	Wed Jan 09 12:33:31 2019 -0800
@@ -9944,6 +9944,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);