The problem is that you call exit(-1) on the first empty frame. I think your camera works on smaller frame rate, so calling cv::waitKey(30) will result in an empty frame the second time you're reading your camera. You have to remove the exit(-1) line and also maybe increase the delay (parameter of cv::waitKey) a bit.
Great and thanks , for your assistance, however
"CV_CAP_PROP_BUFFERSIZE" is not working in opencv , I am using 2.4.11 ,
now its is very difficult to play the streaming video its almost a
unpredictable lag .. need to buffer first few frame and then need to play