|
@@ -76,9 +76,17 @@ func processor(inQueue chan []byte, outQueue chan []byte) {
|
|
|
for _, chunk := range chunkBy(data, 8) {
|
|
|
var b byte = 0
|
|
|
|
|
|
- for j := 0; j < 8; j++ {
|
|
|
- if chunk[j]&1 != 0 {
|
|
|
- b |= (1 << (7 - j))
|
|
|
+ if chunk[3]&8 != 0 {
|
|
|
+ for j := 0; j < 8; j++ {
|
|
|
+ if chunk[j]&1 != 0 {
|
|
|
+ b |= (1 << j)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ for j := 0; j < 8; j++ {
|
|
|
+ if chunk[j]&1 != 0 {
|
|
|
+ b |= (1 << (7 - j))
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -88,7 +96,7 @@ func processor(inQueue chan []byte, outQueue chan []byte) {
|
|
|
data = newData
|
|
|
|
|
|
newData = []byte{}
|
|
|
- for _, chunk := range chunkBy(data, 32) {
|
|
|
+ for _, chunk := range chunkBy(data, 64) {
|
|
|
sum := blake2b.Sum256(chunk)
|
|
|
|
|
|
newData = append(newData, sum[:]...)
|
|
@@ -101,15 +109,11 @@ func processor(inQueue chan []byte, outQueue chan []byte) {
|
|
|
func main() {
|
|
|
var deviceName string
|
|
|
var bufferSize uint
|
|
|
- var processorsCount uint
|
|
|
- var sendersCount uint
|
|
|
var ident string
|
|
|
var secret string
|
|
|
|
|
|
flag.StringVar(&deviceName, "device", "/dev/video0", "v4l2 device to capture from")
|
|
|
flag.UintVar(&bufferSize, "bufferSize", 1024, "sending queue max capacity")
|
|
|
- flag.UintVar(&processorsCount, "processorsCount", 1, "count of processor goroutines")
|
|
|
- flag.UintVar(&sendersCount, "sendersCount", 1, "count of sender goroutines")
|
|
|
flag.StringVar(&ident, "ident", "", "yebi.su ident")
|
|
|
flag.StringVar(&secret, "secret", "", "yebi.su secret")
|
|
|
|
|
@@ -154,13 +158,8 @@ func main() {
|
|
|
defer close(processorQueue)
|
|
|
defer close(senderQueue)
|
|
|
|
|
|
- for i := 0; i < int(sendersCount); i++ {
|
|
|
- go sender(senderQueue, secret)
|
|
|
- }
|
|
|
-
|
|
|
- for i := 0; i < int(processorsCount); i++ {
|
|
|
- go processor(processorQueue, senderQueue)
|
|
|
- }
|
|
|
+ go processor(processorQueue, senderQueue)
|
|
|
+ go sender(senderQueue, secret)
|
|
|
|
|
|
log.Println("start recording")
|
|
|
|