6. Given that $f(x)$ is a function defined on $\mathbf{R}$, and for any $x, y \in \mathbf{R}$, we have $f(x)+f(y)=$ $2 f\left(\frac{x+y}{2}\right) f\left(\frac{x-y}{2}\right)$, and it is also known that $f\left(\frac{\pi}{4}\right)=0$, but $f(x)$ is not identically zero, and $f(0)>0$, then $f(x)$ is a periodic function, and one of its positive periods is
A. $\frac{\pi}{4}$
B. $\frac{\pi}{2}$
C. $\frac{3}{4} \pi$
D. $\pi$
6. D Given $f(x)+f(y)=2 f\left(\frac{x+y}{2}\right) f\left(\frac{x-y}{2}\right)$

Let $x=y=0$ in (1). We get $2 f(0)=2[f(0)]^{2}$, since $f(0)>0$, so $f(0)=1$,
Note that $f\left(\frac{\pi}{4}\right)=0$, and replace $x$ and $y$ in (1) with $\frac{\pi}{2}+x$ and $x$ respectively, we get
$$
f\left(\frac{\pi}{2}+x\right)+f(x)=2 f\left(\frac{\pi}{4}+x\right) \cdot f\left(\frac{\pi}{4}\right)=0 .
$$

Therefore, $f\left(\frac{\pi}{2}+x\right)=-f(x)$.
From (3), we have $f(\pi+x)=f\left[\left(\frac{\pi}{2}+\left(\frac{\pi}{2}+x\right)\right)\right]=-f\left(\frac{\pi}{2}+x\right)=f(x)$, so $f(x)$ is a periodic function with period $\pi$. Choose D.