<div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div><div>Hi. I need use live555 to send a x264 frame from my Camera to the VLC.<br><br>I use openCV to get the camera frame and convert from BGR to YUV.<br>I use x264 to convert the frame.<br>
But the live555 is not sending the frame.<br>
<br><br>I create a RTSPServer<br><br><pre style="margin:0px;padding:0px"><span style="color:rgb(120,63,4)"><span style><code>lookupServerMediaSession(char const* streamName){<br>
<span style="white-space:pre-wrap">     </span> //<br><span style="white-space:pre-wrap">   </span> //lookUp for the session with the name<br><span style="white-space:pre-wrap">       </span> ServerMediaSession* sms = RTSPServer::lookupServerMediaSession(streamName);<br>

<span style="white-space:pre-wrap">     </span> if (!sms){<br><span style="white-space:pre-wrap">   </span><span style="white-space:pre-wrap">        </span> //create the session if this is't exist<br><span style="white-space:pre-wrap">  </span><span style="white-space:pre-wrap">        </span> sms = ServerMediaSession::createNew(envir(), streamName,"send server","sending the camera");<br>

<span style="white-space:pre-wrap">     </span><span style="white-space:pre-wrap">        </span> if (sms){<br><span style="white-space:pre-wrap">    </span><span style="white-space:pre-wrap">        </span><span style="white-space:pre-wrap">        </span> //add a subsession<br>

<span style="white-space:pre-wrap">     </span><span style="white-space:pre-wrap">        </span><span style="white-space:pre-wrap">        </span> sms->addSubsession( CameraServerMediaSubsession::createNew(envir(),true) );<br><span style="white-space:pre-wrap">       </span><span style="white-space:pre-wrap">        </span> }<br>

<span style="white-space:pre-wrap">     </span> }<br><span style="white-space:pre-wrap">    </span> return sms;<br> }</code></span></span></pre><span style="color:rgb(120,63,4)"><br><br><span style="color:rgb(0,0,0)">The subsession create a FramedSource and VideoRTPSink</span><br>

<br></span><pre style="margin:0px;padding:0px"><span style="color:rgb(120,63,4)"><code>FramedSource* CameraServerMediaSubsession::createNewStreamSource(unsigned clientSessionId,<br><span style="white-space:pre-wrap">        </span><span style="white-space:pre-wrap">        </span><span style="white-space:pre-wrap">        </span><span style="white-space:pre-wrap">        </span><span style="white-space:pre-wrap">        </span>      unsigned& estBitrate)<br>

{<br><span style="white-space:pre-wrap">  </span>//<br><span style="white-space:pre-wrap">    </span>return new CameraStream(this->envir());<br>}<br>RTPSink* CameraServerMediaSubsession::createNewRTPSink(Groupsock* rtpGroupsock,<br>

<span style="white-space:pre-wrap">     </span><span style="white-space:pre-wrap">        </span><span style="white-space:pre-wrap">        </span><span style="white-space:pre-wrap">        </span>    unsigned char rtpPayloadTypeIfDynamic,<br><span style="white-space:pre-wrap">    </span><span style="white-space:pre-wrap">        </span><span style="white-space:pre-wrap">        </span><span style="white-space:pre-wrap">        </span>    FramedSource* inputSource){<br>

<span style="white-space:pre-wrap">     </span>//<br><span style="white-space:pre-wrap">    </span>return CameraVideoRTPSink::createNew(this->envir(),<br><span style="white-space:pre-wrap">        </span><span style="white-space:pre-wrap">        </span><span style="white-space:pre-wrap">        </span><span style="white-space:pre-wrap">        </span><span style="white-space:pre-wrap">        </span>rtpGroupsock,<br>

<span style="white-space:pre-wrap">     </span><span style="white-space:pre-wrap">        </span><span style="white-space:pre-wrap">        </span><span style="white-space:pre-wrap">        </span><span style="white-space:pre-wrap">        </span>rtpPayloadTypeIfDynamic);<br>
}<br>
</code></span></pre><span style="color:rgb(120,63,4)"><br><br><span style="color:rgb(0,0,0)">And I write the CameraStream (FramedSource) using this example:</span><br><br><a href="http://www.live555.com/liveMedia/doxygen/html/DeviceSource_8cpp-source.html" target="_blank">http://www.live555.com/liveMedia/doxygen/html/DeviceSource_8cpp-source.html</a><br>

<br><span style="color:rgb(0,0,0)">Here is the code.</span><br><br></span><pre style="margin:0px;padding:0px"><span style="color:rgb(120,63,4)"><code>void CameraStream::doGetNextFrame(){<br><span style="white-space:pre-wrap">     </span>//<br>

<span style="white-space:pre-wrap">     </span>if (!isCurrentlyAwaitingData()) return; // we're not ready for the data yet<br><br><span style="white-space:pre-wrap">     </span>//get the size of the x264 frame<br><span style="white-space:pre-wrap">      </span>unsigned newFrameSize = cameraSize;<br>

<span style="white-space:pre-wrap">     </span>//create the frame<br><span style="white-space:pre-wrap">    </span>u_int8_t* newFrameDataStart = new u_int8_t[newFrameSize];<br><br><span style="white-space:pre-wrap">   </span><br>
<span style="white-space:pre-wrap">     </span>//copy the frame data<br>
<span style="white-space:pre-wrap">     </span>memcpy(newFrameDataStart,camera,cameraSize);<br> <br><span style="white-space:pre-wrap">       </span>//This I found in the example<br><span style="white-space:pre-wrap"> </span>if (newFrameSize > fMaxSize) {<br>

<span style="white-space:pre-wrap">     </span><span style="white-space:pre-wrap">        </span>fFrameSize = fMaxSize;<br><span style="white-space:pre-wrap">        </span><span style="white-space:pre-wrap">        </span>fNumTruncatedBytes = newFrameSize - fMaxSize;<br>

<span style="white-space:pre-wrap">     </span>} else {<br><span style="white-space:pre-wrap">      </span><span style="white-space:pre-wrap">        </span>fFrameSize = newFrameSize;<br><span style="white-space:pre-wrap">    </span>}<br><br>
<span style="white-space:pre-wrap">     </span>//move the frame to FTO<br>
<span style="white-space:pre-wrap">     </span>memmove(fTo, newFrameDataStart, fFrameSize);<br> <br><span style="white-space:pre-wrap">       </span>//Inform the reader it's now avaliable<br><span style="white-space:pre-wrap">    </span>FramedSource::afterGetting(this);<br>

}</code></span></pre><span style="color:rgb(120,63,4)"><br><br><span style="color:rgb(0,0,0)">The server run the doGetNextFrame function in CameraStream. But the frame is not sent.<br></span></span></div><span style="color:rgb(120,63,4)"><span style="color:rgb(0,0,0)">How can I set the live555 to send the frame?</span></span><span style="color:rgb(120,63,4)"><br>

</span></div></div>
</div><br></div>