<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div>Hi Mark,<br></div><div><br></div><div>Thanks for the detailed bug report. The libvlc player has been recently ported to use the new vlc player but we made a mistake here. We will work on that.<br></div><div><br></div><div>Regards,<br></div><div>Thomas<br></div><div><br></div><div>On Sun, Apr 26, 2020, at 19:03, Mark Lee wrote:<br></div><blockquote type="cite" id="qt"><div dir="ltr"><div>Hi,<br></div><div><br></div><div><div>I am trying to debug why libvlc_MediaPlayerMediaChanged events are no longer firing when changing media (latest master).<br></div><div><br></div><div>In a typical LibVLC application I would do this:<br></div><div><br></div><div>    libvlc_media_player_set_media(mp, md);<br></div><div>    libvlc_media_player_play();<br></div><div><br></div><div>The libvlc_media_player_set_media() call in lib/media_player.c does this:<br></div><div><br></div><div>    p_mi->p_md = p_md; <--- the new media reference<br></div><div><br></div><div>    vlc_player_SetCurrentMedia(p_mi->player, p_md->p_input_item);      <--- input item of the new media reference<br></div><div><br></div><div>At the end of libvlc_media_player_set_media(), it will call this method in src/player/player.c:<br></div><div><br></div><div>    vlc_player_OpenNextMedia(player);<br></div><div><br></div><div>That method will itself call:<br></div><div><br></div><div>        vlc_player_SendEvent(player, on_current_media_changed, player->media);   <--- player->media is the input item of the new media reference<br></div><div><br></div><div>Inside the on_current_media_changed() method in lib/media_player.c:<br></div><div><br></div><div>    input_item_t *media = md ? md->p_input_item : NULL;        <--- media is assigned input item of the *new* media reference, not the prior one<br></div><div>    if (new_media == media)                                      <--- always evaluates to true, both of these variables reference the input item of the new media<br></div><div>            /* no changes */<br></div><div>            return;<br></div><div>  <br></div><div>This problem is that the "media" variable already has the new value for the new media, it was set right at the start via libvlc_media_player_set_media().<br></div><div><br></div><div>So "new_media == media" always evaluates to true, the method returns early and the event never fires.<br></div><div><br></div><div>Regards,<br></div><div dir="ltr" class="qt-gmail_signature"><br></div></div><div><br></div><div>-M.<br></div></div><div>_______________________________________________<br></div><div>vlc-devel mailing list<br></div><div>To unsubscribe or modify your subscription options:<br></div><div>https://mailman.videolan.org/listinfo/vlc-devel<br></div></blockquote><div><br></div></body></html>