Porting buffer fix from Adam's pvt.tvh https://github.com/adamsutton/xbm...

This fix was ported and tested against the master branch. 

Issue addressed:

Pixelation and artifacts are extremely visible after resume from pause, adding debug statements, we were able to track the packets sent by tvheadend and identify packets received by the addon but not read by the demuxer. Adam quickly identified an issue with the buffer that can lead to this behavior.

Note:
This fix is a huge improvement to the current code, however there is still random/micro pixelation, the root has not been identified yet, but it seems to be deep down into either xbmc or ffmpeg.

20:57:56 T:139716527634176   ERROR: ffmpeg[49FFB700]: [h264] mmco: unref short failure
20:57:56 T:139716527634176   ERROR: Previous line repeats 1 times.
20:57:56 T:139716527634176   ERROR: ffmpeg[49FFB700]: [h264] number of reference frames (0+4) exceeds max (3; probably corrupt input), discarding one
20:57:56 T:139716527634176   ERROR: ffmpeg[49FFB700]: [h264] mmco: unref short failure
20:57:56 T:139716527634176   ERROR: Previous line repeats 1 times.
20:57:56 T:139716527634176   ERROR: ffmpeg[49FFB700]: [h264] number of reference frames (0+4) exceeds max (3; probably corrupt input), discarding one