debug needed
This commit is contained in:
parent
18f5d649d1
commit
39a89b80e2
@ -125,6 +125,16 @@ func (s *Server) Run() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) startCapture() {
|
func (s *Server) startCapture() {
|
||||||
|
const waveHeaderSize = 16
|
||||||
|
waveHeader := &audiodriver.WavHeader{
|
||||||
|
Size: waveHeaderSize,
|
||||||
|
AudioFormat: 1,
|
||||||
|
NumChannels: 2,
|
||||||
|
SampleRate: 44100,
|
||||||
|
BlockAlign: 4,
|
||||||
|
BitsPerSample: 16,
|
||||||
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
f, err := os.Open(s.options.AudioPipe)
|
f, err := os.Open(s.options.AudioPipe)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -134,16 +144,13 @@ func (s *Server) startCapture() {
|
|||||||
|
|
||||||
logrus.Debug("start reading from fifo")
|
logrus.Debug("start reading from fifo")
|
||||||
|
|
||||||
waveHeader, err := audiodriver.NewHeader(f)
|
|
||||||
if err != nil {
|
|
||||||
logrus.Fatal(err)
|
|
||||||
}
|
|
||||||
logrus.Debug(waveHeader)
|
|
||||||
s.audioHeader <- waveHeader
|
s.audioHeader <- waveHeader
|
||||||
close(s.audioHeader) // only once
|
close(s.audioHeader) // only once
|
||||||
|
|
||||||
// skip riff data chunk ID and size, 8 bytes
|
// skip to pcm data, for 44 bytes.
|
||||||
var _dataChunkHeader [audiodriver.DataChunkIDSize + audiodriver.DataChunkSizeSize]byte
|
var _dataChunkHeader [audiodriver.FmtHeaderOffset +
|
||||||
|
audiodriver.FmtHeaderIDSize + audiodriver.FmtHeaderChunkSizeSize + waveHeaderSize +
|
||||||
|
audiodriver.DataChunkIDSize + audiodriver.DataChunkSizeSize]byte
|
||||||
if _, err := f.Read(_dataChunkHeader[:]); err != nil {
|
if _, err := f.Read(_dataChunkHeader[:]); err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user