Esempio n. 1
0
        public override bool RemoveCapability(ICapability capability)
        {
            bool ret = base.RemoveCapability(capability);

            if (ret)
            {
                if (fgm != null)
                {
                    fgm.Stop();
                    FilterGraph.RemoveFromRot(rotID);
                    FilterGraph.RemoveAllFilters(fgm);
                    fgm = null;
                }

                if (fgmEventMonitor != null)
                {
                    fgmEventMonitor.FgmEvent -= new FgmEventMonitor.FgmEventHandler(FgmEvent);
                    fgmEventMonitor.Dispose();
                    fgmEventMonitor = null;
                }

                wmf = null;
            }

            return(ret);
        }
        private void DisposeFgm()
        {
            lock (fgmLock)
            {
                if (fgm != null)
                {
                    // We need to manually unblock the stream in case there is no data flowing
                    if (rtpStream != null)
                    {
                        rtpStream.UnblockNextFrame();
                    }

                    FilterGraph.RemoveFromRot(rotID);
                    fgm.Stop();
                    FilterGraph.RemoveAllFilters(fgm);
                    fgm = null;
                    iBA = null;
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Remove all filters from a graph. If the graph is running, we will stop it first.
        /// </summary>
        /// <returns></returns>
        public bool Teardown()
        {
            if (fgm == null)
            {
                playing = false;
                return(true);
            }


            if (playing)
            {
                try
                {
                    //If stream is paused Stop will hang unless we first call
                    //RtpStream.UnblockNextFrame
                    if (this.stream != null)
                    {
                        this.stream.UnblockNextFrame();
                    }

                    if (rotnum != 0)
                    {
                        FilterGraph.RemoveFromRot((uint)rotnum);                         //RemoveFromRot(rotnum);
                    }
                    fgm.Stop();
                }
                catch (Exception e)
                {
                    Debug.WriteLine("Failed to stop graph: " + e.ToString());
                }
                playing = false;
            }

            FilterGraph.RemoveAllFilters(fgm);
            fgm = null;
            return(true);
        }