ravachol / kew

A command-line music player
GNU General Public License v2.0
567 stars 21 forks source link

bug: unexpected audio behaviour and compilation #148

Closed spambroo closed 1 month ago

spambroo commented 1 month ago

I have cloned this repo and used 'make' cmd during that it shows,


In file included from src/soundcommon.h:10,
                 from src/songloader.h:10,
                 from src/sound.h:16,
                 from src/songloader.h:9,
                 from src/playlist_ui.h:5,
                 from src/player.h:13,
                 from src/playerops.h:7,
                 from src/mpris.h:6,
                 from src/sound.c:6:
src/m4a.h: In function ‘m4a_decoder_init_file’:
src/m4a.h:325:92: warning: passing argument 5 of ‘av_find_best_stream’ from incompatible pointer type [-Wincompatible-pointer-types]
  325 | d_best_stream(format_context, AVMEDIA_TYPE_AUDIO, -1, -1, &decoder, 0);
      |                                                           ^~~~~~~~
      |                                                           |
      |                                                           const AVCodec **

In file included from src/m4a.h:20,
                 from src/soundcommon.h:10,
                 from src/songloader.h:10,
                 from src/sound.h:16,
                 from src/songloader.h:9,
                 from src/playlist_ui.h:5,
                 from src/player.h:13,
                 from src/playerops.h:7,
                 from src/mpris.h:6,
                 from src/sound.c:6:
/usr/include/x86_64-linux-gnu/libavformat/avformat.h:2301:35: note: expected AVCodec **’ but argument is of type ‘const AVCodec **’
 2301 |                         AVCodec **decoder_ret,
      |                         ~~~~~~~~~~^~~~~~~~~~~
In file included from src/sound.c:5:
include/miniaudio/miniaudio.h: In function ‘ma_resource_manager_data_stream_fill_page’:
include/miniaudio/miniaudio.h:69727:9: warning: ‘rangeBeg’ may be used uninitialized [-Wmaybe-uninitialized]
69727 |         ma_data_source_set_range_in_pcm_frames(&pDataStream->decoder, rangeBeg, rangeEnd);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/miniaudio/miniaudio.h:69727:9: warning: ‘rangeEnd’ may be used uninitialized [-Wmaybe-uninitialized]
include/miniaudio/miniaudio.h:69730:9: warning: ‘loopPointEnd’ may be used uninitialized in this function [-Wmaybe-uninitialized]
69730 |         ma_data_source_set_loop_point_in_pcm_frames(&pDataStream->decoder, loopPointBeg, loopPointEnd);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/miniaudio/miniaudio.h:69730:9: warning: ‘loopPointBeg’ may be used uninitialized in this function [-Wmaybe-uninitialized]
gcc -I/usr/include -I/usr/include/ogg -I/usr/include/opus -I/usr/include/stb -Iinclude/imgtotxt/ext -Iinclude/imgtotxt -I/usr/include/ffmpeg -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -Iinclude/miniaudio -I/usr/include/gdk-pixbuf-2.0 -O1 -pthread ```

but the compilation finally over... it starts to play well but after 20secs the audio starts to buffer.... (even after i have installed all the dependencies)

my system:
Ubuntu 22.04 LTS  WSL
ravachol commented 1 month ago

Thank you for this report, I will look into it.

spambroo commented 1 month ago

one thing i have to mention here,

when i installed kew through sudo bash -c "curl https://raw.githubusercontent.com/ravachol/kew/main/install.sh | bash"

it starts to play well but after 20secs the audio starts to buffer

but when i cloned the repo and installed through 'sudo make install'

it shows those my previously mentioned compilation warnings and when i starts to play it shows segmentation fault

image

ravachol commented 1 month ago

man that sucks. what version of ffmpeg do you have?

ravachol commented 1 month ago

If you run: ffmpeg -version dpkg -l | grep libavformat-dev

ravachol commented 1 month ago

The thing is that function signature should be only in version 4.4 of ffmpeg and earlier, so it's weird because you should be on a much later version.

spambroo commented 1 month ago

ffmpeg -version ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers built with gcc 11 (Ubuntu 11.2.0-19ubuntu1) configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared libavutil 56. 70.100 / 56. 70.100 libavcodec 58.134.100 / 58.134.100 libavformat 58. 76.100 / 58. 76.100 libavdevice 58. 13.100 / 58. 13.100 libavfilter 7.110.100 / 7.110.100 libswscale 5. 9.100 / 5. 9.100 libswresample 3. 9.100 / 3. 9.100 libpostproc 55. 9.100 / 55. 9.100 ~ ❯ dpkg -l | grep libavformat-dev ii libavformat-dev:amd64 7:4.4.2-0ubuntu0.22.04.1 amd64 FFmpeg library with (de)muxers for multimedia containers - development files ~

spambroo commented 1 month ago

i have just used the cmd from your docs to install dependencies....

could you provide proper versions of those dependencies..... with cmd for that

ravachol commented 1 month ago

I think I fixed it.

Yeah, so ubuntu 24.04.4 LTS is running ffmpeg 4.4, but ffmpeg is at version 7.

However if you grab the latest kew from the main branch it should work on your version of ffmpeg.

ravachol commented 1 month ago

Please let me know if it doesn't.

spambroo commented 1 month ago

when i compiled latest version of this repo again using 'make'

this warnings appears

In file included from src/sound.c:5:
include/miniaudio/miniaudio.h: In function ‘ma_resource_manager_data_stream_fill_page’:
include/miniaudio/miniaudio.h:69727:9: warning: ‘rangeBeg’ may be used uninitialized [-Wmaybe-uninitialized]
69727 |         ma_data_source_set_range_in_pcm_frames(&pDataStream->decoder, rangeBeg, rangeEnd);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/miniaudio/miniaudio.h:69727:9: warning: ‘rangeEnd’ may be used uninitialized [-Wmaybe-uninitialized]
include/miniaudio/miniaudio.h:69730:9: warning: ‘loopPointEnd’ may be used uninitialized in this function [-Wmaybe-uninitialized]
69730 |         ma_data_source_set_loop_point_in_pcm_frames(&pDataStream->decoder, loopPointBeg, loopPointEnd);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/miniaudio/miniaudio.h:69730:9: warning: ‘loopPointBeg’ may be used uninitialized in this function [-Wmaybe-uninitialized]
gcc -I/usr/include -I/usr/include/ogg -I/usr/include/opus -I/usr/include/stb -Iinclude/imgtotxt/ext -Iinclude/imgtotxt

when i tried to play a song segmentation fault appears as i previously mentioned with an image

ravachol commented 1 month ago

Those warnings shouldn't matter. The segfault does however.

ravachol commented 1 month ago

I see now that Ubuntu 24.04 has a kew version of 2.4.2. Maybe that is the latest version you can run. I don't know the details of why they didn't make a later version.

https://repology.org/project/kew/versions

ravachol commented 1 month ago

I tried installing kew 2.6 on Ubuntu 24.04 LTS and it worked, I couldn't reproduce the segfault. What kind of music file are you trying to play?

spambroo commented 1 month ago

its .mp3 file embedded with cover image..... and can we continue this conversation in discussions. ??

ravachol commented 1 month ago

sure. closing this.