public bool Process(ArraySegment <short> frame) { if (frame.Count != _frameSize) { throw Log.CreatePossibleBugException(string.Format("Frame is incorrect size (expected {0} for {1})", _frameSize, frame.Count), "716C8CBD-8014-4C57-889C-0450ECF96A0F"); } using (var pin = frame.Pin()) { var result = WebRtcVadNativeMethods.Dissonance_WebRtcVad_Process(_handle, _sampleRate, pin.Ptr, new UIntPtr((uint)frame.Count)); if (result == -1) { throw Log.CreatePossibleBugException("Unknown error processing audio", "9BBD8BB1-B08D-4F34-AFF2-AAF32F69C309"); } return(result == 1); } }