I had a very similar problem with my M4gery recently. Spent cases stovepiping, or just staying in the receiver while it's trying to feed the next one. I immediately though "extractor," so I clean everything real well, paying close attection to the extractor. Seemed to fix it, for about 5 rounds. I replace the extractor. Same thing. Check the ejector. Same thing. Changed ammo. Same thing.
I finally figured out that it was short stroking, then looked at the gas system. The carrier key had worked itself loose, just enough so that right after I clean, the clp I threw in there for lubrication would seal it, but after a few shots, the clpwould burn off and gas would start leaking out, causing it to short-stroke. Tightened and re-staked the key on, and haven't had a problem since.