layeh / gumble

gumble is a Mumble client implementation in Go (golang)
https://pkg.go.dev/mod/layeh.com/gumble
Mozilla Public License 2.0
173 stars 53 forks source link

Audio not playing when stream status is set to StatePlaying #26

Closed matthieugrieger closed 8 years ago

matthieugrieger commented 8 years ago

Hi!

I've come across another issue. Apologies in advance if this is simply another case of me making a mistake. :)

I have been trying to get MumbleDJ to stream audio over Mumble, but I can't seem to get it to work. Here is a step-by-step outline of the steps completed prior to calling Play() on the stream:

1) Audio file is downloaded and stored on disk. I've tested that the audio file is valid by playing it in VLC, the audio works fine.

2) A new source is created via gumbleffmpeg.SourceFile().

3) Audio stream is initialized with gumbleffmpeg.New().

4) Various parameters such as Offset and Volume are set on the newly created stream.

5) Play() is called, and a goroutine is spawned that waits for the audio stream to finish.

To my knowledge this should be the correct procedure for creating and playing an audio stream, but I do not get any audio. opusthreshold is set to 0 in the server's configuration file, so that is not the issue. Another strange thing is that calling State() on the stream after calling the Play() method the state is set to StatePlaying, even though no audio is provided. Also, calling Pause() afterwards correctly sets the state to StatePaused. It seems that the stream is behaving properly besides the fact that no audio is being played.

Any ideas what is going on here? Here are some links to relevant sections of code in case they are of help:

https://github.com/matthieugrieger/mumbledj/blob/refactor/bot/queue.go#L243-L288 https://github.com/matthieugrieger/mumbledj/blob/refactor/bot/queue.go#L324-L331

Let me know if more information should be provided.

Thanks!

ghost commented 8 years ago

I don't see github.com/layeh/gumble/opus being imported in your code. Add the following to one of your files:

import (
    _ "github.com/layeh/gumble/opus"
)
matthieugrieger commented 8 years ago

Awesome, that fixed it. :)

I came across one issue though. It appears that github.com/layeh/gopus is incompatible with godep, which I use now for vendoring dependencies. If building using godep dependencies I get the following error:

# github.com/matthieugrieger/mumbledj/vendor/github.com/layeh/gopus
vendor/github.com/layeh/gopus/opus_nonshared.go:9:32: fatal error: opus-1.1.2/config.h: No such file or directory
 // #include "opus-1.1.2/config.h"
                                ^
compilation terminated.

This error does not occur when I remove the vendored dependencies and just use the ones installed on my machine in my $GOPATH.

ghost commented 8 years ago

from godep's readme:

Godep does not copy:

  • files from source repositories that are not tracked in version control.
  • *_test.go files.
  • testdata directories.
  • files outside of the go packages.

the C source files used by open_nonshared.go are not being copied. perhaps there's a godep flag to have them included?

matthieugrieger commented 8 years ago

Ah, should've checked that myself. I'll take a look and see if there is some sort of option to do that. If not I will look into an alternative way to vendor dependencies.