Let $\Omega \subset \mathbb R^d$ be a bounded connected open set with smooth boundary. Suppose $f \in L^1_{\text{loc}} (\Omega)$ is nonnegative and such that there exists some constant $C > 0$ such that for almost every $x \in \Omega$, and every open ball $B \subset \Omega$ containing $x$, we have
$$f(x) \leq \frac{C}{|B|} \int_{B} f.$$
Is it true that $f \in L^\infty (\Omega)$ if and only if the above condition is satisfied?