Пример #1
0
        /// <summary>
        /// Pipe connection event handler. There are two types of pipe connection events so far,
        /// provider push connection event and provider disconnection event.
        /// </summary>
        /// <param name="evt"></param>
        public void OnPipeConnectionEvent(PipeConnectionEvent evt)
        {
            switch (evt.Type)
            {
            case PipeConnectionEvent.PROVIDER_CONNECT_PUSH:
                if (evt.Provider == this && (evt.ParameterMap == null || !evt.ParameterMap.ContainsKey("record")))
                {
                    _livePipe = evt.Source as IPipe;
                }

                break;

            case PipeConnectionEvent.PROVIDER_DISCONNECT:
                if (_livePipe == evt.Source)
                {
                    _livePipe = null;
                }
                break;

            case PipeConnectionEvent.CONSUMER_CONNECT_PUSH:
                break;

            case PipeConnectionEvent.CONSUMER_DISCONNECT:
                break;

            default:
                break;
            }
        }
Пример #2
0
        public void OnPipeConnectionEvent(PipeConnectionEvent evt)
        {
            switch (evt.Type)
            {
            case PipeConnectionEvent.CONSUMER_CONNECT_PULL:
            case PipeConnectionEvent.CONSUMER_CONNECT_PUSH:
            case PipeConnectionEvent.PROVIDER_CONNECT_PULL:
            case PipeConnectionEvent.PROVIDER_CONNECT_PUSH:
                _compCounter++;
                break;

            case PipeConnectionEvent.CONSUMER_DISCONNECT:
            case PipeConnectionEvent.PROVIDER_DISCONNECT:
                _compCounter--;
                if (_compCounter <= 0)
                {
                    // XXX should we synchronize parent before removing?
                    if (HasParent)
                    {
                        IProviderService providerService = ScopeUtils.GetScopeService(this.Parent, typeof(IProviderService)) as IProviderService;
                        providerService.UnregisterBroadcastStream(Parent, Name);
                    }
                    _hasRemoved = true;
                }
                break;

            default:
                throw new NotSupportedException("Event type not supported: " + evt.Type);
            }
        }
Пример #3
0
        public void OnPipeConnectionEvent(PipeConnectionEvent evt)
        {
            switch (evt.Type)
            {
            case 0:
            case 1:
            case 3:
            case 4:
                this._compCounter++;
                break;

            case 2:
            case 5:
                this._compCounter--;
                if (this._compCounter <= 0)
                {
                    if (base.HasParent)
                    {
                        (ScopeUtils.GetScopeService(this.Parent, typeof(IProviderService)) as IProviderService).UnregisterBroadcastStream(this.Parent, this.Name);
                    }
                    this._hasRemoved = true;
                }
                break;

            default:
                throw new NotSupportedException("Event type not supported: " + evt.Type);
            }
        }
Пример #4
0
        public void OnPipeConnectionEvent(PipeConnectionEvent evt)
        {
            switch (evt.Type)
            {
            case 2:
                this.Uninit();
                break;

            case 4:
                if (evt.Consumer == this)
                {
                    IDictionary parameterMap = evt.ParameterMap;
                    if (parameterMap != null)
                    {
                        this._mode = parameterMap["mode"] as string;
                    }
                    break;
                }
                break;

            case 5:
                if (evt.Consumer != this)
                {
                }
                break;
            }
        }
Пример #5
0
        public void OnPipeConnectionEvent(PipeConnectionEvent evt)
        {
            switch (evt.Type)
            {
            case 0:
                if (this._pipe == null)
                {
                    this._pipe = evt.Source as IPipe;
                }
                break;

            case 2:
                if (this._pipe == evt.Source)
                {
                    this._pipe = null;
                    this.Uninit();
                }
                break;

            case 5:
                if (this._pipe == evt.Source)
                {
                    this.Uninit();
                }
                break;
            }
        }
Пример #6
0
        public void OnPipeConnectionEvent(PipeConnectionEvent evt)
        {
            switch (evt.Type)
            {
            case 1:
                if (((evt.Provider == this) && (evt.Source != this._connMsgOut)) && ((evt.ParameterMap == null) || !evt.ParameterMap.ContainsKey("record")))
                {
                    this._livePipe = evt.Source as IPipe;
                    foreach (IConsumer consumer in this._livePipe.GetConsumers())
                    {
                        this._subscriberStats.Increment();
                    }
                }
                break;

            case 2:
                if (this._livePipe == evt.Source)
                {
                    this._livePipe = null;
                }
                break;

            case 4:
                if (this._livePipe == evt.Source)
                {
                    this.NotifyChunkSize();
                }
                this._subscriberStats.Increment();
                break;

            case 5:
                this._subscriberStats.Decrement();
                break;
            }
        }
Пример #7
0
        public void OnPipeConnectionEvent(PipeConnectionEvent evt)
        {
            switch (evt.Type)
            {
            case PipeConnectionEvent.PROVIDER_CONNECT_PULL:
                if (_pipe == null)
                {
                    _pipe = evt.Source as IPipe;
                }
                break;

            case PipeConnectionEvent.PROVIDER_DISCONNECT:
                if (_pipe == evt.Source)
                {
                    _pipe = null;
                    Uninit();
                }
                break;

            case PipeConnectionEvent.CONSUMER_DISCONNECT:
                if (_pipe == evt.Source)
                {
                    Uninit();
                }
                break;

            default:
                break;
            }
        }
Пример #8
0
        /// <summary>
        /// Pipe connection event handler.
        /// </summary>
        /// <param name="evt">Pipe connection event.</param>
        public void OnPipeConnectionEvent(PipeConnectionEvent evt)
        {
            switch (evt.Type)
            {
            case PipeConnectionEvent.CONSUMER_CONNECT_PUSH:
                if (evt.Consumer != this)
                {
                    break;
                }
                IDictionary paramMap = evt.ParameterMap as IDictionary;
                if (paramMap != null)
                {
                    _mode = paramMap["mode"] as string;
                }
                break;

            case PipeConnectionEvent.CONSUMER_DISCONNECT:
                if (evt.Consumer == this)
                {
                }
                break;

            case PipeConnectionEvent.PROVIDER_DISCONNECT:
                // we only support one provider at a time
                // so do releasing when provider disconnects
                Uninit();
                break;

            default:
                break;
            }
        }
Пример #9
0
 public void OnPipeConnectionEvent(PipeConnectionEvent evt)
 {
     if (evt.Type == 2)
     {
         this._connection.CloseChannel(this._video.ChannelId);
         this._connection.CloseChannel(this._audio.ChannelId);
         this._connection.CloseChannel(this._data.ChannelId);
     }
 }
Пример #10
0
        public void OnPipeConnectionEvent(PipeConnectionEvent evt)
        {
            switch (evt.Type)
            {
            case PipeConnectionEvent.PROVIDER_DISCONNECT:
                // XXX should put the channel release code in ConsumerService
                _connection.CloseChannel(_video.ChannelId);
                _connection.CloseChannel(_audio.ChannelId);
                _connection.CloseChannel(_data.ChannelId);
                break;

            default:
                break;
            }
        }
Пример #11
0
 /// <summary>
 /// Pipe connection event handler. There are two types of pipe connection events so far,
 /// provider push connection event and provider disconnection event.
 /// </summary>
 /// <param name="evt"></param>
 public void OnPipeConnectionEvent(PipeConnectionEvent evt)
 {
     switch (evt.Type)
     {
         case PipeConnectionEvent.PROVIDER_CONNECT_PUSH:
             if (evt.Provider == this && (evt.ParameterMap == null || !evt.ParameterMap.ContainsKey("record")))
             {
                 _msgOut = (IMessageOutput)evt.Source;
             }
             break;
         case PipeConnectionEvent.PROVIDER_DISCONNECT:
             if (_msgOut == evt.Source)
                 _msgOut = null;
             break;
         default:
             break;
     }
 }
Пример #12
0
		/// <summary>
		/// Pipe connection event handler. There are two types of pipe connection events so far,
		/// provider push connection event and provider disconnection event.
		/// </summary>
		/// <param name="evt"></param>
		public void OnPipeConnectionEvent(PipeConnectionEvent evt) {
			switch (evt.Type) {
				case PipeConnectionEvent.PROVIDER_CONNECT_PUSH:
					if (evt.Provider == this && (evt.ParameterMap == null || !evt.ParameterMap.ContainsKey("record"))) {
						_livePipe = evt.Source as IPipe;
					}

					break;
				case PipeConnectionEvent.PROVIDER_DISCONNECT:
					if (_livePipe == evt.Source)
						_livePipe = null;
					break;
				case PipeConnectionEvent.CONSUMER_CONNECT_PUSH:
					break;
				case PipeConnectionEvent.CONSUMER_DISCONNECT:
					break;
				default:
					break;
			}
		}
Пример #13
0
        /// <summary>
        /// Pipe connection event handler.
        /// </summary>
        /// <param name="evt">Pipe connection event.</param>
        public void OnPipeConnectionEvent(PipeConnectionEvent evt)
        {
            switch (evt.Type)
            {
            case PipeConnectionEvent.PROVIDER_CONNECT_PUSH:
                if (evt.Provider == this && evt.Source != _connMsgOut && (evt.ParameterMap == null || !evt.ParameterMap.ContainsKey("record")))
                {
                    _livePipe = evt.Source as IPipe;
                    foreach (IConsumer consumer in _livePipe.GetConsumers())
                    {
                        _subscriberStats.Increment();
                    }
                }
                break;

            case PipeConnectionEvent.PROVIDER_DISCONNECT:
                if (_livePipe == evt.Source)
                {
                    _livePipe = null;
                }
                break;

            case PipeConnectionEvent.CONSUMER_CONNECT_PUSH:
                if (_livePipe == evt.Source)
                {
                    NotifyChunkSize();
                }
                _subscriberStats.Increment();
                break;

            case PipeConnectionEvent.CONSUMER_DISCONNECT:
                _subscriberStats.Decrement();
                break;

            default:
                break;
            }
        }
Пример #14
0
 public void OnPipeConnectionEvent(PipeConnectionEvent evt)
 {
     switch (evt.Type)
     {
         case PipeConnectionEvent.PROVIDER_CONNECT_PUSH:
             if (evt.Provider != this)
             {
                 if (_waiting)
                 {
                     _schedulingService.RemoveScheduledJob(_waitLiveJob);
                     _waitLiveJob = null;
                     _waiting = false;
                 }
                 SendPublishedStatus(_currentItem);
             }
             break;
         case PipeConnectionEvent.PROVIDER_DISCONNECT:
             if (_isPullMode)
             {
                 SendStopStatus(_currentItem);
             }
             else
             {
                 SendUnpublishedStatus(_currentItem);
             }
             break;
         case PipeConnectionEvent.CONSUMER_CONNECT_PULL:
             if (evt.Consumer == this)
             {
                 _isPullMode = true;
             }
             break;
         case PipeConnectionEvent.CONSUMER_CONNECT_PUSH:
             if (evt.Consumer == this)
             {
                 _isPullMode = false;
             }
             break;
         default:
             break;
     }
 }
Пример #15
0
 /// <summary>
 /// Pipe connection event handler. There are two types of pipe connection events so far,
 /// provider push connection event and provider disconnection event.
 /// </summary>
 /// <param name="evt"></param>
 public void OnPipeConnectionEvent(PipeConnectionEvent evt)
 {
     switch (evt.Type)
     {
         case PipeConnectionEvent.PROVIDER_CONNECT_PUSH:
             if (evt.Provider == this && (evt.ParameterMap == null || !evt.ParameterMap.ContainsKey("record")))
             {
                 _msgOut = (IMessageOutput)evt.Source;
             }
             break;
         case PipeConnectionEvent.PROVIDER_DISCONNECT:
             if (_msgOut == evt.Source)
                 _msgOut = null;
             break;
         default:
             break;
     }
 }
 public void OnPipeConnectionEvent(PipeConnectionEvent evt)
 {
     switch (evt.Type)
     {
         case PipeConnectionEvent.PROVIDER_DISCONNECT:
             // XXX should put the channel release code in ConsumerService
             _connection.CloseChannel(_video.ChannelId);
             _connection.CloseChannel(_audio.ChannelId);
             _connection.CloseChannel(_data.ChannelId);
             break;
         default:
             break;
     }
 }
Пример #17
0
        protected void FireProviderConnectionEvent(IProvider provider, int type, Hashtable parameterMap)
#endif
        {
		    PipeConnectionEvent evt = new PipeConnectionEvent(this);
		    evt.Provider = provider;
		    evt.Type = type;
		    evt.ParameterMap = parameterMap;
		    FirePipeConnectionEvent(evt);
	    }
Пример #18
0
 /// <summary>
 /// Fire any pipe connection event.
 /// </summary>
 /// <param name="evt">Pipe connection event.</param>
 protected void FirePipeConnectionEvent(PipeConnectionEvent evt)
 {
     foreach (IPipeConnectionListener element in _listeners)
     {
         try
         {
             element.OnPipeConnectionEvent(evt);
         }
         catch (Exception ex)
         {
             log.Error("Exception when handling pipe connection event", ex);
         }
     }
 }
Пример #19
0
        protected void FireConsumerConnectionEvent(IConsumer consumer, int type, Hashtable parameterMap) 
#endif
        {
            // Create event object
            PipeConnectionEvent evt = new PipeConnectionEvent(this);
            // Fill it up
            evt.Consumer = consumer;
		    evt.Type = type;
		    evt.ParameterMap = parameterMap;
            // Fire it
            FirePipeConnectionEvent(evt);
	    }
Пример #20
0
        public void OnPipeConnectionEvent(PipeConnectionEvent evt)
        {
            switch (evt.Type) 
            {
			    case PipeConnectionEvent.CONSUMER_CONNECT_PULL:
			    case PipeConnectionEvent.CONSUMER_CONNECT_PUSH:
			    case PipeConnectionEvent.PROVIDER_CONNECT_PULL:
			    case PipeConnectionEvent.PROVIDER_CONNECT_PUSH:
				    _compCounter++;
				break;
			    case PipeConnectionEvent.CONSUMER_DISCONNECT:
			    case PipeConnectionEvent.PROVIDER_DISCONNECT:
				    _compCounter--;
				    if (_compCounter <= 0) 
                    {
					    // XXX should we synchronize parent before removing?
					    if (HasParent)
                        {
                            IProviderService providerService = ScopeUtils.GetScopeService(this.Parent, typeof(IProviderService)) as IProviderService;
						    providerService.UnregisterBroadcastStream(Parent, Name);
					    }
					    _hasRemoved = true;
				    }
				    break;
			    default:
				    throw new NotSupportedException("Event type not supported: "+evt.Type);
		    }
        }
Пример #21
0
 /// <summary>
 /// Pipe connection event handler.
 /// </summary>
 /// <param name="evt">Pipe connection event.</param>
 public void OnPipeConnectionEvent(PipeConnectionEvent evt)
 {
     switch (evt.Type)
     {
         case PipeConnectionEvent.CONSUMER_CONNECT_PUSH:
             if (evt.Consumer != this)
             {
                 break;
             }
             IDictionary paramMap = evt.ParameterMap as IDictionary;
             if (paramMap != null)
             {
                 _mode = paramMap["mode"] as string;
             }
             break;
         case PipeConnectionEvent.CONSUMER_DISCONNECT:
             if (evt.Consumer == this)
             {
             }
             break;
         case PipeConnectionEvent.PROVIDER_DISCONNECT:
             // we only support one provider at a time
             // so do releasing when provider disconnects
             Uninit();
             break;
         default:
             break;
     }
 }
Пример #22
0
        public void OnPipeConnectionEvent(PipeConnectionEvent evt)
        {
		    switch (evt.Type) {
			    case PipeConnectionEvent.PROVIDER_CONNECT_PULL:
				    if (_pipe == null)
					    _pipe = evt.Source as IPipe;
				    break;
			    case PipeConnectionEvent.PROVIDER_DISCONNECT:
				    if (_pipe == evt.Source)
                    {
					    _pipe = null;
					    Uninit();
				    }
				    break;
			    case PipeConnectionEvent.CONSUMER_DISCONNECT:
                    if (_pipe == evt.Source)
                        Uninit();
                    break;
			    default:
				    break;
		    }
        }
Пример #23
0
 /// <summary>
 /// Pipe connection event handler.
 /// </summary>
 /// <param name="evt">Pipe connection event.</param>
 public void OnPipeConnectionEvent(PipeConnectionEvent evt)
 {
     switch (evt.Type)
     {
         case PipeConnectionEvent.PROVIDER_CONNECT_PUSH:
             if (evt.Provider == this && evt.Source != _connMsgOut && (evt.ParameterMap == null || !evt.ParameterMap.ContainsKey("record")))
             {
                 _livePipe = evt.Source as IPipe;
                 foreach (IConsumer consumer in _livePipe.GetConsumers())
                 {
                     _subscriberStats.Increment();
                 }
             }
             break;
         case PipeConnectionEvent.PROVIDER_DISCONNECT:
             if (_livePipe == evt.Source)
             {
                 _livePipe = null;
             }
             break;
         case PipeConnectionEvent.CONSUMER_CONNECT_PUSH:
             if (_livePipe == evt.Source)
             {
                 NotifyChunkSize();
             }
             _subscriberStats.Increment();
             break;
         case PipeConnectionEvent.CONSUMER_DISCONNECT:
             _subscriberStats.Decrement();
             break;
         default:
             break;
     }
 }