Exemplo n.º 1
0
        public void OnAppendPacket(Packet packet)
        {
            if (packet.StreamType != streamType)
            {
                throw new ArgumentException("packet type doesn't match");
            }

            if (config == null)
            {
                throw new InvalidOperationException("Packet stream is not configured");
            }

            if (packet is EncryptedPacket)
            {
                var encryptedPacket = (EncryptedPacket)packet;

                // Increment reference counter on DRM session
                drmSession.Share();

                encryptedPacket.DrmSession = drmSession;
            }

            codecExtraDataHandler.OnAppendPacket(packet);

            player.AppendPacket(packet);
        }
Exemplo n.º 2
0
        public void OnDRMFound(DRMInitData data)
        {
            Logger.Info($"{streamType}");

            if (!forceDrmChange && drmSession != null)
            {
                return;
            }

            IDrmSession newSession = drmManager.CreateDRMSession(data);

            // Do not reset wait for DRM event. If there is no valid session
            // do not want to append new data
            //
            if (newSession == null)
            {
                return;
            }

            Logger.Info($"{streamType}: New DRM session found");
            forceDrmChange = false;

            // Decrement use counter for packet stream on old DRM Session
            drmSession?.Release();

            // Add reference count for new session
            newSession.Share();

            // Set new session as current & let data submitters run wild.
            // There is no need to store sessions. They live in player queue
            drmSession = newSession;
        }