First off, you ARE getting all the PCM data in buffer[]. But you probably have to assemble the bytes into PCM data. Your audio format will tell you how many bits encoding is being used. Most common is 16-bit, but sometimes 24- or 32-bit data shows up. With 16-bit data, you append two contiguous bytes to build a short. The order of the two bytes depends on whether the format is little-endian or big-endian. I am noticing on the right of this screen, in the "Related" column, is a link: how to get PCM data from a wav file--that link or another similar should get you an example of the code you will need.
Second issue, I don't think doing RMS on separate buffer[] arrays is exactly correct. I could be wrong on this. I'm thinking its more like a moving average, where some of the data from the beginning of one buffer[] should include some of the data from the end of the previous buffer[]. Does the formula require that you "go back" or "average over" N number of frames? If so, you will want to keep the previous buffer[] handy for situations where the N amount spans two frames. And you will be iterating through the current buffer[], one "frame" at a time (or handing buffer[] to a subroutine that in effect does this).