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 c byte
|
||||
var t int32
|
||||
var packets unsafe.Pointer
|
||||
|
||||
if packet.m_nChannel >= r.m_channelsAllocatedOut {
|
||||
log.Println("Resize")
|
||||
n := int(packet.m_nChannel+10)
|
||||
var tmp *C.RTMPPacket
|
||||
packets := C.realloc(unsafe.Pointer(r.m_vecChannelsOut),
|
||||
C.size_t(unsafe.Sizeof(tmp) * uintptr(n)))
|
||||
packets = C.realloc(unsafe.Pointer(r.m_vecChannelsOut),
|
||||
C.size_t(unsafe.Sizeof(packet) * uintptr(n)))
|
||||
|
||||
if uintptr(packets) == uintptr(0) {
|
||||
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)
|
||||
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))))
|
||||
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))))
|
||||
|
||||
|
||||
|
||||
if prevPacket != nil && packet.m_headerType != RTMP_PACKET_SIZE_LARGE {
|
||||
// compress a bit by using the prev packet's attributes
|
||||
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),
|
||||
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),
|
||||
//int(unsafe.Sizeof(packet))),unsafe.Pointer(packet), unsafe.Sizeof(packet))
|
||||
dest := ptrToSlice(incPtr(unsafe.Pointer(r.m_vecChannelsOut),int(packet.m_nChannel),
|
||||
int(unsafe.Sizeof(packet))),int(unsafe.Sizeof(*packet)))
|
||||
src := ptrToSlice(unsafe.Pointer(packet),int(unsafe.Sizeof(*packet)))
|
||||
copy(dest,src)
|
||||
C.memcpy(unsafe.Pointer(*(**C.RTMPPacket)(incPtr(unsafe.Pointer(r.m_vecChannelsOut),
|
||||
int(packet.m_nChannel), int(unsafe.Sizeof(packet))))), unsafe.Pointer(packet),
|
||||
C.size_t(uintptr(unsafe.Sizeof(*packet))))
|
||||
return 1
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue