<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><blockquote type="cite"><div lang="ZH-CN" link="#0563C1" vlink="#954F72" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="WordSection1" style="page: WordSection1;"><div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: Calibri, sans-serif; text-indent: 21pt;"><span lang="EN-US">Maybe the speed of streaming frames is much faster than the speed of generating frames. So when function “doGetNextFrame()” is called, no frame is put into memory. If I use sleep() to wait for frames, thread blocks and streaming AAC frames slowns down.</span></div></div></div></blockquote><div><br></div>No, you shouldn't call "sleep()" at all, because that will stop events from being handled during that period of time. Remember that LIVE555-based applications are event driven, using a single thread of control - with asynchronous I/O - to handle events. Therefore, the LIVE555 event loop should not block.</div><div><br></div><div><br><blockquote type="cite"><div lang="ZH-CN" link="#0563C1" vlink="#954F72" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="WordSection1" style="page: WordSection1;"><div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: Calibri, sans-serif; text-indent: 21pt;"><span lang="EN-US"><o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: Calibri, sans-serif; text-indent: 21pt;"><span lang="EN-US">So What should I do to ensure both AAC and H.264 to streamed well when no frames come?</span></div></div></div></blockquote><div><br></div></div>If your "doGetNextFrame()" is called when no frames are immediately available to be delivered, then it should return immediately (i.e., without calling "sleep()"), and should be called again when a new frame becomes available. One way to do this is to use a separate thread that monitors your frame source, and 'triggers' the LIVE555 event loop thread - by calling "triggertEvent()".<div><br></div><div>I suggest that you use the "DeviceSource" code (see "liveMedia/DeviceSource.cpp") as a model for your 'frame source' class.</div><br><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Ross Finlayson<br>Live Networks, Inc.<br><a href="http://www.live555.com/">http://www.live555.com/</a></span></span>
</div>
<br></body></html>