Audio/video stream recording forums

Attention Visitor:
You may have to register or log in before you can post:
  • Click the register link to sign up.
  • Registered members please fill in the form below and click the "Log in" button.
To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Audio/video stream recording forums > Streaming media recording forum > rtmpdump
Register FAQ Members List Calendar Mark Forums Read

Reply Post New Thread
 
Thread Tools Display Modes
  #81  
Old 04-23-2013, 10:58 PM
RedPenguin RedPenguin is offline
Member
 
Join Date: Feb 2012
Posts: 85
RedPenguin is on a distinguished road
Default

Re: Customized rtmpdump binaries with patch file


Quote:
Originally Posted by KSV View Post
@RedPenguin
your problem seems more like server configuration issue because the same response is accepted by other servers without any problem. anyway i have disabled it in my patches for compatibility reasons.
Thanks again for the info and all your work combined. Still nice to see some folks working on rtmpdump as it seems the official project seems almost stalled, LoL.

Anyway, I figured at first maybe they were trying to purposely break rtmpdump but I think your answer makes more sense.
Reply With Quote
  #82  
Old 04-24-2013, 12:34 AM
Stream Ripper Stream Ripper is offline
Super Moderator
 
Join Date: Feb 2007
Location: World
Posts: 886
Stream Ripper has a reputation beyond reputeStream Ripper has a reputation beyond reputeStream Ripper has a reputation beyond reputeStream Ripper has a reputation beyond reputeStream Ripper has a reputation beyond reputeStream Ripper has a reputation beyond reputeStream Ripper has a reputation beyond reputeStream Ripper has a reputation beyond reputeStream Ripper has a reputation beyond reputeStream Ripper has a reputation beyond reputeStream Ripper has a reputation beyond repute
Default

Re: Customized rtmpdump binaries with patch file


Thanks as always KSV
Reply With Quote
  #83  
Old 04-24-2013, 08:33 AM
gorilla.maguila gorilla.maguila is offline
Member
 
Join Date: Dec 2012
Posts: 62
gorilla.maguila is on a distinguished road
Default

Re: Customized rtmpdump binaries with patch file


More info on the crash I've found:

After deeper debugging, I've found that the crash is happening in calloc:

Code:
RTMPPacket_Alloc(RTMPPacket *p, int nSize)
{
  //Crash in calloc
  char *ptr = calloc(1, nSize + RTMP_MAX_HEADER_SIZE);
  if (!ptr)
    return FALSE;
  p->m_body = ptr + RTMP_MAX_HEADER_SIZE;
  p->m_nBytesRead = 0;
  return TRUE;
}

That memory corruption pointed me to run with valgrind, that showed the culprit:

Code:
==22473== Invalid write of size 1
==22473==    at 0x4E421DC: HandleInvoke (rtmp.c:3333)
==22473==    by 0x4E4368D: RTMP_ClientPacket (rtmp.c:1361)
==22473==    by 0x4E43849: RTMP_ConnectStream (rtmp.c:1152)
==22473==    by 0x403BFA: main (rtmpdump.c:1374)
==22473==  Address 0x61e1c67 is 0 bytes after a block of size 39 alloc'd
==22473==    at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22473==    by 0x4E42189: HandleInvoke (rtmp.c:3328)
==22473==    by 0x4E4368D: RTMP_ClientPacket (rtmp.c:1361)
==22473==    by 0x4E43849: RTMP_ConnectStream (rtmp.c:1152)
==22473==    by 0x403BFA: main (rtmpdump.c:1374)
Full valgrind output http://pastebin.com/9bAXB9W9

So it seems that the memory corruption exists due to AMF_DecodeInt24 returning incorrect size:

Code:
packet->m_nBodySize = AMF_DecodeInt24(header + 3);
and then allocating the memory, the crash occurs.

Code:
if (!RTMPPacket_Alloc(packet, packet->m_nBodySize))
Maybe KSV can enlighten me here, but I think the proof is that allocating more memory avoids the crash:

Code:
if (!RTMPPacket_Alloc(packet, 2*packet->m_nBodySize))
Reply With Quote
  #84  
Old 04-24-2013, 01:07 PM
KSV KSV is offline
Senior Member
 
Join Date: Apr 2011
Posts: 853
KSV is on a distinguished road
Cool

Re: Customized rtmpdump binaries with patch file


try updating the relevant block with following code.

Code:
          if (code == 302 && RTMP_FindFirstMatchingProperty(&obj2, &av_redirect, &p))
            {
              AMFProp_GetString(&p, &redirect);
              r->Link.redirected = TRUE;

              char *playpath = "//playpath";
              int len = redirect.av_len + strlen(playpath);
              char *url = malloc(len + 1);
              memcpy(url, redirect.av_val, redirect.av_len);
              memcpy(url + redirect.av_len, playpath, strlen(playpath));
              url[len] = '\0';
              r->Link.tcUrl.av_val = url;
              r->Link.tcUrl.av_len = redirect.av_len;
              RTMP_ParseURL(url, &r->Link.protocol, &r->Link.hostname, &parsedPort, &r->Link.playpath0, &r->Link.app);
              if (parsedPort)
                r->Link.port = parsedPort;
            }
        }
Reply With Quote
  #85  
Old 04-24-2013, 02:29 PM
gorilla.maguila gorilla.maguila is offline
Member
 
Join Date: Dec 2012
Posts: 62
gorilla.maguila is on a distinguished road
Default

Re: Customized rtmpdump binaries with patch file


Quote:
Originally Posted by KSV View Post
try updating the relevant block with following code.

Code:
          if (code == 302 && RTMP_FindFirstMatchingProperty(&obj2, &av_redirect, &p))
            {
              AMFProp_GetString(&p, &redirect);
              r->Link.redirected = TRUE;

              char *playpath = "//playpath";
              int len = redirect.av_len + strlen(playpath);
              char *url = malloc(len + 1);
              memcpy(url, redirect.av_val, redirect.av_len);
              memcpy(url + redirect.av_len, playpath, strlen(playpath));
              url[len] = '\0';
              r->Link.tcUrl.av_val = url;
              r->Link.tcUrl.av_len = redirect.av_len;
              RTMP_ParseURL(url, &r->Link.protocol, &r->Link.hostname, &parsedPort, &r->Link.playpath0, &r->Link.app);
              if (parsedPort)
                r->Link.port = parsedPort;
            }
        }

Thanks KSV, it's SOLVED.

Do you think it's worthy to look at the possible memory leaks pointed out by valgrind, like the

Code:
char *url = malloc(len + 1)
Never being freed, or they're false positive?

Thanks again
Reply With Quote
  #86  
Old 04-25-2013, 02:26 AM
RedPenguin RedPenguin is offline
Member
 
Join Date: Feb 2012
Posts: 85
RedPenguin is on a distinguished road
Default

Re: Customized rtmpdump binaries with patch file


Quote:
Originally Posted by flocked View Post
Could anyone please compile it for mac? thanks!!
This has been done, at least if you are running x86 32 or 64.

http://www.mediafire.com/#x4cvp5hl4m9xr (look under Newer - ATV1+MacOS).

I can make PPC versions if necessary but right now my cross-compilers are x86-based.
Reply With Quote
  #87  
Old 04-25-2013, 11:06 AM
KSV KSV is offline
Senior Member
 
Join Date: Apr 2011
Posts: 853
KSV is on a distinguished road
Cool

Re: Customized rtmpdump binaries with patch file


Changes:
Code:
1. added onFCSubscribe response to rtmpsrv to detect more streams
2. show complete debug info in rtmpsuck when connection is closed
3. fixed a small bug in redirect handling (allocating 1 byte less than required)
first post updated with latest package.

Last edited by KSV : 04-26-2013 at 02:59 AM.
Reply With Quote
  #88  
Old 04-25-2013, 11:11 AM
KSV KSV is offline
Senior Member
 
Join Date: Apr 2011
Posts: 853
KSV is on a distinguished road
Cool

Re: Customized rtmpdump binaries with patch file


Quote:
Originally Posted by gorilla.maguila View Post
Do you think it's worthy to look at the possible memory leaks pointed out by valgrind, like the

Code:
char *url = malloc(len + 1)
Never being freed, or they're false positive?
we are using the same buffer for tcUrl so it can't be freed right away. it will not be worth making a copy because memory consumption would be same in that case.
Reply With Quote
  #89  
Old 04-25-2013, 12:30 PM
alexanderd alexanderd is offline
Junior Member
 
Join Date: Mar 2013
Posts: 9
alexanderd is on a distinguished road
Default

Re: Customized rtmpdump binaries with patch file


Quote:
Originally Posted by KSV View Post
no, it has nothing to do with RTMPDump Helper. make sure new binaries are in the same folder as RTMPDump Helper.
I tried capturing on my parents' old computer. And it worked well! The timestamp has been added to filename!
The main difference between my both computer and notebook (the problem is on both) and my parents' comp - is OS. Mine are worked under Win7 Ultimate SP1 (with updates). Parents' - under WinXP.
And what OS do you use, KSV?
Reply With Quote
  #90  
Old 04-26-2013, 03:02 AM
KSV KSV is offline
Senior Member
 
Join Date: Apr 2011
Posts: 853
KSV is on a distinguished road
Cool

Re: Customized rtmpdump binaries with patch file


Quote:
Originally Posted by alexanderd View Post
Mine are worked under Win7 Ultimate SP1 (with updates). Parents' - under WinXP.
And what OS do you use, KSV?
it doesn't have anything to do with OS. can anyone else confirm this on a different OS than XP?
Reply With Quote
Reply Post New Thread
Tags: , , , , , ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -6. The time now is 06:12 AM.


Powered by All-streaming-media.com; 2006-2011
vB forum hacked with Zoints add-ons