ZXing.Net UWP camera freeze
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()
uwp qr-code zxing zxing.net
add a comment |
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()
uwp qr-code zxing zxing.net
I have not saw the zxing code in your case.AndGetPreviewFrameAsync
method is used to display the camera preview. Could you share a mini sample that could reproduce this issue?
– Nico Zhu - MSFT
Nov 22 '18 at 2:38
Sample cs file: ufile.io/2355u (freeze at line 266) Sample xaml file: ufile.io/kppso I have same problem when use this sample on same line github.com/Redth/ZXing.Net.Mobile/tree/master/Samples/…
– 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 - MSFT
Nov 23 '18 at 2:45
it was problem with Logitech Webcam C210 model. Other models work.
– Bojan Delić
Nov 23 '18 at 13:48
add a comment |
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()
uwp qr-code zxing zxing.net
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()
uwp qr-code zxing zxing.net
uwp qr-code zxing zxing.net
edited Nov 22 '18 at 2:25
Nico Zhu - MSFT
9,6631421
9,6631421
asked Nov 21 '18 at 12:33
Bojan DelićBojan Delić
185
185
I have not saw the zxing code in your case.AndGetPreviewFrameAsync
method is used to display the camera preview. Could you share a mini sample that could reproduce this issue?
– Nico Zhu - MSFT
Nov 22 '18 at 2:38
Sample cs file: ufile.io/2355u (freeze at line 266) Sample xaml file: ufile.io/kppso I have same problem when use this sample on same line github.com/Redth/ZXing.Net.Mobile/tree/master/Samples/…
– 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 - MSFT
Nov 23 '18 at 2:45
it was problem with Logitech Webcam C210 model. Other models work.
– Bojan Delić
Nov 23 '18 at 13:48
add a comment |
I have not saw the zxing code in your case.AndGetPreviewFrameAsync
method is used to display the camera preview. Could you share a mini sample that could reproduce this issue?
– Nico Zhu - MSFT
Nov 22 '18 at 2:38
Sample cs file: ufile.io/2355u (freeze at line 266) Sample xaml file: ufile.io/kppso I have same problem when use this sample on same line github.com/Redth/ZXing.Net.Mobile/tree/master/Samples/…
– 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 - MSFT
Nov 23 '18 at 2:45
it was problem with Logitech Webcam C210 model. Other models work.
– Bojan Delić
Nov 23 '18 at 13:48
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 - MSFT
Nov 22 '18 at 2:38
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 - MSFT
Nov 22 '18 at 2:38
Sample cs file: ufile.io/2355u (freeze at line 266) Sample xaml file: ufile.io/kppso I have same problem when use this sample on same line github.com/Redth/ZXing.Net.Mobile/tree/master/Samples/…
– Bojan Delić
Nov 22 '18 at 10:19
Sample cs file: ufile.io/2355u (freeze at line 266) Sample xaml file: ufile.io/kppso I have same problem when use this sample on same line github.com/Redth/ZXing.Net.Mobile/tree/master/Samples/…
– 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 - MSFT
Nov 23 '18 at 2:45
I have tested with lumia 950. all feature works, please check if you have give the camera permission.
– Nico Zhu - MSFT
Nov 23 '18 at 2:45
it was problem with Logitech Webcam C210 model. Other models work.
– Bojan Delić
Nov 23 '18 at 13:48
it was problem with Logitech Webcam C210 model. Other models work.
– Bojan Delić
Nov 23 '18 at 13:48
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53412127%2fzxing-net-uwp-camera-freeze%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53412127%2fzxing-net-uwp-camera-freeze%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
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 - MSFT
Nov 22 '18 at 2:38
Sample cs file: ufile.io/2355u (freeze at line 266) Sample xaml file: ufile.io/kppso I have same problem when use this sample on same line github.com/Redth/ZXing.Net.Mobile/tree/master/Samples/…
– 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 - MSFT
Nov 23 '18 at 2:45
it was problem with Logitech Webcam C210 model. Other models work.
– Bojan Delić
Nov 23 '18 at 13:48