|
|
@ -22,6 +22,7 @@ PlayVideo::PlayVideo(QObject *parent,
|
|
|
|
void PlayVideo::play()
|
|
|
|
void PlayVideo::play()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MediaPacket *pkt;
|
|
|
|
MediaPacket *pkt;
|
|
|
|
|
|
|
|
int usl;
|
|
|
|
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -78,20 +79,24 @@ label1:
|
|
|
|
|
|
|
|
|
|
|
|
if (videoQueue->isEmpty())
|
|
|
|
if (videoQueue->isEmpty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
qDebug() << "PlayVideo::play: GOT EMPTY";
|
|
|
|
|
|
|
|
usleep(1000 * 100);
|
|
|
|
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pkt = videoQueue->dequeue();
|
|
|
|
pkt = videoQueue->dequeue();
|
|
|
|
sendMutex->lock();
|
|
|
|
sendMutex->lock();
|
|
|
|
send_video_pkt(channel, stream_id, pkt->av_pkt);
|
|
|
|
send_video_pkt(channel, stream_id, pkt->av_pkt);
|
|
|
|
sendMutex->unlock();
|
|
|
|
sendMutex->unlock();
|
|
|
|
|
|
|
|
usl = pkt->delay_in_us;
|
|
|
|
|
|
|
|
if (usl < 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
usl = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (usl > 100 * 1000)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
usl = 100 * 1000;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
usleep(usl);
|
|
|
|
delete pkt;
|
|
|
|
delete pkt;
|
|
|
|
usleep(pkt->delay_in_us);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateMediaPos();
|
|
|
|
updateMediaPos();
|
|
|
|
|
|
|
|
|
|
|
|
if (elapsedTime == 0)
|
|
|
|
if (elapsedTime == 0)
|
|
|
|
elapsedTime = av_gettime();
|
|
|
|
elapsedTime = av_gettime();
|
|
|
|
|
|
|
|
|
|
|
|