mirror of https://bitbucket.org/ausocean/av.git
ported SendReleaseStream - tested and working
This commit is contained in:
parent
6cfabc671f
commit
e02c785881
38
rtmp/rtmp.go
38
rtmp/rtmp.go
|
@ -209,6 +209,7 @@ var (
|
||||||
av__result = AVC("_result")
|
av__result = AVC("_result")
|
||||||
av_secureToken = AVC("secureToken")
|
av_secureToken = AVC("secureToken")
|
||||||
av_createStream = AVC("createStream")
|
av_createStream = AVC("createStream")
|
||||||
|
av_releaseStream = AVC("releaseStream")
|
||||||
av_play = AVC("play")
|
av_play = AVC("play")
|
||||||
av_publish = AVC("publish")
|
av_publish = AVC("publish")
|
||||||
av_onBWDone = AVC("onBWDone")
|
av_onBWDone = AVC("onBWDone")
|
||||||
|
@ -1942,7 +1943,6 @@ func C_HandleClientBW(r *C.RTMP, packet *C.RTMPPacket) {
|
||||||
|
|
||||||
// int HandleInvoke(RTMP* r, const char* body, unsigned int nBodySize);
|
// int HandleInvoke(RTMP* r, const char* body, unsigned int nBodySize);
|
||||||
// rtmp.c +2912
|
// rtmp.c +2912
|
||||||
// TODO port AV_erase (rtmp.c +2393)
|
|
||||||
// TODO port SendReleaseStream (rtmp.c +1816)
|
// TODO port SendReleaseStream (rtmp.c +1816)
|
||||||
// TODO port SendFCPublish (rtmp.c +1846)
|
// TODO port SendFCPublish (rtmp.c +1846)
|
||||||
// TODO port RTMP_SendCreateStream (rtmp.c +1725)
|
// TODO port RTMP_SendCreateStream (rtmp.c +1725)
|
||||||
|
@ -2025,7 +2025,7 @@ func C_HandleInvoke(r *C.RTMP, body *byte, nBodySize uint32) int32 {
|
||||||
*/
|
*/
|
||||||
if (r.Link.protocol & RTMP_FEATURE_WRITE) != 0 {
|
if (r.Link.protocol & RTMP_FEATURE_WRITE) != 0 {
|
||||||
log.Println("2.3")
|
log.Println("2.3")
|
||||||
C.SendReleaseStream(r)
|
C_SendReleaseStream(r)
|
||||||
C.SendFCPublish(r)
|
C.SendFCPublish(r)
|
||||||
} /* NOTE This code doesn't run in our use case
|
} /* NOTE This code doesn't run in our use case
|
||||||
else {
|
else {
|
||||||
|
@ -2239,6 +2239,40 @@ leave:
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// int SendReleaseStream(RTMP* r);
|
||||||
|
// rtmp.c +1816
|
||||||
|
func C_SendReleaseStream(r *C.RTMP) int32 {
|
||||||
|
var packet C.RTMPPacket
|
||||||
|
var pbuf [1024]byte
|
||||||
|
var pend *byte = (*byte)(unsafe.Pointer(uintptr(unsafe.Pointer(&pbuf[0])) +
|
||||||
|
unsafe.Sizeof(pbuf)))
|
||||||
|
var enc *byte
|
||||||
|
|
||||||
|
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 = (*C.char)(incBytePtr(unsafe.Pointer(&pbuf[0]),
|
||||||
|
int(RTMP_MAX_HEADER_SIZE)))
|
||||||
|
|
||||||
|
enc = (*byte)(unsafe.Pointer(packet.m_body))
|
||||||
|
enc = C_AMF_EncodeString(enc, pend, &av_releaseStream)
|
||||||
|
r.m_numInvokes++
|
||||||
|
enc = C_AMF_EncodeNumber(enc, pend, float64(r.m_numInvokes))
|
||||||
|
*enc = AMF_NULL
|
||||||
|
enc = (*byte)(incBytePtr(unsafe.Pointer(enc), 1))
|
||||||
|
enc = C_AMF_EncodeString(enc, pend, &r.Link.playpath)
|
||||||
|
if enc == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
packet.m_nBodySize = C.uint32_t(uintptr(unsafe.Pointer(enc)) - uintptr(
|
||||||
|
unsafe.Pointer(packet.m_body)))
|
||||||
|
|
||||||
|
return int32(C_RTMP_SendPacket(r, &packet, 0))
|
||||||
|
}
|
||||||
|
|
||||||
// #define AVMATCH(a1,a2)
|
// #define AVMATCH(a1,a2)
|
||||||
// amf.h +63
|
// amf.h +63
|
||||||
func C_AVMATCH(a1, a2 *C.AVal) int32 {
|
func C_AVMATCH(a1, a2 *C.AVal) int32 {
|
||||||
|
|
Loading…
Reference in New Issue