Fix: replicate gst_sample_get_buffer{,list} returns NULL semantic#50
Open
atishnazir wants to merge 1 commit intotinyzimmer:mainfrom
Open
Fix: replicate gst_sample_get_buffer{,list} returns NULL semantic#50atishnazir wants to merge 1 commit intotinyzimmer:mainfrom
atishnazir wants to merge 1 commit intotinyzimmer:mainfrom
Conversation
gst_sample_get_buffer{,list} returns NULL if a buffer{,list} has
not been set. Previous go-gst behaviour wrapped this NULL pointer
in the respective go-gst proxy object.
This causes a problem with AppSink when one needs to disambiguate
between whether a GstSample contains a GstBufferList, a GstBuffer
or indeed nothing at all. For example:
```
sink := app.SinkFromElement(element)
sink.SetBufferListSupport(true)
sink.SetCallbacks(&app.SinkCallbacks{
NewSampleFunc: func(sink *app.Sink) gst.FlowReturn {
if sample := sink.PullSample(); sample == nil {
return gst.FlowEOS
} else if bufferList := sample.GetBufferList(); bufferList != nil {
// consume bufferlist
return gst.FlowOK
} else if buffer := sample.GetBuffer(); buffer != nil {
// consume buffer
return gst.FlowOK
} else {
return gst.FlowError
}
},
})
```
Author
|
I debated whether a better fix would be to be to adjust the semantic of FromGstBufferUnsafeNone and FromGstBufferListUnsafeNone to return nil when called with C.NULL but felt the impact would be more far reaching. |
|
@atishnazir please recreate this PR for https://github.com/go-gst/go-gst (where future development of the bindings will take place) if you think it is necessary. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
gst_sample_get_buffer{,list} returns NULL if a buffer{,list} has not been set. Previous go-gst behaviour wrapped this NULL pointer in the respective go-gst proxy object.
This causes a problem with AppSink when one needs to disambiguate between whether a GstSample contains a GstBufferList, a GstBuffer or indeed nothing at all. For example: