コード例 #1
0
        public void Unload(string streamKey)
        {
            var streamSection = GetStreamSection(streamKey);

            if (streamSection == null)
            {
                return;
            }

            AudioStreamHelper.Pause(streamSection.AudioStream);

            lock (_audioStreamEvents)
            {
                _audioStreamEvents.RemoveAll(x => x.StreamKey == streamKey);
            }

            lock (streamSection)
            {
                foreach (var sync in streamSection.AudioSections.SelectMany(section => section.AudioSyncs))
                {
                    RemoveSyncFromStream(streamSection.AudioStream, sync);
                }
            }

            lock (streamSection.AudioStream)
            {
                foreach (var sync in streamSection.AudioStream.AudioSyncs)
                {
                    RemoveSyncFromStream(streamSection.AudioStream, sync);
                }
                streamSection.AudioStream.AudioSyncs.Clear();
            }

            AudioStreamHelper.RemoveFromMixer(streamSection.AudioStream, Output);
            AudioStreamHelper.UnloadAudio(streamSection.AudioStream);

            streamSection.AudioStream.SyncProc = null;

            lock (_streamSections)
            {
                _streamSections.Remove(streamSection);
            }
        }