xbmc / inputstream.rtmp

RTMP input stream add-on for Kodi
GNU General Public License v2.0
15 stars 26 forks source link

Where this function is called: CInputStreamRTMP::PosTime #122

Closed VergilGao closed 1 year ago

VergilGao commented 1 year ago

hello, i have report a bug in https://github.com/kodi-pvr/pvr.iptvsimple/issues/655

after that i use tcpdump to catch packages between my iptv provider and my iptv box i found the different:

Range: npt=245-\r\n

the 245 is “the number of seconds that elapsed from the start of the stream"

and i use potplayer to play the rtsp stream: i got

Range: npt=152.909-\r\n

and everything works well.

but kodi send a value that is much larger than the length of the entire stream. for example:

Range: npt=10889.373-\r\n

and it should be 38.

i dont know who is responsible for transmitting this parameter on the entire playback pipeline. so i found the original implementation of RTMP_SendSeek

int
RTMP_SendSeek(RTMP *r, int iTime)
{
  RTMPPacket packet;
  char pbuf[256], *pend = pbuf + sizeof(pbuf);
  char *enc;

  packet.m_nChannel = 0x08; /* video channel */
  packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
  packet.m_packetType = RTMP_PACKET_TYPE_INVOKE;
  packet.m_nTimeStamp = 0;
  packet.m_nInfoField2 = 0;
  packet.m_hasAbsTimestamp = 0;
  packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;

  enc = packet.m_body;
  enc = AMF_EncodeString(enc, pend, &av_seek);
  enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
  *enc++ = AMF_NULL;
  enc = AMF_EncodeNumber(enc, pend, (double)iTime);

  packet.m_nBodySize = enc - packet.m_body;

  r->m_read.flags |= RTMP_READ_SEEKING;
  r->m_read.nResumeTS = 0;

  return RTMP_SendPacket(r, &packet, TRUE);
}

the if found this code:

bool CInputStreamRTMP::PosTime(int ms)
{
  std::unique_lock<std::recursive_mutex> lock(m_critSection);

  return RTMP_SendSeek(m_session, ms);
}

but i cant find where this code is called.

VergilGao commented 1 year ago

got it it is the implement of inputstream.ffmpegdirect/StreamManager.h