mirror of https://bitbucket.org/ausocean/av.git
Building and running, but not working - looks like video input into youtube is not enough, going to use nethogs
This commit is contained in:
parent
dd41aeb966
commit
510f431b90
19
rtmp/rtmp.go
19
rtmp/rtmp.go
|
@ -268,12 +268,13 @@ func sendPacket(r *C.RTMP, packet *C.RTMPPacket, queue int) int {
|
||||||
var hbuf = unsafe.Pointer(&goHbuf[0])
|
var hbuf = unsafe.Pointer(&goHbuf[0])
|
||||||
var c byte
|
var c byte
|
||||||
var t int32
|
var t int32
|
||||||
|
var packets unsafe.Pointer
|
||||||
|
|
||||||
if packet.m_nChannel >= r.m_channelsAllocatedOut {
|
if packet.m_nChannel >= r.m_channelsAllocatedOut {
|
||||||
|
log.Println("Resize")
|
||||||
n := int(packet.m_nChannel+10)
|
n := int(packet.m_nChannel+10)
|
||||||
var tmp *C.RTMPPacket
|
packets = C.realloc(unsafe.Pointer(r.m_vecChannelsOut),
|
||||||
packets := C.realloc(unsafe.Pointer(r.m_vecChannelsOut),
|
C.size_t(unsafe.Sizeof(packet) * uintptr(n)))
|
||||||
C.size_t(unsafe.Sizeof(tmp) * uintptr(n)))
|
|
||||||
|
|
||||||
if uintptr(packets) == uintptr(0) {
|
if uintptr(packets) == uintptr(0) {
|
||||||
C.free(unsafe.Pointer(r.m_vecChannelsOut))
|
C.free(unsafe.Pointer(r.m_vecChannelsOut))
|
||||||
|
@ -283,7 +284,7 @@ func sendPacket(r *C.RTMP, packet *C.RTMPPacket, queue int) int {
|
||||||
}
|
}
|
||||||
r.m_vecChannelsOut = (**C.RTMPPacket)(packets)
|
r.m_vecChannelsOut = (**C.RTMPPacket)(packets)
|
||||||
C.memset(incPtr(unsafe.Pointer(r.m_vecChannelsOut), int(r.m_channelsAllocatedOut),
|
C.memset(incPtr(unsafe.Pointer(r.m_vecChannelsOut), int(r.m_channelsAllocatedOut),
|
||||||
int(unsafe.Sizeof(tmp))), 0, C.size_t(unsafe.Sizeof(tmp) *
|
int(unsafe.Sizeof(packet))), 0, C.size_t(unsafe.Sizeof(packet) *
|
||||||
uintptr(n-int(r.m_channelsAllocatedOut))))
|
uintptr(n-int(r.m_channelsAllocatedOut))))
|
||||||
r.m_channelsAllocatedOut = C.int(n)
|
r.m_channelsAllocatedOut = C.int(n)
|
||||||
}
|
}
|
||||||
|
@ -291,7 +292,6 @@ func sendPacket(r *C.RTMP, packet *C.RTMPPacket, queue int) int {
|
||||||
int(packet.m_nChannel), int(unsafe.Sizeof(packet))))
|
int(packet.m_nChannel), int(unsafe.Sizeof(packet))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if prevPacket != nil && packet.m_headerType != RTMP_PACKET_SIZE_LARGE {
|
if prevPacket != nil && packet.m_headerType != RTMP_PACKET_SIZE_LARGE {
|
||||||
// compress a bit by using the prev packet's attributes
|
// compress a bit by using the prev packet's attributes
|
||||||
if prevPacket.m_nBodySize == packet.m_nBodySize &&
|
if prevPacket.m_nBodySize == packet.m_nBodySize &&
|
||||||
|
@ -523,15 +523,14 @@ func sendPacket(r *C.RTMP, packet *C.RTMPPacket, queue int) int {
|
||||||
|
|
||||||
*(**C.RTMPPacket)(incPtr(unsafe.Pointer(r.m_vecChannelsOut),
|
*(**C.RTMPPacket)(incPtr(unsafe.Pointer(r.m_vecChannelsOut),
|
||||||
int(packet.m_nChannel), int(unsafe.Sizeof(packet)))) =
|
int(packet.m_nChannel), int(unsafe.Sizeof(packet)))) =
|
||||||
(*C.RTMPPacket)(C.malloc(C.size_t(unsafe.Sizeof(*packet))))
|
(*C.RTMPPacket)(C.malloc(C.size_t(unsafe.Sizeof(*packet))))
|
||||||
}
|
}
|
||||||
|
|
||||||
//memmove(incPtr(unsafe.Pointer(r.m_vecChannelsOut),int(packet.m_nChannel),
|
//memmove(incPtr(unsafe.Pointer(r.m_vecChannelsOut),int(packet.m_nChannel),
|
||||||
//int(unsafe.Sizeof(packet))),unsafe.Pointer(packet), unsafe.Sizeof(packet))
|
//int(unsafe.Sizeof(packet))),unsafe.Pointer(packet), unsafe.Sizeof(packet))
|
||||||
dest := ptrToSlice(incPtr(unsafe.Pointer(r.m_vecChannelsOut),int(packet.m_nChannel),
|
C.memcpy(unsafe.Pointer(*(**C.RTMPPacket)(incPtr(unsafe.Pointer(r.m_vecChannelsOut),
|
||||||
int(unsafe.Sizeof(packet))),int(unsafe.Sizeof(*packet)))
|
int(packet.m_nChannel), int(unsafe.Sizeof(packet))))), unsafe.Pointer(packet),
|
||||||
src := ptrToSlice(unsafe.Pointer(packet),int(unsafe.Sizeof(*packet)))
|
C.size_t(uintptr(unsafe.Sizeof(*packet))))
|
||||||
copy(dest,src)
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue