Exemple #1
0
        public void Initialize(StreamType stream)
        {
            logger.Info(stream.ToString());

            if (esStreams[(int)stream] != null)
            {
                throw new ArgumentException($"Stream {stream} already initialized");
            }

            dataSynchronizer.Initialize(stream);

            var esStream = new EsStream(stream, packetStorage, dataSynchronizer, _playerClock);

            esStream.SetPlayer(player);

            streamReconfigureSubs[(int)stream] = esStream.StreamReconfigure()
                                                 .Subscribe(async _ => await OnStreamReconfigure(), _syncCtx);
            playbackErrorSubs[(int)stream] = esStream.PlaybackError()
                                             .Subscribe(OnEsStreamError, _syncCtx);

            esStreams[(int)stream] = esStream;
        }
Exemple #2
0
        public EsStream(StreamType type, EsPlayerPacketStorage storage, Synchronizer synchronizer, PlayerClockProvider playerClock)
        {
            streamType        = type;
            packetStorage     = storage;
            _dataSynchronizer = synchronizer;
            _dataSynchronizer.Initialize(streamType);
            _playerClock = playerClock;

            switch (streamType)
            {
            case StreamType.Audio:
                PushStreamConfig = PushAudioConfig;
                break;

            case StreamType.Video:
                PushStreamConfig = PushVideoConfig;
                break;

            default:
                throw new ArgumentException($"Stream Type {streamType} is unsupported");
            }
        }
Exemple #3
0
        public EsStream(StreamType type, EsPlayerPacketStorage storage, Synchronizer synchronizer, SuspendResumeLogic suspendRedumeLogic)
        {
            streamType        = type;
            packetStorage     = storage;
            _dataSynchronizer = synchronizer;
            _dataSynchronizer.Initialize(streamType);
            _suspendResumeLogic = suspendRedumeLogic;

            switch (streamType)
            {
            case StreamType.Audio:
                PushStreamConfig = PushAudioConfig;
                break;

            case StreamType.Video:
                PushStreamConfig = PushVideoConfig;
                break;

            default:
                throw new ArgumentException($"Stream Type {streamType} is unsupported");
            }

            _firstDataPacketTcs = new TaskCompletionSource <object>();
        }