Checking the codec context parameters to find out this information is far too unreliable to be useful, so it is safer to assume B-frames are always present.