Skip to content

Commit f9a850d

Browse files
committed
fix: fix wrong logger scope
1 parent 4460f7b commit f9a850d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

StreamingCaptureBot.Core/FfMpeg.Net/Codecs/DecoderBase.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ public void Decode(AvPacketWrapper packet, ref AvFrameWrapper frame)
8383
throw error;
8484
}
8585

86-
var scope = logger.BeginScope(frame.ToString());
87-
8886
if (decodeResult < 0)
8987
{
9088
// 错误处理

StreamingCaptureBot.Core/Services/CaptureService.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ public AvFrameWrapper DecodeNextFrameUnsafe()
124124
{
125125
try
126126
{
127+
#region Find Stream
128+
127129
do
128130
{
129131
_packet.Reset();
@@ -148,6 +150,8 @@ public AvFrameWrapper DecodeNextFrameUnsafe()
148150
readResult.ThrowExceptionIfError();
149151
} while (_packet.StreamIndex != _streamOption.Value.StreamIndex);
150152

153+
#endregion
154+
151155
scope?.Dispose(); // ensure last scope has been disposed
152156
scope = _logger.BeginScope(_packet.ToString());
153157

@@ -206,10 +210,12 @@ public AvFrameWrapper DecodeNextFrameUnsafe()
206210
frame.PictureType.ToString(),
207211
frame.GetPresentationTimeSpan(_decoder.Context.TimeBase).ToString("c"));
208212

213+
scope?.Dispose();
209214
break;
210215
}
211216
finally
212217
{
218+
scope?.Dispose();
213219
_packet.Reset();
214220
}
215221
}

0 commit comments

Comments
 (0)