Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion accept.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package srtgo

/*
#cgo LDFLAGS: -lsrt
#include <srt/srt.h>

SRTSOCKET srt_accept_wrapped(SRTSOCKET lsn, struct sockaddr* addr, int* addrlen, int *srterror, int *syserror)
Expand Down
1 change: 0 additions & 1 deletion callback_c.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package srtgo

/*
#cgo LDFLAGS: -lsrt
#include "callback.h"

int srtListenCB(void* opaque, SRTSOCKET ns, int hs_version, const struct sockaddr* peeraddr, const char* streamid)
Expand Down
11 changes: 5 additions & 6 deletions errors.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package srtgo

/*
#cgo LDFLAGS: -lsrt
#include <srt/srt.h>
*/
import "C"
Expand Down Expand Up @@ -54,7 +53,7 @@ func (m *SrtEpollTimeout) Temporary() bool {
return true
}

//MUST be called from same OS thread that generated the error (i.e.: use runtime.LockOSThread())
// MUST be called from same OS thread that generated the error (i.e.: use runtime.LockOSThread())
func srtGetAndClearError() error {
defer C.srt_clearlasterror()
eSysErrno := C.int(0)
Expand All @@ -66,7 +65,7 @@ func srtGetAndClearError() error {
return srterr
}

//Based of off golang errno handling: https://cs.opensource.google/go/go/+/refs/tags/go1.16.6:src/syscall/syscall_unix.go;l=114
// Based of off golang errno handling: https://cs.opensource.google/go/go/+/refs/tags/go1.16.6:src/syscall/syscall_unix.go;l=114
type SRTErrno int

func (e SRTErrno) Error() string {
Expand Down Expand Up @@ -142,7 +141,7 @@ func (e *srtErrnoSysErrnoWrapped) Unwrap() error {
return error(e.eSys)
}

//Shadows SRT_ERRNO srtcore/srt.h line 490+
// Shadows SRT_ERRNO srtcore/srt.h line 490+
const (
Unknown = SRTErrno(C.SRT_EUNKNOWN)
Success = SRTErrno(C.SRT_SUCCESS)
Expand Down Expand Up @@ -195,8 +194,8 @@ const (
EPeer = SRTErrno(C.SRT_EPEERERR)
)

//Unknown cannot be here since it would have a negative index!
//Error strings taken from: https://github.com/Haivision/srt/blob/master/docs/API/API-functions.md
// Unknown cannot be here since it would have a negative index!
// Error strings taken from: https://github.com/Haivision/srt/blob/master/docs/API/API-functions.md
var srterrors = [...]string{
Success: "The value set when the last error was cleared and no error has occurred since then",
EConnSetup: "General setup error resulting from internal system state",
Expand Down
1 change: 0 additions & 1 deletion examples/echo-receiver/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package main

// #cgo LDFLAGS: -lsrt
// #include <srt/srt.h>
import "C"

Expand Down
1 change: 0 additions & 1 deletion logging.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package srtgo

/*
#cgo LDFLAGS: -lsrt
#include <srt/srt.h>
extern void srtLogCB(void* opaque, int level, const char* file, int line, const char* area, const char* message);
*/
Expand Down
1 change: 0 additions & 1 deletion logging_c.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package srtgo

/*
#cgo LDFLAGS: -lsrt
#include <srt/srt.h>

extern void srtLogCBWrapper (void* opaque, int level, char* file, int line, char* area, char* message);
Expand Down
17 changes: 8 additions & 9 deletions poll.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package srtgo

/*
#cgo LDFLAGS: -lsrt
#include <srt/srt.h>
*/
import "C"
Expand All @@ -25,14 +24,14 @@ const (
)

/*
pollDesc contains the polling state for the associated SrtSocket
closing: socket is closing, reject all poll operations
pollErr: an error occured on the socket, indicates it's not useable anymore.
unblockRd: is used to unblock the poller when the socket becomes ready for io
rdState: polling state for read operations
rdDeadline: deadline in NS before poll operation times out, -1 means timedout (needs to be cleared), 0 is without timeout
rdSeq: sequence number protects against spurious signalling of timeouts when timer is reset.
rdTimer: timer used to enforce deadline.
pollDesc contains the polling state for the associated SrtSocket
closing: socket is closing, reject all poll operations
pollErr: an error occured on the socket, indicates it's not useable anymore.
unblockRd: is used to unblock the poller when the socket becomes ready for io
rdState: polling state for read operations
rdDeadline: deadline in NS before poll operation times out, -1 means timedout (needs to be cleared), 0 is without timeout
rdSeq: sequence number protects against spurious signalling of timeouts when timer is reset.
rdTimer: timer used to enforce deadline.
*/
type pollDesc struct {
lock sync.Mutex
Expand Down
1 change: 0 additions & 1 deletion pollserver.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package srtgo

/*
#cgo LDFLAGS: -lsrt
#include <srt/srt.h>
*/
import "C"
Expand Down
1 change: 0 additions & 1 deletion read.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package srtgo

/*
#cgo LDFLAGS: -lsrt
#include <srt/srt.h>

int srt_recvmsg2_wrapped(SRTSOCKET u, char* buf, int len, SRT_MSGCTRL *mctrl, int *srterror, int *syserror)
Expand Down
2 changes: 1 addition & 1 deletion srtgo.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package srtgo

/*
#cgo LDFLAGS: -lsrt
#cgo pkg-config: srt
#include <srt/srt.h>
#include <srt/access_control.h>
#include "callback.h"
Expand Down
1 change: 0 additions & 1 deletion srtsocketoptions.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package srtgo

// #cgo LDFLAGS: -lsrt
// #include <srt/srt.h>
import "C"

Expand Down
1 change: 0 additions & 1 deletion srtstats.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package srtgo

// #cgo LDFLAGS: -lsrt
// #include <srt/srt.h>
import "C"

Expand Down
1 change: 0 additions & 1 deletion write.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package srtgo

/*
#cgo LDFLAGS: -lsrt
#include <srt/srt.h>

int srt_sendmsg2_wrapped(SRTSOCKET u, const char* buf, int len, SRT_MSGCTRL *mctrl, int *srterror, int *syserror)
Expand Down