Closed
Description
MessageProxy within org.freedesktop.gstreamer.Bus.java has the following method
public void busMessage(final Bus bus, final Message msg) {
if ((type.intValue() & msg.getType().intValue()) != 0) {
callback.callback(bus, msg, null);
}
}
This checks whether any bits specified in the mask are present. This approach breaks down for extended MessageTypes, which consist of multiple bits.
MessageType.INFO (1 << 3) and MessageType.STREAM_COLLECTION (1 << 31 + 1<<3) will both trigger each others callbacks.
public void connect(final INFO listener) {
connect(INFO.class, listener, new BusCallback() {
public boolean callback(Bus bus, Message msg, Pointer user_data) {
PointerByReference err = new PointerByReference();
GSTMESSAGE_API.gst_message_parse_info(msg, err, null);
GErrorStruct error = new GErrorStruct(err.getValue());
listener.infoMessage(msg.getSource(), error.getCode(), error.getMessage());
GLIB_API.g_error_free(err.getValue());
return true;
}
});
}
When the INFO callback is called for a STREAM_COLLECTION message type, gst_message_parse_info leaves err as null as it is the wrong message type. The null value then gets dereferenced in the next line.
Should the check be something along the lines of
(type.intValue() & msg.getType().intValue()) == msg.getType().intValue()