Appsink misses last buffer

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Appsink misses last buffer

dingoegret
This post was updated on .
I have a simple pipeline of the following:

udpsrc -> rtppcmudepay -> appsink

I am grabbing buffers from appsink via:

g_signal_connect(appsink, "new-sample", G_CALLBACK(new_sample), NULL);

and my callback is:

static GstFlowReturn new_sample(GstElement *sink) {
    GstSample *sample;
    g_signal_emit_by_name(sink, "pull-sample", &sample, NULL);
    if (sample) {
        GstBuffer *buffer = gst_sample_get_buffer(sample);
        GstBuffer *app_buffer = gst_buffer_copy (buffer);

        gst_sample_unref(sample);

        GstMapInfo info;
        gst_buffer_map(app_buffer , &info, GST_MAP_READ);

        fwrite(info.data, sizeof(unsigned char), info.size, file);

        gst_buffer_unmap(app_buffer, &info);
    }

    return GST_FLOW_OK;
}


I send a stream of audio to this pipeline via:

gst-launch-1.0 filesrc location=sample.wav ! wavparse ! audioconvert ! mulawenc ! rtppcmupay ! udpsink host=127.0.0.1 port=6000

I am able to open the saved file that fwrite wrote to and it plays fine, but it is always missing the last second of audio. It cuts off. But if I include a mulawdec in my pipeline:

udpsrc -> rtppcmudepay -> mulawdec -> appsink

Then I get that very last second of audio that before was missing when using the mulaw pipeline attempt. If I replace appsink with filesink

udpsrc -> rtppcmudepay -> filesink

then I everything plays fine also and I also get the last second of audio. What is going on?
Reply | Threaded
Open this post in threaded view
|

Re: Appsink misses last buffer

mynameismaxz
I've some question about playing a file with you're writing on GstMapInfo. I
try to write on file with your solution, So I have a RAW byte file. After
that, I've been imported to "Audacity" program on windows to import RAW File
but It's cannot hearing (I've heard some noise like white noise). So how can
you play the RAW file on your solution?

Regards,



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel