public Common.SegmentStream GetSample(Container.Track track, out TimeSpan duration) { Rtp.RtpFrame result = new Rtp.RtpFrame(0); while (HasNext) { Rtp.RtpPacket next = new Rtp.RtpPacket(ReadNext().Data.ToArray(), 0); if (result.Count > 0 && next.Timestamp != result.Timestamp) { break; } result.Add(next); if (next.Marker) { break; } } duration = TimeSpan.FromMilliseconds(90 * result.Count); //return result.Assemble().ToArray(); result.Depacketize(); return(result.Buffer); }
/// <summary> /// Creates a new JpegFrame from an existing RtpFrame which has the JpegFrame PayloadType /// </summary> /// <param name="f">The existing frame</param> public RFC2435Frame(Rtp.RtpFrame f) : base(f) { if (PayloadTypeByte != RFC2435Frame.RtpJpegPayloadType) { throw new ArgumentException("Expected the payload type 26, Found type: " + f.PayloadTypeByte); } }
public virtual void Depacketize(Rtp.RtpFrame rtpFrame) { DisposeBuffer(); this.Buffer = new MemoryStream(); //Get all packets in the frame foreach (Rtp.RtpPacket packet in rtpFrame) { ProcessPacket(packet); } //Order by DON? this.Buffer.Position = 0; }
public RFC3640Frame(Rtp.RtpFrame existing) : base(existing) { }
public RFC5577Frame(Rtp.RtpFrame existing) : base(existing) { }
public RFC5404Frame(Rtp.RtpFrame existing) : base(existing) { }
public RFC4629Frame(Rtp.RtpFrame existing) : base(existing) { }
public RFC6416Frame(Rtp.RtpFrame existing) : base(existing) { }
public RFC2190Frame(Rtp.RtpFrame existing) : base(existing) { }
/// <summary> /// Add a frame of existing packetized data /// </summary> /// <param name="frame">The frame with packets to send</param> public void AddFrame(Rtp.RtpFrame frame) { try { m_Frames.Enqueue(frame); } catch { throw; } }
public RFC6184Frame(Rtp.RtpFrame existing) : base(existing) { m_ContainedNalTypes = new List <byte>(); }
public RFC6184Frame(Rtp.RtpFrame existing) : base(existing) { }
public RFC4867Frame(Rtp.RtpFrame existing) : base(existing) { }
public RFC4734Frame(Rtp.RtpFrame existing) : base(existing) { }
//Needs to only send packets and not worry about updating the frame, that should be done by ImageSource internal override void SendPackets() { m_RtpClient.FrameChangedEventsEnabled = false; while (State == StreamState.Started) { try { if (m_Frames.Count == 0) { m_RtpClient.m_WorkerThread.Priority = System.Threading.ThreadPriority.Lowest; System.Threading.Thread.Sleep(clockRate); continue; } int period = (clockRate * 1000 / m_Frames.Count); //Dequeue a frame or die Rtp.RtpFrame frame = m_Frames.Dequeue(); if (frame == null || frame.IsDisposed) { continue; } //Get the transportChannel for the packet Rtp.RtpClient.TransportContext transportContext = RtpClient.GetContextBySourceId(frame.SynchronizationSourceIdentifier); //If there is a context if (transportContext != null) { //Increase priority m_RtpClient.m_WorkerThread.Priority = System.Threading.ThreadPriority.AboveNormal; transportContext.RtpTimestamp += period; foreach (Rtp.RtpPacket packet in frame) { //Copy the values before we signal the server //packet.Channel = transportContext.DataChannel; packet.SynchronizationSourceIdentifier = (int)sourceId; packet.Timestamp = (int)transportContext.RtpTimestamp; //Increment the sequence number on the transportChannel and assign the result to the packet packet.SequenceNumber = ++transportContext.SequenceNumber; //Fire an event so the server sends a packet to all clients connected to this source if (false == m_RtpClient.FrameChangedEventsEnabled) { RtpClient.OnRtpPacketReceieved(packet); } } //Modified packet is no longer complete because SequenceNumbers were modified //Fire a frame changed event manually if (m_RtpClient.FrameChangedEventsEnabled) { RtpClient.OnRtpFrameChanged(frame); } unchecked { ++m_FramesPerSecondCounter; } } //If we are to loop images then add it back at the end if (Loop) { m_Frames.Enqueue(frame); } System.Threading.Thread.Sleep(clockRate); } catch (Exception ex) { if (ex is System.Threading.ThreadAbortException) { //Handle the abort System.Threading.Thread.ResetAbort(); Stop(); return; } continue; } } }
public RFC3952Frame(Rtp.RtpFrame existing) : base(existing) { }
public RFC5215Frame(Rtp.RtpFrame existing) : base(existing) { }
public RFC5391Frame(Rtp.RtpFrame existing) : base(existing) { }
public RFC6295Frame(Rtp.RtpFrame existing) : base(existing) { }
public RFC5993Frame(Rtp.RtpFrame existing) : base(existing) { }
public RFC4421Frame(Rtp.RtpFrame existing) : base(existing) { }