[rtmpdump] Problem with handling metadata after seek in librtmp

Juraj Horváth juraj.horvath at inmail.sk
Sun Feb 19 21:19:22 CET 2012


Hi developers,

 

I hope that somebody can help me with problem while seeking in librtmp. I'm
working as developer on splitter for OnlineVideos plugin
(http://code.google.com/p/mp-onlinevideos2
<http://code.google.com/p/mp-onlinevideos2/> ) for MediaPortal
(http://www.team-mediaportal.com <http://www.team-mediaportal.com/> ). While
testing seeking in RTMP streams I found problem with handling metadata
(error: DECODING ERROR, IGNORING BYTES UNTIL NEXT KNOWN PATTERN!).

 

Before I describe the problem with handling metadata I have to write that I
changed RTMP_ConnectStream() method to request seek in RTMP stream
correctly, because your implementation doesn't work on any server which I
tests.

 

int

RTMP_ConnectStream(RTMP *r, int seekTime)

{

  RTMPPacket packet = { 0 };

  int tempSeekTime = 0;

 

  /* seekTime was already set by SetupStream / SetupURL.

   * This is only needed by ReconnectStream.

   */

  /*if (seekTime > 0)

    r->Link.seekTime = seekTime;*/

 

  r->m_mediaChannel = 0;

 

  tempSeekTime = r->Link.seekTime;

  r->Link.seekTime = 0;

 

  while (!r->m_bPlaying && RTMP_IsConnected(r) && RTMP_ReadPacket(r,
&packet))

  {

    if (RTMPPacket_IsReady(&packet))

    {

      if (!packet.m_nBodySize)

        continue;

      if ((packet.m_packetType == RTMP_PACKET_TYPE_AUDIO) ||

        (packet.m_packetType == RTMP_PACKET_TYPE_VIDEO) ||

        (packet.m_packetType == RTMP_PACKET_TYPE_INFO))

      {

        RTMP_Log(RTMP_LOGWARNING, "Received FLV packet before play()!
Ignoring.");

        RTMPPacket_Free(r, &packet);

        continue;

      }

 

      RTMP_ClientPacket(r, &packet);

      RTMPPacket_Free(r, &packet);

    }

  }

 

  r->Link.seekTime = tempSeekTime;

 

  if ((r->Link.seekTime > 0) && (r->m_bPlaying))

  {

   if (!RTMP_SendSeek(r, r->Link.seekTime))

    {

      RTMP_Close(r);

    }

  }

 

  return r->m_bPlaying;

}

 

Now back to problem. After requesting seek on RTMP stream I received
response with different metadata as librtmp expects. Actually in stream are
two metadata packets, first handled correctly, second not. When I
investigated issue I found that in second metadata packet are four extra
bytes (positions 0x2788E8 - 0x2788EB in dump file). You can download network
dump file with packet sizes from
https://rapidshare.com/files/1882268158/rtmp_seek_dump.zip. In archive are
two files rtmp_network.dump - contains each packet received from server and
rtmp_network_packet_size.txt - contains sizes of each packet received from
server.

 

Connection string passed to librtmp was (you can't test video because it's
geo-locked, so I created network dump file):

 

rtmp://wcdn1001.nacevi.cz/ct-vod?id=MTQzMzMwNzc0Nnw2MzQ2NTI3ODg4OTcwMzc1MDA=
&type=wpl/mp4:ct/iVysilani/2011/11/06/FedCup2011CT4-061111-MP4_576p.mp4
app=ct-vod?id=MTQzMzMwNzc0Nnw2MzQ2NTI3ODg4OTcwMzc1MDA=&type=wpl
pageUrl=http://www.ceskatelevize.cz/ivysilani/10321546303-fed-cup-2011/21147
1290110010-rusko-cesko/
playpath=mp4:ct/iVysilani/2011/11/06/FedCup2011CT4-061111-MP4_576p.mp4
start=21612460
swfUrl=http://img9.ceskatelevize.cz/libraries/player/flashPlayer.swf?version
=1.44.6
tcUrl=rtmp://wcdn1001.nacevi.cz/ct-vod?id=MTQzMzMwNzc0Nnw2MzQ2NTI3ODg4OTcwMz
c1MDA=&type=wpl

 

I hope that somebody of you can help me. Thanks.

 

Greetings,

Juraj Horvath


----------
Darujte sebe alebo svojim blizkym Zoner Photo Studio 14.

Najdite si strateny alebo ukradnuty telefon programom Zoner AntiVirus Free pre Android

Domeny .SK len za 12.29 EUR

Ponuka z vydavatelstva Zoner Press

Mam rad Android - klikni tu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mplayerhq.hu/pipermail/rtmpdump/attachments/20120219/1384d9e9/attachment.html>


More information about the rtmpdump mailing list