PHZ76 / RtspServer

RTSP Server , RTSP Pusher
MIT License
990 stars 356 forks source link

Timestamp not updating #53

Open venkatou opened 3 years ago

venkatou commented 3 years ago

Hi, I have put together a code that takes data from FFmpeg encoded h264 packets and sends it to RTSP server. With VLC (3.0.8), I am able to view the frames fine but noticed the time stays at "00:00" in the seek bar. I tried defining videoFrame.timestamp with both definitions under xop::H264Source::GetTimestamp():

auto time_point = chrono::time_point_cast<chrono::microseconds>(chrono::steady_clock::now()); return (uint32_t)((time_point.time_since_epoch().count() + 500) / 1000 * 90 );

and

struct timeval tv = {0}; gettimeofday(&tv, NULL); uint32_t ts = ((tv.tv_sec*1000)+((tv.tv_usec+500)/1000))*90; // 90: _clockRate/1000; return ts;

Appreciate any pointers on what might be causing this issue and how to fix it. Thanks.

PHZ76 commented 2 years ago

Hi, The rtptime must be set for SDP information. Try to use function RtpConnection::GetRtpInfo.