< prev index next >

modules/media/src/main/native/jfxmedia/platform/osx/avf/AVFKernelProcessor.h

Print this page
rev 9506 : 8156563: JavaFX Ensemble8 media sample hang and crash
Reviewed-by: almatvee, kcr

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -24,10 +24,12 @@
  */
 
 #ifndef __JFXMedia__AVFKernelProcessor__
 #define __JFXMedia__AVFKernelProcessor__
 
+#include <memory>
+
 #include "AUEffectBase.h"
 
 
 /*
  * Instead of writing N components that all basically function the same (at the

@@ -78,10 +80,18 @@
 protected:
     AUEffectBase *mAudioUnit;
 };
 
 /*
- * Returns an instance of our common AudioUnit set up to use the given kernel
+ * Shared pointer that handles deleting the kernel when it's no longer in use.
+ * Please use this instead of raw pointers.
+ */
+
+typedef std::shared_ptr<AVFKernelProcessor> AVFKernelProcessorPtr;
+
+/*
+ * Returns an instance of our common AudioUnit set up to use the given kernel.
+ * Use static_pointer_cast<AVFKernelProcessor>(kernelPtr) when passing a subclass
  */
-extern AudioUnit NewKernelProcessorUnit(AVFKernelProcessor *kernel);
+AudioUnit NewKernelProcessorUnit(AVFKernelProcessorPtr kernel);
 
 #endif /* defined(__JFXMedia__AVFKernelProcessor__) */
< prev index next >