Audio/video stream recording forums
|
Attention Visitor: |
You may have to register or log in before you can post:
|
|
|
Thread Tools | Display Modes |
#51
|
|||
|
|||
Re: Customized rtmpdump binaries with patch filefor the time being try with openssl and fresh copy of repo without any modifications.
|
#52
|
|||
|
|||
Re: Customized rtmpdump binaries with patch fileKSV, would you consider forking rtmpdump on github (or any other source code hosting service) and integrate your patches there? Or have you considered to push your changes upstream?
|
#53
|
|||
|
|||
Re: Customized rtmpdump binaries with patch fileDoing this produces a rtmpdump that works also.
|
#54
|
|||
|
|||
Re: Customized rtmpdump binaries with patch filecan you add my latest patch file to the openssl mix and try. also try with fresh repo + polarssl only.
|
#55
|
|||
|
|||
Re: Customized rtmpdump binaries with patch fileAdding your patch to openssl blend breaks and so does with polarssl no other changes.
EDIT: As a test I upgraded to PolarSSL 1.2.7 from 1.0.0 and with fresh code that actually does download but again the minute your patch is added, broken again . Last edited by RedPenguin : 04-18-2013 at 04:58 PM. |
#56
|
|||
|
|||
Re: Customized rtmpdump binaries with patch fileQuote:
1. first create two fresh repos and apply patch to only one of them. 2. copy rtmp.c, rtmp.h and rtmp_sys.h from patched repo to non-patched one. 3. compile it and check if problem reoccurs. if yes then we can leave out changes in other files as possible culprit. 4. now the hard part, if the problem is with changes of rtmp.c then you have to remove the code added by patch, block by block and figure out the offending code. |
#57
|
|||
|
|||
Re: Customized rtmpdump binaries with patch fileWell so far it appears it's definitely those files but to even get rtmpdump to compile I had to copy over the patched rtmpdump.c but it still fails on rtmpgw but that's not needed right now.
I also tried with only rtmp_sys.h only so that looks like it's not the problem. Will update once I get further. |
#58
|
|||
|
|||
Re: Customized rtmpdump binaries with patch fileI have found almost the exact problem, it is definitely changes to the rtmp.c that break it.
The code you place in at the very bottom is doing it: I can't seem to pinpoint the exact part of the code but once I removed all of this said code plus some small pieces above referencing it, it immediately worked. Code:
+static int +ConnectSocket(RTMP *r) +{ + int on = 1; + struct sockaddr_in service; + if (!r->Link.hostname.av_len) + return FALSE; + + memset(&service, 0, sizeof (struct sockaddr_in)); + service.sin_family = AF_INET; + + if (r->Link.socksport) + { + /* Connect via SOCKS */ + if (!add_addr_info(&service, &r->Link.sockshost, r->Link.socksport)) + return FALSE; + } + else + { + /* Connect directly */ + if (!add_addr_info(&service, &r->Link.hostname, r->Link.port)) + return FALSE; + } + + r->m_sb.sb_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + if (r->m_sb.sb_socket != -1) + { + if (connect(r->m_sb.sb_socket, (struct sockaddr *) &service, sizeof (struct sockaddr)) < 0) + { + int err = GetSockError(); + RTMP_Log(RTMP_LOGERROR, "%s, failed to connect socket. %d (%s)", + __FUNCTION__, err, strerror(err)); + RTMP_Close(r); + return FALSE; + } + + if (r->Link.socksport) + { + RTMP_Log(RTMP_LOGDEBUG, "%s ... SOCKS negotiation", __FUNCTION__); + if (!SocksNegotiate(r)) + { + RTMP_Log(RTMP_LOGERROR, "%s, SOCKS negotiation failed.", __FUNCTION__); + RTMP_Close(r); + return FALSE; + } + } + } + else + { + RTMP_Log(RTMP_LOGERROR, "%s, failed to create socket. Error: %d", + __FUNCTION__, GetSockError()); + return FALSE; + } + + /* set timeout */ + SET_RCVTIMEO(tv, r->Link.timeout); + if (setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_RCVTIMEO, (char *) &tv, sizeof (tv))) + { + RTMP_Log(RTMP_LOGERROR, "%s, Setting socket timeout to %d failed!", + __FUNCTION__, r->Link.timeout); + } + + setsockopt(r->m_sb.sb_socket, IPPROTO_TCP, TCP_NODELAY, (char *) &on, sizeof (on)); + if (r->Link.protocol & RTMP_FEATURE_HTTP) + setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_KEEPALIVE, (char *) &on, sizeof (on)); + + return TRUE; +} + +static int +SendCommand(RTMP *r, char *method, int queue) +{ + char pbuf[256], *pend = pbuf + sizeof (pbuf), *enc; + AVal av_command, methodName; + + enc = pbuf; + methodName.av_val = method; + methodName.av_len = strlen(method); + enc = AMF_EncodeString(enc, pend, &methodName); + enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); + *enc++ = AMF_NULL; + av_command.av_val = pbuf; + av_command.av_len = enc - pbuf; + + return SendInvoke(r, &av_command, queue); +} + +static int +SendGetStreamLength(RTMP *r) +{ + char pbuf[256], *pend = pbuf + sizeof (pbuf), *enc; + AVal av_Command; + + enc = pbuf; + enc = AMF_EncodeString(enc, pend, &av_getStreamLength); + enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); + *enc++ = AMF_NULL; + enc = AMF_EncodeString(enc, pend, &r->Link.playpath); + av_Command.av_val = pbuf; + av_Command.av_len = enc - pbuf; + + return SendInvoke(r, &av_Command, TRUE); +} + +static int +SendInvoke(RTMP *r, AVal *command, int queue) +{ + RTMPPacket packet; + char pbuf[512], *enc; + + packet.m_nChannel = 0x03; /* control channel (invoke) */ + 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; + if (command->av_len) + { + memcpy(enc, command->av_val, command->av_len); + enc += command->av_len; + } + else + return FALSE; + packet.m_nBodySize = enc - packet.m_body; + + return RTMP_SendPacket(r, &packet, queue); +} + +static int +strsplit(char *src, int srclen, char delim, char ***params) +{ + char *sptr, *srcbeg, *srcend, *dstr; + int count = 1, i = 0, len = 0; + + if (src == NULL) + return 0; + if (!srclen) + srclen = strlen(src); + srcbeg = src; + srcend = srcbeg + srclen; + sptr = srcbeg; + + /* count the delimiters */ + while (sptr < srcend) + { + if (*sptr++ == delim) + count++; + } + sptr = srcbeg; + *params = calloc(count, sizeof (size_t)); + char **param = *params; + + for (i = 0; i < (count - 1); i++) + { + dstr = strchr(sptr, delim); + len = dstr - sptr; + param[i] = calloc(len + 1, sizeof (char)); + strncpy(param[i], sptr, len); + sptr += len + 1; + } + + /* copy the last string */ + if (sptr <= srcend) + { + len = srclen - (sptr - srcbeg); + param[i] = calloc(len + 1, sizeof (char)); + strncpy(param[i], sptr, len); + } + return count; +} |
#59
|
|||
|
|||
Re: Customized rtmpdump binaries with patch fileQuote:
Code:
else if (AVMATCH(&method, &av__onbwcheck) || AVMATCH(&method, &av_onBWCheck)) Code:
else if (AVMATCH(&method, &av__onbwcheck)) |
#60
|
|||
|
|||
Re: Customized rtmpdump binaries with patch fileQuote:
EDIT: Damn KSV are you good! I made this single change only and it worked immediately! Also just to double verify, I deleted the dir and reused git, made same change, and works again. Though as far as you know, this should not break anything else in the patch? |
Tags: binaries, binary, patch, patches, rtmpdump, rtmpsrv, rtmpsuck |
Thread Tools | |
Display Modes | |
|
|