<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=koi8-r"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Segoe UI";
panose-1:2 11 5 2 4 2 4 2 2 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:2.0cm 42.5pt 2.0cm 3.0cm;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=RU link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='font-family:"Segoe UI",sans-serif;color:#0C0D0E;background:white'>I wrote a simple RTSP server with a dummy realtime source.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Segoe UI",sans-serif;color:#0C0D0E;background:white'>I used the ffmpeg library as a source for the encoder and wrote a class that encodes something all the time.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Segoe UI",sans-serif;color:#0C0D0E;background:white'>I took most of the code from here </span><span style='font-family:"Segoe UI",sans-serif'><a href="https://stackoverflow.com/questions/19427576/live555-x264-stream-live-source-based-on-testondemandrtspserver#answer-21412719"><span lang=EN-US style='border:none windowtext 1.0pt;padding:0cm;background:white'>Live555: X264 Stream Live source based on "testOnDemandRTSPServer"</span></a></span><span lang=EN-US style='font-family:"Segoe UI",sans-serif'>.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Segoe UI",sans-serif'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Segoe UI",sans-serif;color:#0C0D0E;background:white'>When a new client connects, it starts receiving packets from the one that is currently coming from the encoder. This can be a P-frame or an I-frame. How can I make the new client start receiving data from the last <b>GOP</b> (SPS, PPS and I-FRAME)? <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Segoe UI",sans-serif;color:#0C0D0E;background:white'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Segoe UI",sans-serif'>That is, when the client connects, the first data that he will receive was a NAL unit including 0x67 (SPS), 0x68 (PPS), 0x65 (I-frame).<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Segoe UI",sans-serif'>I am guaranteed to include SPS, PPS every GOP (in my case every 14 frames)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D;mso-fareast-language:RU'>E-mail: </span><span lang=EN-US style='color:#1F497D;mso-fareast-language:RU'><a href="mailto:hudaev@domination.one">hudaev@domination.one</a><o:p></o:p></span></p><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 style='margin-left:5.25pt;background:white;border-collapse:collapse'><tr><td width=31 nowrap valign=top style='width:23.15pt;padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=right style='text-align:right;line-height:19.2pt'><span style='font-size:9.0pt;font-family:"Segoe UI",sans-serif;color:#848484;mso-fareast-language:RU'><o:p> </o:p></span></p></td><td valign=top style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal style='line-height:21.6pt'><span style='font-size:9.0pt;font-family:"Segoe UI",sans-serif;color:#333333;mso-fareast-language:RU'><o:p> </o:p></span></p></td></tr></table><p class=MsoNormal><span lang=EN-US style='color:#1F497D;mso-fareast-language:RU'><o:p> </o:p></span></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>