feat: Waku v2 bridge

Issue #12610
This commit is contained in:
Michal Iskierko
2023-11-12 13:29:38 +01:00
parent 56e7bd01ca
commit 6d31343205
6716 changed files with 1982502 additions and 5891 deletions

View File

@@ -0,0 +1,29 @@
package audio
import (
"github.com/status-im/status-go/protocol/protobuf"
)
func aac(buf []byte) bool {
return len(buf) > 1 &&
((buf[0] == 0xFF && buf[1] == 0xF1) ||
(buf[0] == 0xFF && buf[1] == 0xF9))
}
func amr(buf []byte) bool {
return len(buf) > 11 &&
buf[0] == 0x23 && buf[1] == 0x21 &&
buf[2] == 0x41 && buf[3] == 0x4D &&
buf[4] == 0x52 && buf[5] == 0x0A
}
func Type(buf []byte) protobuf.AudioMessage_AudioType {
switch {
case aac(buf):
return protobuf.AudioMessage_AAC
case amr(buf):
return protobuf.AudioMessage_AMR
default:
return protobuf.AudioMessage_UNKNOWN_AUDIO_TYPE
}
}