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

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);


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

        fwrite(, 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= 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

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?


Sent from:
gstreamer-devel mailing list
[hidden email]