GStreamer VC++ for converting RTP (Payload Type 96 (PT-96) ) to wav audio file

My application requirement is that I need to sniff network packets from the network card and filter RTP packet of payload type 96 (PT-96) and convert and save them in a wav audio file.
I have filtered and stored RTP packets in a container like vector and later i tried to convert them into a wav using Gstreamer libraries but i am not able to convert them in audio file.

I have sniffed packets using pcap library but converting rpt packet to audio is still remaining.
My experience in Gstreamer is at a very beginner level. below is my code for GStreamer processing pipeline.


void gstreamer_processing() {
    AppData appdata;
    appdata.pipeline = gst_pipeline_new("audio-receive-pipeline");
    appdata.appsrc = gst_element_factory_make("appsrc", "appsrc");
    appdata.rtpjitterbuffer = gst_element_factory_make("rtpjitterbuffer", "jitterbuffer");
    appdata.rtpdepay = gst_element_factory_make("rtpL16depay", "rtpdepay");
    appdata.audioconvert = gst_element_factory_make("audioconvert", "audioconvert");
    appdata.audioResample = gst_element_factory_make("audioresample","resample");
    appdata.wavenc = gst_element_factory_make("wavenc", "wavenc");
    appdata.filesink = gst_element_factory_make("filesink", "filesink");

    if (!appdata.pipeline || !appdata.appsrc || !appdata.rtpjitterbuffer || !appdata.rtpdepay || !appdata.audioconvert || !appdata.audioResample || !appdata.wavenc || !appdata.filesink) {
        g_printerr("Not all elements could be created.n");
        return;
    }

    GstAppSrc *appsrc;
    // Set properties
    GstCaps *caps = gst_caps_new_simple("application/x-rtp",
        "media", G_TYPE_STRING, "audio",
        "clock-rate", G_TYPE_INT, 44100,
        "encoding-name", G_TYPE_STRING, "L16",
        "channels", G_TYPE_INT, 2,
        NULL);

    appsrc = GST_APP_SRC(appdata.appsrc);
    gst_app_src_set_stream_type(appsrc, GST_APP_STREAM_TYPE_STREAM);
    gst_app_src_set_caps(appsrc, caps);
    gst_caps_unref(caps);

    g_object_set(G_OBJECT(appdata.filesink), "location", "output.wav", NULL);

    // Add elements to the pipeline
    gst_bin_add_many(GST_BIN(appdata.pipeline), appdata.appsrc, appdata.rtpjitterbuffer,    appdata.rtpdepay, appdata.audioconvert, appdata.audioResample, appdata.wavenc, appdata.filesink, NULL);

    // Link elements
    if (!gst_element_link_many(appdata.appsrc, appdata.rtpjitterbuffer, appdata.rtpdepay, appdata.audioconvert,  appdata.audioResample, appdata.wavenc, appdata.filesink, NULL)) {
        g_printerr("Elements could not be linked.n");
        gst_object_unref(appdata.pipeline);
        return;
    }
        
    // Set the pipeline to playing state
    gst_element_set_state(appdata.pipeline, GST_STATE_PLAYING);
    static int iCntr = 0;
    while (capturing || !rtp_packets.empty()) 
    {
        if (rtp_packets.empty())
            break;
        iCntr++;
        std::cout << "processing packet "<< iCntr << std::endl;
        if(!rtp_packets.empty()) 
        {
            std::vector<u_char> rtp_packet = std::move(rtp_packets.front());
            
            rtp_packets.erase(rtp_packets.begin());

            if (rtp_packet.size() > 0)
            {
                GstBuffer *buffer = gst_buffer_new_wrapped_full((GstMemoryFlags)0, (gpointer)rtp_packet.data(), rtp_packet.size(), 0, rtp_packet.size(), NULL, NULL);
                if (buffer != NULL)
                {

                    // Debugging print statements
                    GstMapInfo info;
                    if (gst_buffer_map(buffer, &info, GST_MAP_READ)) {
                        guint8 payload_type = info.data[1] & 0x7F;//TODO::check debuggged and changed from orignal code
                        //g_print("Payload type:KK %dn", payload_type);
                        guint16 seq_num = (info.data[2] << 8) | info.data[3]; // Extracting sequence number
                        gst_buffer_unmap(buffer, &info);
                    }


                    GstFlowReturn ret;
                    //g_signal_emit_by_name(appdata.appsrc, "push-buffer", buffer, &ret);
                    g_signal_emit_by_name(appsrc, "push-buffer", buffer, &ret);
                    gst_buffer_unref(buffer);
                    if (ret != GST_FLOW_OK) {
                        g_printerr("Error pushing buffer to appsrc: %sn", gst_flow_get_name(ret));
                    }
                }
                else
                {
                    g_printerr("Failed to create GstBuffer for RTP packet.n");
                }
            }
            else
            {
                capturing = false;
                break;
            }

            //lock.lock();
        }
    }

    // Signal end-of-stream
    //g_signal_emit_by_name(appdata.appsrc, "end-of-stream", NULL);
    g_signal_emit_by_name(appsrc, "end-of-stream", NULL);

    // Run the main loop until the pipeline finishes processing
    GMainLoop *loop = g_main_loop_new(NULL, FALSE);
    g_main_loop_run(loop);

    // Clean up
    gst_element_set_state(appdata.pipeline, GST_STATE_NULL);
    gst_object_unref(GST_OBJECT(appdata.pipeline));
    g_main_loop_unref(loop);
}

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật