Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Memory heap issues when stopping media player #85

Open
Ruud-cb opened this issue Nov 19, 2019 · 1 comment
Open

Memory heap issues when stopping media player #85

Ruud-cb opened this issue Nov 19, 2019 · 1 comment

Comments

@Ruud-cb
Copy link

Ruud-cb commented Nov 19, 2019

C#

//Starting:

    StorageFile file = await LocalStorage.GetMediaStorageFile(item);
    if (file != null)
    {
        VlcMediaPlayer.MediaSource = VLC.MediaSource.CreateFromUri(file.Path);
        VlcMediaPlayer.Visibility = Visibility.Visible;
    }
//Stopping:
                if (VlcMediaPlayer != null && VlcMediaPlayer.MediaPlayer != null && VlcMediaPlayer.MediaSource != null && VlcMediaPlayer.MediaPlayer.canPause())
                {
                    VlcMediaPlayer.Pause();
                    VlcMediaPlayer.Stop();
                }
                VlcMediaPlayer.Source = null;
                VlcMediaPlayer.MediaSource = null;

XAML:

<vlc:MediaElement x:Name="VlcMediaPlayer"  Grid.Row="1" Grid.Column="1" AreTransportControlsEnabled="True" AutoPlay="True" Visibility="Collapsed" />

It crashes on Stop(), if I don't call that, then it crashes on VlcMediaPlayer.MediaSource = null;. If I don't call that either, it crashes on the next time I try to set the MediaSource when starting.

The exception:

Unhandled exception at 0x774CF94D (ntdll.dll) in MyApp.exe: 0xC0000374: A heap has been corrupted (parameters: 0x7750B960).

I understand that something occurs when the media player is still playing and I try to stop it or remove the source, but what is the correct way to recycle the source?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@Ruud-cb and others