StopTranscoder() private method

private StopTranscoder ( ) : int
return int
Exemplo n.º 1
0
        public void Start()
        {
            AmountOfTimeEncodedAndSegmented = 0;
            if (PropertyChanged != null)
            {
                var e = new PropertyChangedEventArgs("PercentageComplete");
                PropertyChanged(this, e);
            }

            processThread = new Thread(delegate()
            {
                Thread t = null, t2 = null;

                try
                {
                    string namedPipe = string.Format("namedp://{0}.ts", ProcessId);
                    this.EncodingOptions.OutputFile = namedPipe;
                    this.SegmentOptions.InputFile   = namedPipe;

                    t = new Thread(GenerateHlsStreamThread);
                    t.IsBackground = true;
                    t.Start();

                    t2              = new Thread(SegmentHlsStreamThread);
                    t2.Priority     = ThreadPriority.AboveNormal;
                    t2.IsBackground = true;
                    t2.Start();
                    t2.Join();
                }
                catch (ThreadAbortException)
                {
                    try
                    {
                        InteropHelper.StopTranscoder();
                    }
                    catch { }

                    if (t != null)
                    {
                        try { t.Abort(); }
                        catch { }
                    }

                    if (t2 != null)
                    {
                        try { t2.Abort(); }
                        catch { }
                    }

                    t  = null;
                    t2 = null;
                }
            });

            processThread.IsBackground = true;
            processThread.Start();
        }
Exemplo n.º 2
0
        private void GenerateHlsStream()
        {
            var options = EncodingProcess.Current.EncodingOptions;

            try
            {
                InteropHelper.StopTranscoder();
                InteropHelper.Transcode(options.ToStringArray());
            }
            catch (ThreadAbortException)
            {
                InteropHelper.StopTranscoder();
            }
        }