Comments (2)
Sorry for the late reply.
I checked in the environment at hand and the problem did not occur. However, in the following line:
// Decode image data to a bitmap:
var bitmap = Image.FromStream(stream);
is executed on the worker thread called back. Perhaps there is a problem there. For example,
private void OnPixelBufferArrived(PixelBufferScope bufferScope)
{
// Force copy before transitive to UI thread context.
byte[] image = bufferScope.Buffer.CopyImage();
// `bitmap` is copied, so we can release pixel buffer now.
bufferScope.ReleaseNow();
// Switch to UI thread.
this.synchContext.Post(_ =>
{
// Convert to Stream (using FlashCap.Utilities)
using (var stream = image.AsStream())
{
// Decode image data to a bitmap:
var bitmap = Image.FromStre am(stream);
// HACK: on .NET Core, will be leaked (or delayed GC?)
// So we could release manually before updates.
var oldImage = this.BackgroundImage;
if (oldImage != null)
{
this.BackgroundImage = null;
oldImage.Dispose();
}
// Update a bitmap.
this.BackgroundImage = bitmap;
}
}, null);
}
then Image.FromStream(stream)
will be executed in the UI thread, which may solve the problem. However, since more bitmaps are copied, frame dropping is more likely to occur.
from flashcap.
Close this issue. If there is a problem, open again.
from flashcap.
Related Issues (20)
- Avalonia 11: MVVM Community Toolkit: ObservableCollection<CaptureDeviceDescriptor> is null HOT 2
- Added ShowPropertyPage method to DirectShowDevice class HOT 1
- Need support with Avalonia Sample HOT 9
- Is there any way to set camera parameters like white balance, exposure on linux? HOT 1
- Blue screen error without stopping HOT 1
- Capture Error event handler HOT 1
- SET the power line frequency property HOT 1
- After running StartAsync() on linux, executing StopAsync() and then StartAsync(), pixelBufferArrived will not be executed again. HOT 4
- VideoCharacteristics not detected HOT 17
- Typo in Linux device enumeration HOT 3
- Reversed logic when enumerating Linux device capabilities HOT 3
- 执行OpenAsync时发生异常 HOT 1
- Elgato CamLink 4K DirectShow Pixel Format HOT 4
- Capture works first time on Linux, but not subsequent times HOT 4
- How to do shrink memory when capturing from WebCam to WPF HOT 2
- Avalonia aot 启动失败
- Is there a camera snapshot event handler? HOT 1
- AutoPixelBufferScope set PixelBuffer to null, cause allocate new PixelBuffer for every frame HOT 3
- Possible leaks in AsyncLock HOT 1
- Desktop Screen Capture Support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flashcap.