modules/media/src/main/native/gstreamer/plugins/dshowwrapper/dshowwrapper.cpp

Print this page




2721     // MP2T has too many small buffers and we can get false error here. We will detect stream issues at the EOS anyway.
2722     if (!decoder->is_data_produced && decoder->eInputFormat != MEDIA_FORMAT_STREAM_MP2T)
2723     {
2724         decoder->input_buffers_count++;
2725         if (decoder->input_buffers_count > INPUT_BUFFERS_BEFORE_ERROR)
2726         {
2727             gst_element_message_full(GST_ELEMENT(decoder), GST_MESSAGE_ERROR, GST_STREAM_ERROR, GST_STREAM_ERROR_DECODE, g_strdup("Failed to decode stream"), NULL, ("dshowwrapper.c"), ("dshowwrapper_chain"), 0);
2728             decoder->is_data_produced = TRUE; // Do not send more errors
2729         }
2730     }
2731 
2732     if (decoder->force_discontinuity)
2733     {
2734         buf = gst_buffer_make_metadata_writable(buf);
2735         GST_BUFFER_FLAG_SET(buf, GST_BUFFER_FLAG_DISCONT);
2736         decoder->force_discontinuity = FALSE;
2737     }
2738 
2739     if (decoder->is_flushing)
2740         ret = GST_FLOW_WRONG_STATE;
2741     else if (FAILED(decoder->pSrc->DeliverSample(buf)))



2742         ret = GST_FLOW_ERROR;

2743 
2744     return ret;
2745 }
2746 
2747 static const GstQueryType* dshowwrapper_get_sink_query_types (GstPad* pad)
2748 {
2749     static const GstQueryType dshowwrapper_sink_query_types[] = {
2750         GST_QUERY_CONVERT,
2751         GST_QUERY_NONE
2752     };
2753 
2754     return dshowwrapper_sink_query_types;
2755 }
2756 
2757 static gboolean dshowwrapper_sink_query (GstPad* pad, GstQuery* query)
2758 {
2759     gboolean result = FALSE;
2760     GstObject *parent = gst_object_get_parent((GstObject*)pad);
2761     GstDShowWrapper *decode = GST_DSHOWWRAPPER (parent);
2762 




2721     // MP2T has too many small buffers and we can get false error here. We will detect stream issues at the EOS anyway.
2722     if (!decoder->is_data_produced && decoder->eInputFormat != MEDIA_FORMAT_STREAM_MP2T)
2723     {
2724         decoder->input_buffers_count++;
2725         if (decoder->input_buffers_count > INPUT_BUFFERS_BEFORE_ERROR)
2726         {
2727             gst_element_message_full(GST_ELEMENT(decoder), GST_MESSAGE_ERROR, GST_STREAM_ERROR, GST_STREAM_ERROR_DECODE, g_strdup("Failed to decode stream"), NULL, ("dshowwrapper.c"), ("dshowwrapper_chain"), 0);
2728             decoder->is_data_produced = TRUE; // Do not send more errors
2729         }
2730     }
2731 
2732     if (decoder->force_discontinuity)
2733     {
2734         buf = gst_buffer_make_metadata_writable(buf);
2735         GST_BUFFER_FLAG_SET(buf, GST_BUFFER_FLAG_DISCONT);
2736         decoder->force_discontinuity = FALSE;
2737     }
2738 
2739     if (decoder->is_flushing)
2740         ret = GST_FLOW_WRONG_STATE;
2741     else 
2742     {
2743         HRESULT hres = decoder->pSrc->DeliverSample(buf);
2744         if (hres != S_OK && hres != E_FAIL)
2745             ret = GST_FLOW_ERROR;
2746     }
2747 
2748     return ret;
2749 }
2750 
2751 static const GstQueryType* dshowwrapper_get_sink_query_types (GstPad* pad)
2752 {
2753     static const GstQueryType dshowwrapper_sink_query_types[] = {
2754         GST_QUERY_CONVERT,
2755         GST_QUERY_NONE
2756     };
2757 
2758     return dshowwrapper_sink_query_types;
2759 }
2760 
2761 static gboolean dshowwrapper_sink_query (GstPad* pad, GstQuery* query)
2762 {
2763     gboolean result = FALSE;
2764     GstObject *parent = gst_object_get_parent((GstObject*)pad);
2765     GstDShowWrapper *decode = GST_DSHOWWRAPPER (parent);
2766