Comments (5)
Hi! Thanks - I think! 😄 This is a weird one. Not sure if I know what the issue is here yet. Possibly a bug in JNA.
I can replicate with this - can you?
for (int i = 0; i < 200; i++) {
Buffer b = new Buffer(0);
ByteBuffer data = b.map(true);
if (data != null) {
System.out.println("Got data of size : " + data.capacity());
}
b.unmap();
}
System.out.println("Done!");
However, this works - does it for you?
GstBufferAPI.MapInfoStruct mapInfo = new GstBufferAPI.MapInfoStruct();
for (int i = 0; i < 200; i++) {
Buffer b = GstBufferAPI.GSTBUFFER_API.gst_buffer_new_allocate(null, 0, null);
// mapInfo = new GstBufferAPI.MapInfoStruct();
System.out.println("Mapping buffer : " + b.hashCode());
boolean ok = GstBufferAPI.GSTBUFFER_API.gst_buffer_map(b, mapInfo, GstBufferAPI.GST_MAP_READ);
if (ok) {
System.out.println("OK");
System.out.println(mapInfo);
} else {
System.out.println("Not OK");
System.out.println(mapInfo);
}
if (ok) {
GstBufferAPI.GSTBUFFER_API.gst_buffer_unmap(b, mapInfo);
}
}
System.out.println("Done!");
But uncommenting the line to create a new mapInfo every time around makes it crash. It's like it's something to do with the structure?
Thoughts?
from gst1-java-core.
I think the MapInfoStruct we inherited is too small. See -
https://github.com/gstreamer-java/gst1-java-core/blob/master/src/org/freedesktop/gstreamer/lowlevel/GstBufferAPI.java#L44
vs
https://github.com/GStreamer/gstreamer/blob/master/gst/gstmemory.h#L204
In the for loop above if you replace
mapInfo = new GstBufferAPI.MapInfoStruct();
with
mapInfo = new GstBufferAPI.MapInfoStruct(new Memory(200));
it doesn't crash, at least for me. You? That's not the actual size needed obviously! Just big enough. 😄
from gst1-java-core.
hey. yes, your snippets behave the same way here.
it does not crash when creating a MapInfoStruct with a Memory directly.
you are right, the structure we inherit is not correct, we are missing:
public volatile Pointer[] user_data = new Pointer[4];
public volatile Pointer[] _gst_reserved = new Pointer[GST_PADDING];
i added them, no crash anymore :)
from gst1-java-core.
PR coming up in minute.
guess we should look into all the structures and align them to gst-1.8...
from gst1-java-core.
Thanks! Didn't have time to work on a fix after finding the issue. An unexpected reason - weird that it's gone unnoticed for this long and not caused other issues. I assume with an empty buffer GStreamer might be doing something with those areas of the structure?
Checking all structures is on my list of jobs that need doing before 1.0 - it's just a matter of finding some free time for all the boring stuff! 😄
from gst1-java-core.
Related Issues (20)
- Question about multithreading with multiple pipelines. HOT 1
- Possible crash on async explicit dispose in 1.4.0 HOT 3
- How to load subtitles? Solution and example required.
- native memory still exists after Pipeline.close HOT 6
- Is it possible to have a custom thread pool to execute GstCallback (AppSink.connect) ? (question)
- How to receive each frame as its pointer(Long type) or Byte array or etc. HOT 1
- VAAPI invalid chip id or driver is being used. HOT 2
- Using GIO objects
- GType.valueOf(long) is not thead safe HOT 3
- JVM Crashes HOT 3
- What may be the reason why the pipeline cannot be created HOT 2
- Exception in thread "main" java.lang.Error: Invalid memory access HOT 2
- How to improve throughput
- WebRTCBin.createAnswer() callback not called sporadically (promise garbage collected) HOT 4
- No such Gstreamer factory: webrtcbin HOT 5
- How to get RTPSession from rtpbin
- Need to know the native pointer of a Buffer object
- Segfault in extractError function HOT 6
- gst_element_get_request_pad HOT 1
- Support for pbutils 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 gst1-java-core.