How to print a graph with all filters and decoder used and dump G.711 audio data?

jdp
2014-03-25
2014-04-22
  • jdp

    jdp - 2014-03-25

    Hello Everyone,

    I am new to DirectShowLib.NET and trying to rootcause one problem. The code has been written using DirectShowLib.NET and C#.

    I am working on to resolve one G.711 audio issue where on machine when we listen the audio output I hear 'clicking' sound which starts after sometime and continue at irregular gap. If I extract the audio packets from wireshark and play it in VLC then I don't hear that clicking sound.

    The graph which is prepared is as below,

    Push Source -> ACM Wrapper -> DC-DSP Filter (Amplify filter) -> Render

    I am trying to figure out which component is introducing this problem. I have following questions,

    --> How can I find out that which decoder is used by ACM Wrapper to decode audio data?
    Is there any way I can print the entire path which give me all the details about all the decoders/filters running in graph?
    For video data we are using FFDShow to decode and VMR9 to render it.

    --> I want to dump audio data using File Writer filter at different stages,
    a. Before ACM Wrapper
    b. Before DC-DSP Filter
    c. After DC-DSP Filter

    Is there any sample which can help me achieving this?
    Can I dump data at all stages in one go by putting File Writer filter at above three locations?

    --> Who is responsible for managing lip-sync?

    I would really appreciate your guidance in resolving these questions.

    Thanks,

     
    Last edit: jdp 2014-03-25
    • Eric

      Eric - 2014-03-25

      --> How can I find out that which decoder is used by ACM Wrapper to decode audio data?
      No real idea on that. You can try to deduce it from the input pin's media type...

      --> I want to dump audio data using File Writer filter at different stages
      The easy way is to place a SampleGrabber before the filter you want to inspect. Inside the SG's callback you can do anything you want with the media samples. Several of our samples use the SampleGrabber, if you want to see it in action. You can, of course put as many SG as need.

      If you really need a full DirectShow solution, insert a smart tee filter before the filter and connect the second output pin to a File Writer.

      --> Who is responsible for managing lip-sync?
      I don't understand What do you mean. It's look like you have two graphs, one for audio and one for the video. I don't see a good way to sync them. The best way would be to handle the audio and the video in a container format like AVI or something else.

       
      • jdp

        jdp - 2014-03-25

        Thanks a lot Eric for your guidance,

        -->Looking at the G.711 PCM data it should be using PCM decoder. Still not sure.

        -->I'll check and update here about the SG approach.

        -->About lip-sync, again I am not a person having expert technical knowledge in streaming domain but let me explain. In my code only one graph is running. The graph for the video looks like below,

        Push Source -> FFDShow decoder -> VMR9

        Push Source is a filter developed in VC++. It is responsible for RTSP communication with device and receive audio/video data.

        From the audio/video graph, the lip-sync should be managed by DirectShowLib or DirectX. I am guessing that issue doesn't have anything to do with lip-sync.

        <<Finding>> I was trying with DC-DSP filter's configure screen and if I add Notch filter with 280Hz frequency then I don't see the issue. Is there any possibility that DC-DSP has some problem?

         
        • Eric

          Eric - 2014-03-26

          I don't understand what your graph look like. Do you have one "Push Source" filter with two output pins (one for audio and one for video) or two "Push Source" filters for each media kind ?

          For the "lip-sync", if you are in the scenario with only one "Push Source", the responsability to sync audio and video is to this filter that act as a demultiplexor. If you are in the two "Push Source" filters scenario, this will be very complicated to do that with DirectShow.

           
          • jdp

            jdp - 2014-03-26

            Thanks Eric for your guidance.

            Sorry for the confusion. Actually I have only one Push Source which has different pin for video and audio.

            I tried adding sample grabber before ACM Wrapper and after Push Source but it is not dumping any file. I would appreciate if you can take a look at the attached C# code file and tell me what wrong I am doing?

             
            Last edit: jdp 2014-03-27
            • Eric

              Eric - 2014-03-27

              Of course, there is no file! You must implement a SampleGrabber callback and in that callback write audio samples to a file using a FileStream.

              Check the DxScan sample, per exemple, to see how implementing this callback (see Capture.cs). See also: http://msdn.microsoft.com/en-us/library/windows/desktop/dd376985%28v=vs.85%29.aspx

              Warning: It's very important to release the IMediaSample object passed to your ISampleGrabberCB.SampleCB implementation (see DxScan) !

               
              • jdp

                jdp - 2014-03-28

                Thanks Eric for your guidance.

                I am able to dump the audio data. I took three samples at below given points in the graph but none of them shows any sign of issue. I have attached the samples which I took when the issue was reproducing.

                -->I am capturing only audio data. Is it something gets introduced when I play audio/video together? Something related to timestamp/lip-sync. I checked and my Push Source has implemented a Reference Clock which is used to synch audio/video. If it is related to reference clock/timestamp issue how can I capture it may be using wireshark?

                -->Is there any way I can capture the data just after it rendered just to verify the audio data after it rendered.

                -->Do you think it is due to my machine's configuration which may cause such issue?

                -->Is it something related to DirectX because now I can say that the issue is seen when I render the audio.

                -->I want to rule out that BufferCB is not playing any role here.

                I am clue less now about where to look to find problem point. I would really appreciate if you can show some direction.

                 
                Last edit: jdp 2014-03-31
  • Peter Parker

    Peter Parker - 2014-04-21

    Enable High-Pass filter which is available with DS-DSP filter.

    Check this link: http://en.wikipedia.org/wiki/High-pass_filter

     
    • jdp

      jdp - 2014-04-22

      Thanks Peter Parker for your response,

      I see that using Notch filter and High pass filter resolves my issue but I am more interested in finding the root cause about the component which is introducing such noise. To find this I have some questions in my previous post.

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks