/** * Stop graph execution. This is an asynchronous call; register a callback with setDoneCallback to * be notified of when the background processing has been completed. Calling stop will close the * filter graph. */ @Override public synchronized void stop() { if (mRunTask != null && !mRunTask.isCancelled()) { if (mLogVerbose) Log.v(TAG, "Stopping graph."); mRunTask.cancel(false); } }
/** Execute the graph in a background thread. */ @Override public synchronized void run() { if (mLogVerbose) Log.v(TAG, "Running graph."); setException(null); if (isRunning()) { throw new RuntimeException("Graph is already running!"); } if (mRunner == null) { throw new RuntimeException("Cannot run before a graph is set!"); } mRunTask = this.new AsyncRunnerTask(); setRunning(true); mRunTask.execute(mRunner); }