0

I've used source code from ZXing.Mobile.Net from https://github.com/Redth/ZXing.Net.Mobile for UWP. I have issue with camere freeze. Sometimes it works without issue, but sometimes when camera start, preview showing some anomaly with random pixels, and after few seconds it freeze.

Its always freezes at this line:

var frame = await mediaCapture.GetPreviewFrameAsync(videoFrame)

without throwing exception or break.

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");
}

Also i found this exception in Output when it works fine:

Exception thrown: 'System.ArgumentException' in System.Private.CoreLib.dll GetPreviewFrame Failed: System.ArgumentException: Value does not fall within the expected range. at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at ZXing.Mobile.ZXingScannerControl.<>c__DisplayClass16_0.<b__1>d.MoveNext()

Nico Zhu
  • 32,367
  • 2
  • 15
  • 36
  • I have not saw the zxing code in your case.And `GetPreviewFrameAsync` method is used to display the camera preview. Could you share a mini sample that could reproduce this issue? – Nico Zhu Nov 22 '18 at 02:38
  • Sample cs file: https://ufile.io/2355u (freeze at line 266) Sample xaml file: https://ufile.io/kppso I have same problem when use this sample on same line https://github.com/Redth/ZXing.Net.Mobile/tree/master/Samples/WindowsUniversal – Bojan Delić Nov 22 '18 at 10:19
  • I have tested with lumia 950. all feature works, please check if you have give the camera permission. – Nico Zhu Nov 23 '18 at 02:45
  • it was problem with Logitech Webcam C210 model. Other models work. – Bojan Delić Nov 23 '18 at 13:48

0 Answers0