Skip to content

Commit

Permalink
Updates to v3.7.25 (FlyleafLib) / v1.2.27 (FlyleafME) / v1.0.13 (Flyl…
Browse files Browse the repository at this point in the history
…eafHost.WinUI)

- AudioDecoder: Minor adjustment for audio/video sync to provide samples 50ms earlier than video
- Player: Minor log level adjustments
- Renderer: Fixes an issue with aspect ratio when announced by video stream
- Renderer: Fixes an issue with negative linesize and vertical flipping (it wouldn't reset in new inputs)
- VideoDecoder: Fixes an issue during software fallback. It would jump to the next keyframe (it wouldn't start from the beginning of the video)
  • Loading branch information
SuRGeoNix committed Sep 29, 2023
1 parent afa6f0f commit fd43b69
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 34 deletions.
2 changes: 1 addition & 1 deletion FlyleafLib.Controls.WPF/FlyleafLib.Controls.WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net7.0-windows;net6.0-windows;net472</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF>
<Version>1.2.26</Version>
<Version>1.2.27</Version>
<Authors>SuRGeoNix</Authors>
<Copyright>SuRGeoNix © 2023</Copyright>
<PackageLicenseExpression>LGPL-3.0-or-later</PackageLicenseExpression>
Expand Down
2 changes: 1 addition & 1 deletion FlyleafLib.Controls.WinUI/FlyleafLib.Controls.WinUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<UseWinUI>true</UseWinUI>
<Nullable>enable</Nullable>
<Authors>SuRGeoNix</Authors>
<Version>1.0.12</Version>
<Version>1.0.13</Version>
<Copyright>SuRGeoNix © 2023</Copyright>
<PackageProjectUrl>https://github.com/SuRGeoNix/Flyleaf</PackageProjectUrl>
<PackageIcon>Flyleaf.png</PackageIcon>
Expand Down
14 changes: 6 additions & 8 deletions FlyleafLib/FlyleafLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<PackageIconUrl />
<RepositoryUrl></RepositoryUrl>
<Description>Media Player .NET Library for WinUI 3/WPF/WinForms (based on FFmpeg/DirectX)</Description>
<Version>3.7.24</Version>
<Version>3.7.25</Version>
<Authors>SuRGeoNix</Authors>
<Copyright>SuRGeoNix © 2023</Copyright>
<PackageLicenseExpression>LGPL-3.0-or-later</PackageLicenseExpression>
Expand All @@ -17,13 +17,11 @@
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageReleaseNotes>
- CustomIOContext: Fixes a critical issue with the EOF (read bytes = 0) which could cause the demuxer to freeze
- Renderer: Changes default VideoProcessor to Flyleaf instead of D3D11
- Renderer: Fixes an issue when linesize is negative which requires vertical flipping
- VideoDecoder: Improves seek speed on codecs/formats that fail to seek to keyframes (mainly HEVC)

Breaking Changes
- Default Video Processor for Renderer changed from D3D11 to Flyleaf (this can cause issues only with extra D3D11 video filters)
- AudioDecoder: Minor adjustment for audio/video sync to provide samples 50ms earlier than video
- Player: Minor log level adjustments
- Renderer: Fixes an issue with aspect ratio when announced by video stream
- Renderer: Fixes an issue with negative linesize and vertical flipping (it wouldn't reset in new inputs)
- VideoDecoder: Fixes an issue during software fallback. It would jump to the next keyframe (it wouldn't start from the beginning of the video)
</PackageReleaseNotes>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion FlyleafLib/MediaFramework/MediaDecoder/VideoDecoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ protected override void RunInternal()

if (frame->best_effort_timestamp != AV_NOPTS_VALUE)
frame->pts = frame->best_effort_timestamp;
else if (frame->pts == AV_NOPTS_VALUE)
else if (frame->pts == AV_NOPTS_VALUE) // TBR: it is possible to have a single frame / image with no dts/pts which actually means pts = 0 ? (ticket_3449.264) - GenPts will not affect it
{ av_frame_unref(frame); continue; }

if (keyFrameRequired)
Expand Down
24 changes: 5 additions & 19 deletions FlyleafLib/MediaFramework/MediaStream/VideoStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,27 +53,13 @@ public void Refresh(AVPixelFormat format = AVPixelFormat.AV_PIX_FMT_NONE)
TotalFrames = AVStream->duration > 0 && FrameDuration > 0 ? (int) (AVStream->duration * Timebase / FrameDuration) : (FrameDuration > 0 ? (int) (Demuxer.Duration / FrameDuration) : 0);

int x, y;
if (AVStream->sample_aspect_ratio.num > 1 && AVStream->sample_aspect_ratio.den > 1)
{
x = AVStream->sample_aspect_ratio.num;
y = AVStream->sample_aspect_ratio.den;
AVRational sar = av_guess_sample_aspect_ratio(null, AVStream, null);
if (av_cmp_q(sar, av_make_q(0, 1)) <= 0)
sar = av_make_q(1, 1);

}
else if (AVStream->codecpar->sample_aspect_ratio.num > 1 && AVStream->codecpar->sample_aspect_ratio.den > 1 && AVStream->codecpar->sample_aspect_ratio.num != AVStream->codecpar->sample_aspect_ratio.den)
{
x = AVStream->codecpar->sample_aspect_ratio.num;
y = AVStream->codecpar->sample_aspect_ratio.den;
}
else
{
x = Width;
y = Height;
}
av_reduce(&x, &y, Width * sar.num, Height * sar.den, 1024 * 1024);
AspectRatio = new AspectRatio(x, y);

int gcd = Utils.GCD(x, y);
if (gcd != 0)
AspectRatio = new AspectRatio(x / gcd , y / gcd);

if (PixelFormat != AVPixelFormat.AV_PIX_FMT_NONE)
{
ColorRange = AVStream->codecpar->color_range == AVColorRange.AVCOL_RANGE_JPEG ? ColorRange.Full : ColorRange.Limited;
Expand Down
8 changes: 4 additions & 4 deletions FlyleafLib/MediaPlayer/Player.Screamers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ private bool MediaBuffer()
break;
}

if (CanInfo) Log.Info($"Drop aFrame {TicksToTime(aFrame.timestamp)}");
if (CanTrace) Log.Trace($"Drop aFrame {TicksToTime(aFrame.timestamp)}");
AudioDecoder.Frames.TryDequeue(out aFrame);
}

Expand Down Expand Up @@ -394,7 +394,7 @@ private void Screamer()
}
else if (aDistanceMs < -5) // Will be transfered back to decoder to drop invalid timestamps
{
if (CanInfo) Log.Info($"aDistanceMs = {aDistanceMs} | AudioFrames: {AudioDecoder.Frames.Count} AudioPackets: {AudioDecoder.Demuxer.AudioPackets.Count}");
if (CanTrace) Log.Trace($"aDistanceMs = {aDistanceMs} | AudioFrames: {AudioDecoder.Frames.Count} AudioPackets: {AudioDecoder.Demuxer.AudioPackets.Count}");

if (GetBufferedDuration() < Config.Player.MinBufferDuration / 2)
{
Expand Down Expand Up @@ -456,8 +456,8 @@ private void Screamer()
{
if (vDistanceMs < -10 || GetBufferedDuration() < Config.Player.MinBufferDuration / 2)
{
if (CanInfo)
Log.Info($"vDistanceMs = {vDistanceMs} (restarting)");
if (CanDebug)
Log.Debug($"vDistanceMs = {vDistanceMs} (restarting)");

requiresBuffering = true;
continue;
Expand Down

0 comments on commit fd43b69

Please sign in to comment.