public void JitterOutOfOrderTest() { var vqc = new VideoQualityController(1); vqc.RemoteSessions = _remoteSessions; var queue = new AudioJitterQueue(new CodecFactory(AudioFormat.Default), vqc); // Write 10 samples in order. for (ushort i = 0; i < 10; i++) { short[] samples = GetAudioSamples(320, (short)i); queue.WriteSamples(samples, 0, samples.Length, i, AudioCodecType.Raw, false); } // Write 10 samples out of order. for (ushort i = 19; i >= 10; i--) { short[] samples = GetAudioSamples(320, (short)i); queue.WriteSamples(samples, 0, samples.Length, i, AudioCodecType.Raw, false); } // Read them back and confirm that they are all in order. var buffer = new short[320]; for (int i = 0; i < 20; i++) { queue.ReadSamples(buffer); Assert.AreEqual(i, buffer[0]); } }
public void JitterReadWriteTest() { var vqc = new VideoQualityController(1); vqc.RemoteSessions = _remoteSessions; var queue = new AudioJitterQueue(new CodecFactory(AudioFormat.Default), vqc); for (ushort i = 0; i < 20; i++) { short[] samples = GetAudioSamples(320, (short)i); queue.WriteSamples(samples, 0, samples.Length, i, AudioCodecType.Raw, false); } var buffer = new short[320]; for (int i = 0; i < 20; i++) { queue.ReadSamples(buffer); Assert.AreEqual(i, buffer[0]); } }