79799252

Date: 2025-10-25 00:14:22
Score: 0.5
Natty:
Report link

you should close stream after all chunks has been send

    // Send audio chunks in goroutine
    go func() {
        const chunkSize = 8192
        for i := 0; i < len(audioData); i += chunkSize {
            end := min(i+chunkSize, len(audioData))
            chunk := audioData[i:end]
            if err := client.SendAudio(ctx, chunk); err != nil {
                errChan <- fmt.Errorf("failed to send audio chunk: %w", err)
                return
            }
            time.Sleep(200 * time.Millisecond)
        }

        errChan <- client.stream.CloseSend()
    }()
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: igribkov