Exemplo n.º 1
0
        private void getVideoStreamsPacket(VideoDataParam videoDataParam)
        {
            VideoStreamsPacket packet = _download?.GetVideoStreamsPacket(videoDataParam.Time);

            if (packet != null)
            {
                send(ParamCode.VideoPacket, VideoStreamsPacket.Encode(packet));
            }
            else
            {
                send(ParamCode.VideoPacket, new byte[0]);
            }
        }
Exemplo n.º 2
0
        private byte[] getVideoPacketBuffer(VideoDataParam param)
        {
            VideoStreamsPacket packet = StorageDownloader.Instance.GetVideoPacket(param.VideoId, param.StreamId, param.Time);

            if (packet != null)
            {
                return(VideoStreamsPacket.Encode(packet));
            }
            else
            {
                return(new byte[0]);
            }
        }
Exemplo n.º 3
0
        public void TestVideoStreamsPacket_Encode()
        {
            VideoStreamsPacket vp = newVideoStreamsPacket();

            byte[]             buffer   = VideoStreamsPacket.Encode(vp);
            VideoStreamsPacket decodeVp = VideoStreamsPacket.Decode(buffer);

            Assert.AreEqual(ti.BeginTime, decodeVp.TimePeriod.BeginTime);
            Assert.AreEqual(ti.EndTime, decodeVp.TimePeriod.EndTime);
            Assert.AreEqual(sps.Count, vp.VideoStreams.Length);
            for (int i = 0; i < sps.Count; i++)
            {
                Assert.AreEqual(sps[i].Time, vp.VideoStreams[i].Time);
                Assert.AreEqual(sps[i].Type, vp.VideoStreams[i].Type);
                Assert.AreEqual(sps[i].Buffer.Length, vp.VideoStreams[i].Buffer.Length);
            }
        }