Results of extracting and loading data from samples

krrr kosareka at gmail.com
Fri Dec 14 18:12:38 UTC 2018


Hi, 

I have a pipeline with an appsink for S16LE audio input where the sample
rate is 44 100 Hz and there is only one channel. I use the following code to
gain data from the audio files:

            GstBuffer *buffer = gst_sample_get_buffer(sample);
            GstMapInfo mem;
            if (gst_buffer_map(buffer, &mem, GST_MAP_READ))
            {
                for ( guint i = 0; i < mem.size; i+=2)
                {
                    guint lo = mem.data[i];
                    guint hi = mem.data[i+1];
                    gint16 hilo = (hi << 8) | lo;
                    audio_streamer->_tmp_samples.push_back(hilo);
                }


            }
            gst_buffer_unmap (buffer, &mem); 
            gst_sample_unref(sample);

However, the output I get always starts with at about 1300 zeros (the number
of zeros are different for two different files), despite the input files are
cut from the middle of another audio tracks, so we cannot say that by the
time these samples arrive the song hasn't started playing yet. Does anyone
know what can be the reason for this? 

I attached one of the input songs and the beginning of its ouput. 

Dee_Yan-Key_-_02_-_Winter_is_coming_Adagio_-_First_Snow.mp3
<http://gstreamer-devel.966125.n4.nabble.com/file/t378656/Dee_Yan-Key_-_02_-_Winter_is_coming_Adagio_-_First_Snow.mp3>  
test_beginning.txt
<http://gstreamer-devel.966125.n4.nabble.com/file/t378656/test_beginning.txt>  



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list