https://github.com/Redth/ZXing.Net.Mobile for UWP のZXing.Mobile.Net のソース コードを使用しました。カメラのフリーズに問題があります。問題なく動作することもありますが、カメラの起動時に、ランダムなピクセルで異常を示すプレビューが表示され、数秒後にフリーズすることがあります。
この行で常にフリーズします:
var frame = await mediaCapture.GetPreviewFrameAsync(videoFrame)
例外やブレークをスローせずに。
System.Diagnostics.Debug.WriteLine("Linija 243");
var delay = ScanningOptions.DelayBetweenAnalyzingFrames;
if (stopping || processing || !isAnalyzing
|| (mediaCapture == null || mediaCapture.CameraStreamState != Windows.Media.Devices.CameraStreamState.Streaming))
{
timerPreview.Change(delay, Timeout.Infinite);
return;
}
processing = true;
SoftwareBitmapLuminanceSource luminanceSource = null;
WriteableBitmap writeableBmp = null;
try
{
System.Diagnostics.Debug.WriteLine("Linija 263");
var frame = await mediaCapture.GetPreviewFrameAsync(videoFrame);
luminanceSource = new SoftwareBitmapLuminanceSource(frame.SoftwareBitmap);
System.Diagnostics.Debug.WriteLine("Linija 266");
}
また、正常に動作する場合、出力でこの例外を見つけました:
例外がスローされました: System.Private.CoreLib.dll GetPreviewFrame で 'System.ArgumentException' が失敗しました: System.ArgumentException: 値が期待される範囲内にありません。System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() で System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (タスク タスク) で System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (タスク タスク) で System.Runtime.CompilerServices.TaskAwaiter`1 .GetResult() at ZXing.Mobile.ZXingScannerControl.<>c__DisplayClass16_0.<b__1>d.MoveNext()