In CBR (Constant Bit Rate) video encoding, every frame is allocated the same number of bits. Purpose of P/B frame is to reduce the number of bits by referencing another frame. Of course, there are a lot of CBR streams with P or B frames.
In and Video Analyzer, you cab see every frame have very different number of bits even in a CBR stream. So In MPEG-2 and H.264, CBR means the number of bits fed to the decoder is constant over time. In other words, the data transfer rate to the decoder is constant. It’s nothing to do with the number of bits of individual frames.
To allocate different number of bits to frames while keeping the incoming data rate constant, you need a buffer. Even though I, P, and B needs different number of bits, with the help of buffer, bit rate is constant over time. In MPEG-2, the buffer is called VBV buffer (Video Buffer Verifier Buffer). In H.264, the buffer is called CPB (Coded Picture Buffer).
Buffer fullness at certain time described in number of bits used. The size of the tank is called VBV buffer size in MPEG-2 and CPB buffer size in H.264. The coded stream must be constructed so that the buffer never overflow or underflow.
When the buffer size is set to large value (it’s an encoded stream parameter), the encoder can use large variance of bits for each frame which generally results in better video quality. However, the decoder needs to have the large buffer, which means more expensive hardware.