/// <summary> /// Adds a stream to the server. If the server is already started then the stream will also be started /// </summary> /// <param name="location">The uri of the stream</param> public bool TryAddMedia(IMedia stream) { Exception any = null; try { //Try to add the stream to the dictionary of contained streams. bool result = Common.Collections.DictionaryExtensions.TryAdd(m_MediaStreams, stream.Id, stream, out any); if (result && IsRunning) stream.Start(); return result; } catch { //Possibly already added. //If we are listening start the stram if (IsRunning && ContainsMedia(stream.Id)) { stream.Start(); return true; } return false; } finally { //if (stream != null) stream.TrySetLogger(Logger); if (Logger != null && any != null) Logger.LogException(any); } }