[vlc-devel] Fixed crash when getting statistics on uninitialized media
Jérémy VIGNELLES
jeremy.vignelles at dev3i.fr
Wed Oct 18 10:57:59 CEST 2017
I had a segfault when getting the statistics of the media when it haven't started to play.
Sure, it is a bad usage, but the point is that it shouldn't crash the app.
Examle code:
```
#include <stdio.h>
#include <unistd.h>
#include <vlc/vlc.h>
int main() {
libvlc_instance_t * inst = libvlc_new (0, NULL);
libvlc_media_player_t* player = libvlc_media_player_new(inst);
libvlc_media_t* media = libvlc_media_new_location(inst, "http://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_480p_h264.mov");
libvlc_media_player_set_media(player, media);
libvlc_media_stats_t stats;
libvlc_media_get_stats(media, &stats); // Was crashing
libvlc_media_player_play(player);
sleep(1);
libvlc_media_get_stats(media, &stats); // Was sometimes crashing, but worked most of the time
libvlc_media_release(media);
sleep(10);
libvlc_media_player_release(player);
libvlc_release(inst);
return 0;
}
```
The original issue is in powershell, which reads all the properties of the VlcMedia exposed by Vlc.DotNet, and notably the Statistics property.
See here for curiosity: https://github.com/ZeBobo5/Vlc.DotNet/issues/330
More information about the vlc-devel
mailing list