Sending packets from wireshark to audio decoder: I

2019-09-06 19:05发布

问题:

I have captured RTP packets and need to decode the packets/sesssion with G.729.1 Decoder. In wireshark, I filtered the RTP packets, analyzed and saved the session as .raw file. I am using c# streamdecoder for decoding. Its sample provides example how the speech is encoded, saved in buffer and decoded packet by packet. This is the point I am stuck:

const Codec usedCodec = Codec.G7291;  
const int usedSampleRate = 8000;     
const int usedBitrate = 12200; 

var dec = new SpeechDecoder();
dec.SetCodec(usedCodec);
dec.Bitrate = usedBitrate;

Now in sample it takes data from the buffer as :

var win = new WaveInput();
var samples = win.GetNextSamples().Buffer.Array;
bytescollected += samples.Length;
var frame = enc.EncodeToFrame(samples); //enc is enc = new speechEncoder();
if (frame != null)
{
    // decode byte stream
    var packet = frame.GetNextPacket();
    var raw = dec.Decode(packet);
}

My problem is how can I send my .raw file, already saved in desktop for decoding ?