예제 #1
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    // TODO: Close opened channels?
                    // Assuming so for the time being, but don't know how to send stop messages yet
                    InputChannel.Dispose();
                    // InputTvRemoteChannel.Dispose();

                    TextChannel.Dispose();
                    MediaChannel.Dispose();
                    BroadcastChannel.Dispose();

                    _sessionMessageTransport.Dispose();
                    _messageTransport.Dispose();
                }
                _disposed = true;
            }
        }
예제 #2
0
 private void PersistChannelState(MediaChannel channel, List <Alert> channelAlerts)
 {
     try
     {
         channel.LastUpdate = DateTime.UtcNow;
         // _cache.Set(channel.Id, channel.ToString());
         Channel chnl = DataAccess.GetChannel(channel.Id.NimbusIdToRawGuid());
         if (chnl == null)
         {
             chnl = GetNewChannel(channel);
         }
         if (channelAlerts != null && channelAlerts.Count > 0)
         {
             DataAccess.SaveAlerts(channelAlerts, MediaService.Credentials.ClientId);
         }
     }
     catch (Exception ex)
     {
         Trace.TraceError("Error persisting channel {0}({1}) state: {2}", channel.Name, channel.Id, ex);
     }
 }
예제 #3
0
        private List <Alert> GetEncodingAlerts(MediaChannel channel, AventusTelemetry telemetry)
        {
            var alerts = new List <Alert>();
            var ticks  = DateTime.UtcNow.Ticks;

            if (telemetry != null)
            {
                channel.EncodingHealth = telemetry.ChannelHealth.HealthLevel.GetHealthStatus();
                var receivers = telemetry.Inputs.Receivers;
                // Add all the alerts from receivers.
                alerts.AddRange(receivers.SelectMany((receiver, index) =>
                {
                    string source = string.Format(
                        "Receivers[{0}], TaskIndex:{1} TaskGroupId:{2}",
                        index,
                        receiver.TaskIndex,
                        receiver.TaskGroupId);
                    return(GetAlertsFromHealth(receiver.Health, source, ref ticks));
                }));

                // Add all the alerts from decoders.
                var transcoders = telemetry.Transcoders;
                var decoders    = transcoders.VideoDecoders;
                alerts.AddRange(decoders.SelectMany((decoder, index) =>
                {
                    var source = string.Format(
                        "Decoders[{0}], TaskIndex: {1}, TaskGroupId:{2}",
                        index,
                        decoder.TaskIndex,
                        decoder.TaskGroupId);
                    var decoderAlerts = GetAlertsFromHealth(decoder.Health, source, ref ticks);
                    var encoderAlerts = decoder.VideoEncoders.SelectMany((encoder, encoderIndex) =>
                    {
                        source = string.Format(
                            "Decoders[{0}]/Encoders[{1}], TaskIndex:{2}, TaskGroupId:{3}",
                            index,
                            encoderIndex,
                            decoder.TaskIndex,
                            decoder.TaskGroupId);
                        return(GetAlertsFromHealth(decoder.Health, source, ref ticks));
                    });
                    return(decoderAlerts.Concat(encoderAlerts));
                }));

                // Add all the alerts from packagers and the publishers.
                var packagers = telemetry.Outputs.Packagers;
                alerts.AddRange(packagers.SelectMany((packager, index) =>
                {
                    var source         = string.Format("Packagers[{0}]", index);
                    var packagerAlerts = GetAlertsFromHealth(packager.Health, source, ref ticks);

                    var publishinerAlerts = packager.Publishers.SelectMany((publisher, pindex) =>
                    {
                        source = string.Format("Packager[{0}]/Publisher[{1}]", index, pindex);
                        return(GetAlertsFromHealth(publisher.Health, source, ref ticks));
                    });
                    return(packagerAlerts.Concat(publishinerAlerts));
                }));
            }
            alerts.ForEach(alert => alert.ChannelID = channel.Id);
            return(alerts);
        }