diff --git a/servers/qemuserver/server.go b/servers/qemuserver/server.go index 798b5e6..f5f0bf8 100644 --- a/servers/qemuserver/server.go +++ b/servers/qemuserver/server.go @@ -125,6 +125,16 @@ func (s *Server) Run() error { } func (s *Server) startCapture() { + const waveHeaderSize = 16 + waveHeader := &audiodriver.WavHeader{ + Size: waveHeaderSize, + AudioFormat: 1, + NumChannels: 2, + SampleRate: 44100, + BlockAlign: 4, + BitsPerSample: 16, + } + go func() { f, err := os.Open(s.options.AudioPipe) if err != nil { @@ -134,16 +144,13 @@ func (s *Server) startCapture() { logrus.Debug("start reading from fifo") - waveHeader, err := audiodriver.NewHeader(f) - if err != nil { - logrus.Fatal(err) - } - logrus.Debug(waveHeader) s.audioHeader <- waveHeader close(s.audioHeader) // only once - // skip riff data chunk ID and size, 8 bytes - var _dataChunkHeader [audiodriver.DataChunkIDSize + audiodriver.DataChunkSizeSize]byte + // skip to pcm data, for 44 bytes. + var _dataChunkHeader [audiodriver.FmtHeaderOffset + + audiodriver.FmtHeaderIDSize + audiodriver.FmtHeaderChunkSizeSize + waveHeaderSize + + audiodriver.DataChunkIDSize + audiodriver.DataChunkSizeSize]byte if _, err := f.Read(_dataChunkHeader[:]); err != nil { logrus.Fatal(err) }