Esempio n. 1
0
 /// <param name="track"> Audio track to play </param>
 /// <param name="configuration"> Configuration for audio processing </param>
 /// <param name="remoteNodeManager"> Manager of remote nodes </param>
 /// <param name="volumeLevel"> Mutable volume level </param>
 public RemoteAudioTrackExecutor(AudioTrack track, AudioConfiguration configuration, RemoteNodeManager remoteNodeManager, AtomicInteger volumeLevel)
 {
     this.track             = track;
     this.configuration     = configuration.copy();
     this.remoteNodeManager = remoteNodeManager;
     this.volumeLevel       = volumeLevel;
     this.executorId        = nanoTime();
     this.frameBuffer       = new AudioFrameBuffer(BUFFER_DURATION_MS, configuration.OutputFormat, null);
 }
Esempio n. 2
0
        /// <summary>
        /// Create a new instance
        /// </summary>
        //JAVA TO C# CONVERTER WARNING: The following constructor is declared outside of its associated class:
        //ORIGINAL LINE: public DefaultAudioPlayerManager()
        public DefaultAudioPlayerManager()
        {
            sourceManagers = new List <>();

            // Executors
            trackPlaybackExecutorService = new ThreadPoolExecutor(1, int.MaxValue, 10, TimeUnit.SECONDS, new SynchronousQueue(), new DaemonThreadFactory("playback"));
            trackInfoExecutorService     = ExecutorTools.createEagerlyScalingExecutor(1, DEFAULT_LOADER_POOL_SIZE, TimeUnit.SECONDS.toMillis(30), LOADER_QUEUE_CAPACITY, new DaemonThreadFactory("info-loader"));
            scheduledExecutorService     = Executors.newScheduledThreadPool(1, new DaemonThreadFactory("manager"));
            orderedInfoExecutor          = new OrderedExecutor(trackInfoExecutorService);

            // Configuration
            trackStuckThreshold = TimeUnit.MILLISECONDS.toNanos(10000);
            configuration       = new AudioConfiguration();
            cleanupThreshold    = new AtomicLong(DEFAULT_CLEANUP_THRESHOLD);
            frameBufferDuration = DEFAULT_FRAME_BUFFER_DURATION;
            useSeekGhosting     = true;
            outputHookFactory   = null;

            // Additional services
            remoteNodeManager        = new RemoteNodeManager(this);
            garbageCollectionMonitor = new GarbageCollectionMonitor(scheduledExecutorService);
            lifecycleManager         = new AudioPlayerLifecycleManager(scheduledExecutorService, cleanupThreshold);
            lifecycleManager.initialise();
        }