Skip to content

Commit

Permalink
fix: ps file seek for rtsp test
Browse files Browse the repository at this point in the history
  • Loading branch information
nanguantong committed Sep 29, 2024
1 parent 05e837f commit e68d84b
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions librtsp/test/media/ps-file-reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,31 @@ int PSFileReader::Init()

int PSFileReader::Seek(int64_t& dts)
{
int r = 0;
int64_t fisrt_dts = -1;

/*vframe_t frame;
frame.time = dts;
while (1)
{
std::shared_ptr<avpacket_t> pkt(m_pkts->Cur(), avpacket_release);
if (NULL == pkt)
return -1;

vframes_t::iterator it;
it = std::lower_bound(m_videos.begin(), m_videos.end(), frame);
if (it == m_videos.end())
return -1;
if (fisrt_dts == -1)
fisrt_dts = pkt->dts / 90;

while (it != m_videos.begin())
{
if (it->idr)
if (dts < fisrt_dts)
break;

if (dts >= (pkt->dts / 90))
{
m_vit = it;
return 0;
// only audio
if (m_v_start_ts < 0)
break;

if (pkt->flags & AVPACKET_FLAG_KEY)
break;
}
--it;
}*/
}

return 0;
}

Expand Down

0 comments on commit e68d84b

Please sign in to comment.