@Override public void close() { if (tracks != null) { for (int i = 0; i < tracks.length; ++i) { if (tracks[i] != null) { tracks[i].deallocate(); tracks[i] = null; } } tracks = null; } super.close(); }
// @Override @Override public void open() throws ResourceUnavailableException { try { // source.connect(); // TODO: assume source is already connected source.start(); // TODO: stop/disconnect on stop/close. final PullSourceStream[] streams = source.getStreams(); tracks = new PullSourceStreamTrack[streams.length]; for (int i = 0; i < streams.length; ++i) { tracks[i] = new VideoTrack(streams[i]); } } catch (IOException e) { logger.log(Level.WARNING, "" + e, e); throw new ResourceUnavailableException("" + e); } super.open(); }