Commit Graph

608 Commits

Author SHA1 Message Date
scruzin 88e1415b10 Include pkg name in fatal log messages. 2019-01-09 16:08:02 +10:30
scruzin cbe6149c8f Added proper logging. 2019-01-07 23:59:41 +10:30
Alan Noble c4bc4f7c61 Set debugMode false by default. 2019-01-07 11:49:14 +00:00
scruzin 9b7feb4dfc Fix typo. 2019-01-07 22:11:35 +10:30
scruzin 1fe011b5fb Reinitialize *s in close(). 2019-01-07 21:58:19 +10:30
scruzin 04679e4757 Removed used fields and initalize packets lazily. 2019-01-07 21:45:00 +10:30
scruzin 0b869523b4 Removed packet member from Session. 2019-01-07 20:16:11 +10:30
scruzin 8ed3c04186 Change log messages to reflect new function names. 2019-01-07 20:15:12 +10:30
scruzin ad43420270 Remove another unused file. 2019-01-07 19:31:54 +10:30
scruzin 1a7048e9f3 Updated copyright year. 2019-01-07 18:01:22 +10:30
scruzin 31b1a6a7d3 Made function names camel case and factored packet functions into packet.go. 2019-01-07 18:00:42 +10:30
scruzin ad55d31577 Made type and variable names idiomatic, and merged C_RTMP into Session. 2019-01-07 16:20:35 +10:30
scruzin 6975f5172e Make member names camel case. 2019-01-07 13:33:07 +10:30
scruzin 189338d81b Removed since unused. 2019-01-07 13:25:14 +10:30
scruzin 9b14883bd3 Log packetType when sending. 2019-01-07 10:22:04 +10:30
scruzin 647f10f212 Only set ts in C_RTMP_SendPacket() when prevPacket != nil. 2019-01-07 08:44:04 +10:30
scruzin 3dccec4f35 Removed C_RTMP_SetBufferMS(). 2019-01-06 17:43:48 +10:30
scruzin 9335e2701d Fixed debug mode for C_RTMP_SendPacket(). 2019-01-06 17:17:51 +10:30
scruzin 309680f019 Removed references to C.RTMP_Free(). 2019-01-06 16:13:06 +10:30
scruzin 6133032a05 Moved conn from C_RTMPSockBuf to C_RTMP_LNK and deleted the former. 2019-01-06 15:54:49 +10:30
scruzin 474642f53b Simplified C_RTMP_IsConnected(). 2019-01-06 15:35:55 +10:30
scruzin c7b96f1c31 Check for an propagate encoding errors. 2019-01-06 15:19:58 +10:30
scruzin e876491f24 Removed since now obsolete. 2019-01-06 14:44:29 +10:30
scruzin 81b92b2302 All rmtp functions now return an error (or nothing), except for C_RTMP_IsConnected() which now returns a bool instead of an int. 2019-01-06 14:42:51 +10:30
scruzin b7871cb2f2 Prefix errors with rtmp: 2019-01-06 12:06:16 +10:30
scruzin 26157f47a2 Refactored C_ReadN() to use io.ReadFull() and removed now obsolete RTMPSockBuf_Fill(). 2019-01-06 10:11:31 +10:30
scruzin be1610b67f Use unsigned ints for timeouts. 2019-01-06 09:37:21 +10:30
scruzin e173153ca6 Use Go errors for C_RTMP_ParseURL, C_RTMP_SetupURL, C_RTMP_Connect1, and C_RTMP_ConnectStream. 2019-01-06 09:20:32 +10:30
scruzin 4d767f106c Make for Go idiomatic. 2019-01-06 08:25:46 +10:30
scruzin 513b84ad87 Further cleaned up sockets related code. 2019-01-05 23:13:19 +10:30
saxon e340c9b9be rtmp: removed debug prints 2019-01-02 21:55:43 +10:30
saxon 0b2c38117f revid: trying to fix rtmp 2019-01-02 21:28:20 +10:30
scruzin 04d7540b34 Replaced Unix sockets with IPConn. Sock_XXX funtions have been left as is for PR readability. 2019-01-02 18:20:30 +10:30
Dan Kortschak 50884b8034 rtmp: re-add recvtimeout option setting 2018-10-01 11:31:16 +09:30
Dan Kortschak c91896d919 rtmp: add SOCKS negotiation back 2018-10-01 09:10:53 +09:30
Dan Kortschak f61bd0a193 rtmp: use std net for connections 2018-09-30 18:59:01 +09:30
Dan Kortschak fcfdd69b8e rtmp: remove unsafe use from rtmp.go 2018-09-26 17:06:06 +09:30
Dan Kortschak 9c72a93763 rtmp: replace first half of C_RTMP_SendPacket pointer walk with index walk 2018-09-26 16:01:16 +09:30
Dan Kortschak d101946cfe rtmp: attempt to find some clarity of flow 2018-09-26 15:06:50 +09:30
Dan Kortschak b054ab103f rtmp: prepare for the horror of walking backwards 2018-09-26 14:52:07 +09:30
Dan Kortschak ac15477af1 rtmp: remove http-specific code 2018-09-26 14:39:46 +09:30
Dan Kortschak 5203982233 rtmp: remove direct unsafe use in C_RTMP_SendPacket 2018-09-26 14:37:53 +09:30
Dan Kortschak dc040ccf9c rtmp: simplify C_RTMP_SendPacket 2018-09-26 14:07:54 +09:30
Dan Kortschak 6e5e597b11 rtmp: use slices in C_RTMP_ReadPacket 2018-09-26 13:52:28 +09:30
Dan Kortschak 22c926611d rtmp: simplify header parsing 2018-09-26 13:22:44 +09:30
Dan Kortschak 85b74d6624 rtmp: fix C types for arm 2018-09-26 12:43:13 +09:30
Dan Kortschak e5faa396c1 rtmp: use C.CString
Now GODEBUG=cgocheck=0 is not needed.
2018-09-26 12:10:03 +09:30
Dan Kortschak d93357bb6f rtmp: remove unused functions 2018-09-26 12:10:03 +09:30
Dan Kortschak 43b3c8631d rtmp: remove unused memset 2018-09-26 12:10:03 +09:30
Dan Kortschak f25661ec2d rtmp: extract socket code into separate file 2018-09-26 12:10:03 +09:30
Dan Kortschak 29f7d24623 rtmp: clean up C_HandShake 2018-09-26 12:10:03 +09:30
Dan Kortschak cb47db73c8 rtmp: make C_RTMPPacket.m_body a []byte
Punt on, but prepare for, the more ridiculous C-isms.
2018-09-26 12:10:03 +09:30
Dan Kortschak 467984513b rtmp: make C_CloseInternal reconnect a bool 2018-09-26 12:10:03 +09:30
Dan Kortschak 0eb66a6ece rtmp: make C_HandleInvoke take a []byte 2018-09-26 12:10:03 +09:30
Dan Kortschak b1ecf52a44 rtmp: fix incorrect type 2018-09-26 12:10:03 +09:30
Dan Kortschak 9cfe8c430b rtmp: use []byte for RTMP message sends 2018-09-26 12:10:03 +09:30
Dan Kortschak eccc9377ab rtmp: use []byte for encoding in C_SendConnectPacket 2018-09-26 12:10:03 +09:30
Dan Kortschak 55e454453b rtmp: remove unnecessary zeroing 2018-09-26 12:10:03 +09:30
Dan Kortschak eeb1e1933b rtmp: make C_ReadN take a []byte 2018-09-26 12:10:03 +09:30
Dan Kortschak 5f3f50373b rtmp: clean up C_SocksNegotiate 2018-09-26 12:10:03 +09:30
Dan Kortschak d1f870223c rtmp: make C_WriteN take a []byte 2018-09-26 12:10:03 +09:30
Dan Kortschak 7b69015873 rtmp: make C_RTMPSockBuf_Send take a []byte 2018-09-26 12:10:03 +09:30
Dan Kortschak bb6ee2a3ce rtmp: simplify recv call in C_RTMPSockBuf_Fill 2018-09-26 12:10:03 +09:30
Dan Kortschak b9fcb2202f rtmp: make C_RTMPSockBuf.sb_timedout a bool 2018-09-26 12:10:03 +09:30
Dan Kortschak 9b5d62a99a rtmp: clarify C_RTMPSockBuf_Fill
The while loop in the C is only there to allow sigint to be caught and
ignored when user interupts are not allowed.
2018-09-26 12:10:03 +09:30
Dan Kortschak 0cfabbbad0 rtmp: remove unused functions 2018-09-26 12:10:03 +09:30
Dan Kortschak ea5c54c85d rtmp: remove unsafe and C imports from amf.go
unsafe importing functions moved to rtmp.go.
2018-09-26 12:10:03 +09:30
Dan Kortschak 61798fd4a6 rtmp: make C_AMF_Decode take a []byte
Also remove never-executed and incorrect error retry logic.
2018-09-26 12:10:03 +09:30
Dan Kortschak e649a94612 rtmp: remove unused C_AMF_DecodeArray 2018-09-26 12:10:03 +09:30
Dan Kortschak d88f0601bb rtmp: make C_AMF_DecodeArray take a []byte
This is unused.
2018-09-26 12:10:03 +09:30
Dan Kortschak 7f2385b8a2 rtmp: make C_AMFProp_Decode take a []byte
Also fix errors that exists in the librtmp implementation that resulted
in failure to progress the data pointer.
2018-09-26 12:10:03 +09:30
Dan Kortschak 7077165e63 rtmp: removed unused C_AMF3Read{Integer,String} 2018-09-26 12:10:03 +09:30
Dan Kortschak 6b2ddd3deb rtmp: make C_AMF3Read{Integer,String} take a []byte
These functions are unused.
2018-09-26 12:10:03 +09:30
Dan Kortschak 04bd966c89 rtmp: make encoders return []byte 2018-09-26 12:10:03 +09:30
Dan Kortschak 47e6db5ca1 rtmp: make C_AMF_EncodeArray take a []byte 2018-09-26 12:10:03 +09:30
Dan Kortschak d01109ced6 rtmp: make C_AMF_EncodeEcmaArray take a []byte 2018-09-26 12:10:03 +09:30
Dan Kortschak d38cd89bc3 rtmp: make C_AMF_Encode take a []byte 2018-09-26 12:10:03 +09:30
Dan Kortschak e0311dae58 rtmp: make C_AMF_PropEncode take a []byte 2018-09-26 12:10:03 +09:30
Dan Kortschak b8742e9927 rtmp: make C_AMFObject hold a []C_AMFObjectProperty 2018-09-26 12:10:03 +09:30
Dan Kortschak 52f34e4a85 rtmp: make C_AMF_EncodeNamed{Boolean,Number,String} take []byte 2018-09-26 12:10:03 +09:30
Dan Kortschak 458eb932aa rtmp: make C_AMF_EncodeNumber take []byte 2018-09-26 12:10:03 +09:30
Dan Kortschak 00b4e167f4 rtmp: make C_AMF_EncodeBoolean take a []byte 2018-09-26 12:10:03 +09:30
Dan Kortschak cf87480070 rtmp: make C_AMF_EncodeInt{24,32,String} take []byte 2018-09-26 12:10:03 +09:30
Dan Kortschak 73dd7f3a7c rtmp: remove redundant int16 encoder 2018-09-26 12:10:03 +09:30
Dan Kortschak a2620e003b rtmp: make C_EncodeInt32LE take a []byte dst 2018-09-26 12:10:03 +09:30
Dan Kortschak 4f2beed32f rtmp: make decoders take []byte 2018-09-26 12:10:03 +09:30
Dan Kortschak b86ba9e49a rtmp: use bool for m_bSendEncoding and m_bSendEncoding 2018-09-26 12:10:03 +09:30
Dan Kortschak b45f70bdf8 rtmp: make C_RTMP.m_vecChannelsOut a []*C_RTMPPacket 2018-09-26 12:10:03 +09:30
Dan Kortschak 0c124eb761 rtmp: make C_RTMP.m_vecChannelsIn a []*C_RTMPPacket 2018-09-26 12:10:03 +09:30
Dan Kortschak 46786f2436 rtmp: simplify packet allocation 2018-09-26 12:10:03 +09:30
Dan Kortschak 66cdea021c rtmp: remove incorrect and redundant calloc implementation 2018-09-26 12:10:03 +09:30
Dan Kortschak f237b5453e rtmp: make C_RTMP.m_channelTimestamp a []int32 2018-09-26 12:10:03 +09:30
Dan Kortschak 86e07e2b32 rtmp: make C_RTMPChunk.c_chunk a []byte 2018-09-26 12:10:03 +09:30
Dan Kortschak f387b827ae rtmp: remove unnecessary type conversions 2018-09-26 12:10:03 +09:30
Dan Kortschak 6978c44de6 rtmp: make m_methodCalls field a slice 2018-09-26 12:10:03 +09:30
Dan Kortschak 26e3bd264a rtmp: remove read type 2018-09-26 12:10:03 +09:30
Dan Kortschak ae53aa146e rtmp: remove librtmp 2018-09-15 07:27:27 +09:30
Dan Kortschak f0462ee511 rtmp: remove unused fields
reported by honnef.co/go/tools/cmd/unused

rtmp_headers.go:145:2: field sb_ssl is unused (U1000)
rtmp_headers.go:167:2: field subscribepath is unused (U1000)
rtmp_headers.go:168:2: field usherToken is unused (U1000)
rtmp_headers.go:170:2: field pubUser is unused (U1000)
rtmp_headers.go:171:2: field pubPasswd is unused (U1000)
rtmp_headers.go:173:2: field edepth is unused (U1000)
rtmp_headers.go:175:2: field stopTime is unused (U1000)
rtmp_headers.go:180:2: field pFlags is unused (U1000)
rtmp_headers.go:189:2: field bufpos is unused (U1000)
rtmp_headers.go:190:2: field buflen is unused (U1000)
rtmp_headers.go:191:2: field timestamp is unused (U1000)
rtmp_headers.go:195:2: field initialFrameType is unused (U1000)
rtmp_headers.go:197:2: field metaHeader is unused (U1000)
rtmp_headers.go:198:2: field initialFrame is unused (U1000)
rtmp_headers.go:199:2: field nMetaHeaderSize is unused (U1000)
rtmp_headers.go:200:2: field nInitialFrameSize is unused (U1000)
rtmp_headers.go:223:2: field m_mediaStamp is unused (U1000)
rtmp_headers.go:224:2: field m_pauseStamp is unused (U1000)
rtmp_headers.go:245:2: field m_polling is unused (U1000)
rtmp_headers.go:248:2: field m_clientID is unused (U1000)
2018-09-09 19:36:55 +09:30
Dan Kortschak fed685b107 rtmp: fix test 2018-09-08 16:07:00 +09:30
Dan Kortschak 834c2bc632 rtmp: remove C_AVal 2018-09-07 20:40:46 +09:30
Dan Kortschak dde20e1a7b rtmp: more simplification of url parsing 2018-09-07 19:41:55 +09:30
Dan Kortschak 9212bed0ed rtmp: simplify url parsing 2018-09-07 07:02:12 +09:30
Dan Kortschak bf2a2ec7a8 rtmp: remove C_AVal from C_RTMP_METHOD 2018-09-06 19:18:17 +09:30
Dan Kortschak 28f5ec6a47 rtmp: make isready return a bool 2018-09-06 18:40:47 +09:30
Dan Kortschak b1c904ee22 rtmp: reduce CAV/AVC conversions 2018-09-06 18:31:14 +09:30
Dan Kortschak 42f7316f09 rtmp: ensure we catch invalid methods 2018-09-06 18:06:45 +09:30
Dan Kortschak 569cc100fa retmp: simplify big switch 2018-09-06 18:05:01 +09:30
Dan Kortschak 97127030b3 rtmp: remove C_AVal from RTMP type 2018-09-06 16:52:48 +09:30
Dan Kortschak fed9d366c6 rtmp: remove C_Aval from C_AMFObjectProperty 2018-09-06 16:49:25 +09:30
Dan Kortschak c4800034a6 rtmp: remove C_AVal from P_vu 2018-09-06 16:10:15 +09:30
Dan Kortschak ed40f36ffe rtmp: remove C_AVal from C_AMF3ReadString
Note that this function is not used.
2018-09-06 15:57:09 +09:30
Dan Kortschak f005c31b44 rtmp: encode/decode typed boolean 2018-09-06 15:36:27 +09:30
Dan Kortschak 470e61a465 rtmp: remove C_AVal from encoder/decoder functions 2018-09-06 15:32:29 +09:30
Dan Kortschak 019a1f1c90 rtmp: make string decoding a returning function 2018-09-06 12:46:07 +09:30
Dan Kortschak a626a740ea rtmp: remove missed comments 2018-09-06 12:29:03 +09:30
Dan Kortschak aac0801cdb rtmp: use bytes.Equal for signature matching 2018-09-06 12:26:35 +09:30
Dan Kortschak 6c6ed78e8f rtmp: convert boolish ints to bool 2018-09-06 12:18:45 +09:30
Dan Kortschak f3a0968fb4 rtmp: port C_CloseInternal 2018-09-06 11:46:48 +09:30
Dan Kortschak 8674b23b28 rtmp: port C_SendFCUnpublish 2018-09-06 11:26:52 +09:30
Dan Kortschak b7c148fd93 rtmp: simplify body pointer setup 2018-09-06 11:11:29 +09:30
Dan Kortschak c31021149d rtmp: remove redundant comments 2018-09-06 11:04:08 +09:30
Dan Kortschak 7bfea781b4 rtmp: remove redundant size adjustment 2018-09-04 14:07:49 +09:30
saxon 078ba12093 rtmp: tried to replicate C behaviour by returning would be no of bytes written 2018-09-02 14:20:25 +09:30
saxon 8cf8f07b9c rtmp: corrected C_RTMP_Write c file line number 2018-09-02 13:40:18 +09:30
saxon 3d3ec6b893 rtmp: check that len(buf) is not less than 4 before buf = buf[4:] 2018-09-02 13:31:52 +09:30
saxon 6da0967b80 rtmp: removed check to see if byte slice length is less that 0 - which doesn't happen 2018-09-02 12:27:25 +09:30
saxon 9b152f0495 rtmp: removed math.Abs in C_RTMP_Write for checking noOfBytesRead 2018-09-02 11:35:32 +09:30
saxon 24968c83b3 rtmp: removed use of s2 and replaced with len(buf) 2018-09-02 11:32:11 +09:30
saxon 390c882792 rtmp: removed comments containing previous code in C_RTMP_Write 2018-09-02 10:21:10 +09:30
saxon 269c8176a1 rtmp: changed data slice to buf to simplify 2018-09-02 10:19:29 +09:30
saxon e861420e69 Merge branch 'master' into rtmp-unsafe-cleanup 2018-09-02 00:04:32 +09:30
saxon b3c25d3bc7 rtmp: initial commit 2018-09-02 00:03:30 +09:30
Dan Kortschak 4fa4dce908 rtmp: remove redundant reconversions 2018-09-01 23:35:28 +09:30
Dan Kortschak 05bed207b3 rtmp: remove unnecessary int conversions 2018-09-01 23:31:20 +09:30
Dan Kortschak 74e468dfb3 rtmp: remove unnecessary type conversions with unconvert 2018-09-01 23:31:08 +09:30
saxon 287c3d32ac rtmp: tried removing some unsafe pointers in C_RTMP_Write - ended up breaking it. Youtube tells me it's starting but it now goes live 2018-09-01 23:23:07 +09:30
Dan Kortschak 40785e7454 rtmp: make tests pass 2018-09-01 23:20:32 +09:30
Dan Kortschak c494da9a1d rtmp: remove indxBytePtr
Manual clean up.
2018-08-31 12:01:34 +09:30
Dan Kortschak e235da36a1 rtmp: simplify slice conversion
Second pass:

gofmt -w -r 'ptrToSlice(p,i)->(*[_Gi]byte)(p)[:i]' {rtmp,parseurl,amf}.go
2018-08-31 11:43:49 +09:30
Dan Kortschak 52c6b1f60a rtmp: simplify unsafe slice conversion
Mechanical:

gofmt -w -r 'ptrToSlice(unsafe.Pointer(p),i)->(*[_Gi]byte)(unsafe.Pointer(p))[:i]' {rtmp,parseurl,amf}.go
2018-08-31 11:42:22 +09:30
Dan Kortschak 0053034e94 rtmp: simplify indexing
This is a mechanical change in line with the previous:

gofmt -w -r '*indxBytePtr(p,i)->(*[_Gi]byte)(p)[i]' {rtmp,parseurl,amf}.go
2018-08-31 11:29:41 +09:30
Dan Kortschak 18e1e7fc45 rtmp: simplify indexing
This is a mechanical change with the addition of a constant:

gofmt -w -r '*indxBytePtr(unsafe.Pointer(p), i)->(*[_Gi]byte)(unsafe.Pointer(p))[i]' {rtmp,parseurl,amf}.go
2018-08-31 11:24:42 +09:30
Dan Kortschak 6187df1c20 rtmp: remove deadcode and make tests pass 2018-08-31 11:13:59 +09:30
Dan Kortschak 4aad7bac04 rtmp: remove rtmp.c 2018-08-30 20:34:09 +09:30
Dan Kortschak 7da8c11c58 rtmp: port add_addr_info and remove unused includes 2018-08-30 20:31:19 +09:30
saxon e0c3cd3b32 rtmp: added more funcs to NOT_PORTED and removed commented out sections from AMFProp_Decode in amf.go 2018-08-28 20:10:13 +09:30
saxon 01f3caa8ec rtmp: created NOT_PORTED.txt to hold names of funcs not ported and also deleted sections of code not run in our case 2018-08-28 19:18:13 +09:30
saxon 766d30e2f6 rtmp: setting r.m_nClientBW2 to 255 rather than 0 (which was incorrect in C_HandlClientBW 2018-08-28 18:50:51 +09:30
saxon 8318f34be4 rtmp: removed case braces in C_HandlInvoke and replaced code not run with panics in case we do get those cases 2018-08-28 18:40:10 +09:30
saxon bd630fd893 rtmp: added all consts/flags from C library 2018-08-26 14:35:04 +09:30