Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes the media is not displayed #681

Open
Agostino44 opened this issue Jan 20, 2025 · 0 comments
Open

Sometimes the media is not displayed #681

Agostino44 opened this issue Jan 20, 2025 · 0 comments

Comments

@Agostino44
Copy link

Agostino44 commented Jan 20, 2025

Good morning,
in my application i am using version ffme 7.0.360-b1. My application allows the user to play various media files, which can be videos or gifs.
Every time the user plays a media, I stop and close the currently playing file

public void StopProgramAsync(bool close)
{
    Media.MediaEnded -= media_MediaEnded;
    if (t != null)
    {
        t.Stop();
    }
    StopAsync();

    if (close)
        CloseAsync();
}
public async void StopAsync()
{
    if (Media.Source != null)
        await Media.Stop();
}
public async void CloseAsync()
{
    await Media.Close();
}

and then open and play the new file.

if (File.Exists(file_media))
 {
     await Media.Open(new Uri(file_media));
TimeSpan start_time = TimeSpan.Zero;
if (Media_Prog.CutStart)
    start_time = TimeSpan.FromSeconds(Media_Prog.CutStartSeconds);
if (Media_Prog != null && Media_Prog.CutStart)
{
    start_time = TimeSpan.FromSeconds(Media_Prog.CutStartSeconds);
}

await Media.Seek(start_time);

await Media.Play();   
 if (Media_Prog.CutEnd && Media_Prog.CutEndSeconds > 0)
    {
        t = new System.Timers.Timer((Media_Prog.CutEndSeconds - Media_Prog.CutStartSeconds) * 1000);
        t.Elapsed += T_Elapsed;
        t.AutoReset = false;
        t.Start();
    }
    else if(Executions > 0)
    {
        Media.MediaEnded += media_MediaEnded;
    }
}

the problem is that sometines, especially when play a gif (in rarer cases also with videos), after play nothing is displayed.
I have capture the log in case when media is displayed correctly:

EVENT START: MediaStateChanged
Direct Command 'Close' not accepted. Open media before closing or changing media.
Direct Command 'Open' accepted. Perparing execution.
Direct Command 'Close' entered
Direct Command 'Open' entered
Library.LoadFFmpeg: FFmpeg v7.1-full_build-www.gyan.dev
EVENT DONE : MediaStateChanged
Direct Command 'Close' not accepted. Close command is pending completion.
VIDEO - Start Time: 0.000; Duration: 1.000
EVENT START: MediaStateChanged
Direct Command 'Open' completed. Result: True
EVENT START: MediaStateChanged
EVENT START: SeekingStarted
EVENT DONE : MediaStateChanged
EVENT START: MediaOpened
EVENT DONE : MediaOpened
EVENT START: MediaReady
EVENT DONE : MediaReady
EVENT DONE : MediaStateChanged
EVENT DONE : SeekingStarted
Dispose Entered. Waiting for Command Manager processor to stop.
Dispose is waiting for pending direct commands.
EVENT START: BufferingStarted
EVENT START: MediaStateChanged
EVENT START: MediaClosed
Unmanaged references are still alive. If there are no further media container instances to be disposed,
this is an indication that there is a memory leak. Otherwise, this message can be ignored.
Packet - MediaPacket.cs; Line: 83, Member: CreateReadPacket - Instances: 1
CodecContext - MediaComponent.cs; Line: 78, Member: .ctor - Instances: 1

Direct Command 'Close' completed. Result: True
Dispose is closing media.
EVENT START: MediaClosed
EVENT DONE : MediaClosed
Unmanaged references are still alive. If there are no further media container instances to be disposed,
this is an indication that there is a memory leak. Otherwise, this message can be ignored.
Packet - MediaPacket.cs; Line: 83, Member: CreateReadPacket - Instances: 1
CodecContext - MediaComponent.cs; Line: 78, Member: .ctor - Instances: 1

Dispose completed.
EVENT DONE : BufferingStarted
EVENT DONE : MediaStateChanged
EVENT DONE : MediaClosed
SEEK D: Elapsed: 33 | Target: 0.000
V BLK: 0.000 | CLK: 0.000 | DFT: 0 | IX: 0 | RNG: 0.00% | PQ: 0.0k | TQ: 0.0k
EVENT START: MediaStateChanged
EVENT START: SeekingEnded
EVENT START: BufferingEnded
EVENT DONE : MediaStateChanged
EVENT DONE : SeekingEnded
EVENT DONE : BufferingEnded
EVENT START: MediaStateChanged
EVENT DONE : MediaStateChanged
V BLK: 0.040 | CLK: 0.058 | DFT: 18 | IX: 1 | RNG: 18.19% | PQ: 1492.7k | TQ: 1492.7k
V BLK: 0.080 | CLK: 0.092 | DFT: 12 | IX: 2 | RNG: 28.62% | PQ: 1492.7k | TQ: 1492.7k
V BLK: 0.120 | CLK: 0.125 | DFT: 5 | IX: 3 | RNG: 39.04% | PQ: 1492.7k | TQ: 1492.7k
V BLK: 0.160 | CLK: 0.192 | DFT: 32 | IX: 3 | RNG: 47.39% | PQ: 1402.5k | TQ: 1402.5k
V BLK: 0.200 | CLK: 0.225 | DFT: 25 | IX: 3 | RNG: 45.31% | PQ: 1312.4k | TQ: 1312.4k
V BLK: 0.240 | CLK: 0.258 | DFT: 18 | IX: 3 | RNG: 43.20% | PQ: 1222.3k | TQ: 1222.3k
V BLK: 0.280 | CLK: 0.292 | DFT: 12 | IX: 4 | RNG: 53.64% | PQ: 1222.3k | TQ: 1222.3k
V BLK: 0.320 | CLK: 0.325 | DFT: 5 | IX: 4 | RNG: 51.56% | PQ: 1132.5k | TQ: 1132.5k
V BLK: 0.360 | CLK: 0.392 | DFT: 32 | IX: 3 | RNG: 47.41% | PQ: 954.0k | TQ: 954.0k
V BLK: 0.400 | CLK: 0.425 | DFT: 25 | IX: 3 | RNG: 45.32% | PQ: 865.4k | TQ: 865.4k
V BLK: 0.440 | CLK: 0.458 | DFT: 18 | IX: 3 | RNG: 43.25% | PQ: 778.1k | TQ: 778.1k
V BLK: 0.480 | CLK: 0.492 | DFT: 12 | IX: 3 | RNG: 41.17% | PQ: 691.8k | TQ: 691.8k
V BLK: 0.520 | CLK: 0.525 | DFT: 5 | IX: 4 | RNG: 51.59% | PQ: 691.8k | TQ: 691.8k
V BLK: 0.560 | CLK: 0.592 | DFT: 32 | IX: 3 | RNG: 47.43% | PQ: 520.1k | TQ: 520.1k
V BLK: 0.600 | CLK: 0.625 | DFT: 25 | IX: 3 | RNG: 45.36% | PQ: 434.0k | TQ: 434.0k
V BLK: 0.640 | CLK: 0.659 | DFT: 19 | IX: 3 | RNG: 43.31% | PQ: 347.2k | TQ: 347.2k
V BLK: 0.680 | CLK: 0.692 | DFT: 12 | IX: 4 | RNG: 53.69% | PQ: 347.2k | TQ: 347.2k
V BLK: 0.720 | CLK: 0.725 | DFT: 5 | IX: 4 | RNG: 51.60% | PQ: 260.3k | TQ: 260.3k
V BLK: 0.760 | CLK: 0.775 | DFT: 15 | IX: 3 | RNG: 42.25% | PQ: 86.9k | TQ: 86.9k
V BLK: 0.800 | CLK: 0.809 | DFT: 9 | IX: 3 | RNG: 40.16% | PQ: 0.0k | TQ: 0.0k
V BLK: 0.840 | CLK: 0.842 | DFT: 2 | IX: 4 | RNG: 50.58% | PQ: 0.0k | TQ: 0.0k
V BLK: 0.880 | CLK: 0.908 | DFT: 28 | IX: 5 | RNG: 71.40% | PQ: 0.0k | TQ: 0.0k
V BLK: 0.920 | CLK: 0.942 | DFT: 22 | IX: 6 | RNG: 81.89% | PQ: 0.0k | TQ: 0.0k
V BLK: 0.960 | CLK: 0.975 | DFT: 15 | IX: 7 | RNG: 92.26% | PQ: 0.0k | TQ: 0.0k
CLOCK AHEAD : playback clock was 1.009. It was updated to 1.000
V BLK: 0.960 | CLK: 1.000 | DFT: 40 | IX: 7 | RNG: 100.00% | PQ: 0.0k | TQ: 0.0k
EVENT START: MediaStateChanged
EVENT DONE : MediaStateChanged
EVENT START: MediaEnded
EVENT DONE : MediaEnded


and the following is the log when media is not displayed:

Direct Command 'Close' not accepted. Open media before closing or changing media.
Direct Command 'Open' accepted. Perparing execution.
V BLK: 1.867 | CLK: 1.867 | DFT: 0 | IX: 0 | RNG: 0.00% | PQ: 0.0k | TQ: 0.0k
Direct Command 'Close' entered
Direct Command 'Open' entered
Library.LoadFFmpeg: FFmpeg v7.1-full_build-www.gyan.dev
VIDEO - Start Time: 0.000; Duration: 1.000
EVENT START: MediaStateChanged
Direct Command 'Open' completed. Result: True
EVENT START: BufferingStarted
EVENT START: BufferingEnded
V BLK: 0.000 | CLK: 0.000 | DFT: 0 | IX: 0 | RNG: 0.00% | PQ: 1582.9k | TQ: 1582.9k
EVENT START: MediaStateChanged
EVENT START: SeekingStarted
EVENT DONE : MediaStateChanged
EVENT DONE : MediaStateChanged
EVENT START: MediaOpened
EVENT DONE : MediaOpened
EVENT START: MediaReady
EVENT DONE : MediaReady
EVENT DONE : BufferingStarted
EVENT DONE : BufferingEnded
EVENT DONE : MediaStateChanged
EVENT DONE : SeekingStarted
Direct Command 'Close' not accepted. Close command is pending completion.
EVENT START: MediaStateChanged
EVENT START: SeekingEnded
EVENT START: MediaStateChanged
EVENT START: MediaClosed
Unmanaged references are still alive. If there are no further media container instances to be disposed,
this is an indication that there is a memory leak. Otherwise, this message can be ignored.
Packet - MediaPacket.cs; Line: 83, Member: CreateReadPacket - Instances: 17
CodecContext - MediaComponent.cs; Line: 78, Member: .ctor - Instances: 1
Packet - MediaPacket.cs; Line: 98, Member: CreateEmptyPacket - Instances: 1
SwsContext - VideoComponent.cs; Line: 231, Member: MaterializeFrame - Instances: 1

Direct Command 'Close' completed. Result: True
V BLK: 0.000 | CLK: 0.000 | DFT: 0 | IX: 0 | RNG: 0.00% | PQ: 1492.7k | TQ: 1492.7k
EVENT DONE : MediaStateChanged
EVENT DONE : SeekingEnded
EVENT DONE : MediaStateChanged
EVENT DONE : MediaClosed
Dispose Entered. Waiting for Command Manager processor to stop.
Dispose is waiting for pending direct commands.
Dispose is closing media.
EVENT START: MediaClosed
EVENT DONE : MediaClosed
Unmanaged references are still alive. If there are no further media container instances to be disposed,
this is an indication that there is a memory leak. Otherwise, this message can be ignored.
Packet - MediaPacket.cs; Line: 83, Member: CreateReadPacket - Instances: 17
CodecContext - MediaComponent.cs; Line: 78, Member: .ctor - Instances: 1
Packet - MediaPacket.cs; Line: 98, Member: CreateEmptyPacket - Instances: 1
SwsContext - VideoComponent.cs; Line: 231, Member: MaterializeFrame - Instances: 1

Dispose completed.
EVENT START: MediaStateChanged
EVENT DONE : MediaStateChanged
VideoRenderer frame skipped at 00:00:00.0400000
V BLK: 0.040 | CLK: 0.064 | DFT: 24 | IX: 1 | RNG: 20.08% | PQ: 1492.7k | TQ: 1492.7k
VideoRenderer frame skipped at 00:00:00.0800000
V BLK: 0.080 | CLK: 0.098 | DFT: 18 | IX: 2 | RNG: 30.49% | PQ: 1492.7k | TQ: 1492.7k
VideoRenderer frame skipped at 00:00:00.1200000
V BLK: 0.120 | CLK: 0.131 | DFT: 11 | IX: 3 | RNG: 40.91% | PQ: 1492.7k | TQ: 1492.7k
VideoRenderer frame skipped at 00:00:00.1600000
V BLK: 0.160 | CLK: 0.164 | DFT: 4 | IX: 4 | RNG: 51.32% | PQ: 1492.7k | TQ: 1492.7k
VideoRenderer frame skipped at 00:00:00.2000000
V BLK: 0.200 | CLK: 0.231 | DFT: 31 | IX: 3 | RNG: 47.16% | PQ: 1312.4k | TQ: 1312.4k
VideoRenderer frame skipped at 00:00:00.2400000
V BLK: 0.240 | CLK: 0.264 | DFT: 24 | IX: 3 | RNG: 45.08% | PQ: 1222.3k | TQ: 1222.3k
VideoRenderer frame skipped at 00:00:00.2800000
V BLK: 0.280 | CLK: 0.298 | DFT: 18 | IX: 3 | RNG: 43.11% | PQ: 1132.5k | TQ: 1132.5k
VideoRenderer frame skipped at 00:00:00.3200000
V BLK: 0.320 | CLK: 0.331 | DFT: 11 | IX: 3 | RNG: 40.93% | PQ: 1042.8k | TQ: 1042.8k
VideoRenderer frame skipped at 00:00:00.3600000
V BLK: 0.360 | CLK: 0.364 | DFT: 4 | IX: 3 | RNG: 38.88% | PQ: 954.0k | TQ: 954.0k
VideoRenderer frame skipped at 00:00:00.4000000
V BLK: 0.400 | CLK: 0.431 | DFT: 31 | IX: 3 | RNG: 47.19% | PQ: 865.4k | TQ: 865.4k
VideoRenderer frame skipped at 00:00:00.4400000
V BLK: 0.440 | CLK: 0.464 | DFT: 24 | IX: 3 | RNG: 45.12% | PQ: 778.1k | TQ: 778.1k
VideoRenderer frame skipped at 00:00:00.4800000
V BLK: 0.480 | CLK: 0.498 | DFT: 18 | IX: 3 | RNG: 43.03% | PQ: 691.8k | TQ: 691.8k
VideoRenderer frame skipped at 00:00:00.5200000
V BLK: 0.520 | CLK: 0.531 | DFT: 11 | IX: 3 | RNG: 40.96% | PQ: 605.8k | TQ: 605.8k
VideoRenderer frame skipped at 00:00:00.5600000
V BLK: 0.560 | CLK: 0.564 | DFT: 4 | IX: 4 | RNG: 51.38% | PQ: 605.8k | TQ: 605.8k
VideoRenderer frame skipped at 00:00:00.6000000
V BLK: 0.600 | CLK: 0.631 | DFT: 31 | IX: 3 | RNG: 47.22% | PQ: 434.0k | TQ: 434.0k
VideoRenderer frame skipped at 00:00:00.6400000
V BLK: 0.640 | CLK: 0.664 | DFT: 24 | IX: 3 | RNG: 45.14% | PQ: 347.2k | TQ: 347.2k
VideoRenderer frame skipped at 00:00:00.6800000
V BLK: 0.680 | CLK: 0.698 | DFT: 18 | IX: 3 | RNG: 43.06% | PQ: 260.3k | TQ: 260.3k
VideoRenderer frame skipped at 00:00:00.7200000
V BLK: 0.720 | CLK: 0.731 | DFT: 11 | IX: 4 | RNG: 53.47% | PQ: 260.3k | TQ: 260.3k
VideoRenderer frame skipped at 00:00:00.7600000
V BLK: 0.760 | CLK: 0.764 | DFT: 4 | IX: 3 | RNG: 38.89% | PQ: 86.9k | TQ: 86.9k
VideoRenderer frame skipped at 00:00:00.8000000
V BLK: 0.800 | CLK: 0.831 | DFT: 31 | IX: 3 | RNG: 47.24% | PQ: 0.0k | TQ: 0.0k
VideoRenderer frame skipped at 00:00:00.8400000
V BLK: 0.840 | CLK: 0.865 | DFT: 25 | IX: 4 | RNG: 57.66% | PQ: 0.0k | TQ: 0.0k
VideoRenderer frame skipped at 00:00:00.8800000
V BLK: 0.880 | CLK: 0.898 | DFT: 18 | IX: 5 | RNG: 68.12% | PQ: 0.0k | TQ: 0.0k
VideoRenderer frame skipped at 00:00:00.9200000
V BLK: 0.920 | CLK: 0.931 | DFT: 11 | IX: 6 | RNG: 78.49% | PQ: 0.0k | TQ: 0.0k
VideoRenderer frame skipped at 00:00:00.9600000
V BLK: 0.960 | CLK: 0.965 | DFT: 5 | IX: 7 | RNG: 88.93% | PQ: 0.0k | TQ: 0.0k
CLOCK AHEAD : playback clock was 1.015. It was updated to 1.000
V BLK: 0.960 | CLK: 1.000 | DFT: 40 | IX: 7 | RNG: 100.00% | PQ: 0.0k | TQ: 0.0k
EVENT START: MediaStateChanged
EVENT DONE : MediaStateChanged
EVENT START: MediaEnded
EVENT DONE : MediaEnded


the engine seems to be in run, but when the media is not displayed there are log messages "VideoRenderer frame skipped at ..."

Do you have any suggestions on what it could be?

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

No branches or pull requests

1 participant