This is a good question. This type of behavior -- pecking at a branch, wiping the side of the beak on a branch, pulling off twigs and dropping them, or knocking off pieces of bark -- is quite common among many corvid species, particularly when they are interrupted by something or someone that they might consider a threat. This includes not only potential predators but also potentially hostile conspecifics.
It is typically considered to be a form of displacement behavior. The concept of displacement behavior, from classical ethology, posits that when an animal experiences two conflicting drives to do two different things, it doesn't know which to do and does a third thing instead to dissipate the drive or anxiety. For branch-pecking in crows, see E.g Kilham and Waltermire 1990 Ch. 12.
**Referece:** Kilham, L., & Waltermire, J. (1990). _The American crow and the common raven_. Texas A&M University Press.