Upper bound on complex integral of real-valued function, estimation lemma too loose I've encountered the following problem in a set of course notes on complex analysis, but I can't seem to solve it:

Prove that if f is a continuous real-valued function with $|f(z)| \leq 1$, then $\left|\int_{|z| = 1} f(z)\,dz\right| \leq 4$.

This is my work so far:

\begin{align*} \left|\int_{|z| = 1} f(z) \,dz \right| &= \left|\int_0^{2\pi}f\left(e^{i\theta}\right)ie^{i\theta}\,d\theta\right| \\ &= \left|\int_0^{2\pi}f\left(e^{i\theta}\right)\cos\theta\,d\theta + i\int_0^{2\pi}f\left(e^{i\theta}\right)\sin\theta\,d\theta\right| \end{align*}

I initially tried to use the triangle inequality at this point and then bound the real integrals, but this gives me an upper bound of $4\pi$. Using the estimation lemma on the initial integral gives me an upper bound of $2\pi$. I can't manage to get it any tighter.
The emphasis on real-valued makes it seem that this is a key point. Any ideas?
 A: There is a complex number $\omega$ satisfying $|\omega| = 1$ and $\omega \int_{|z| = 1} f(z) dz \geq 0$.  Writing $\omega = e^{is}$ for some real $s$ we then have
\begin{align}
\left|\int_{|z|=1} f(z) \, dz\right| & = \omega \int_{|z|=1} f(z) \, dz \\
& = \int_0^{2\pi} f(e^{it}) i e^{i(t+s)} \, dt \\
& = \operatorname{Re} \left(\int_0^{2\pi} f(e^{it}) i e^{i(t+s)} \, dt\right) \\
& = \int_0^{2\pi} f(e^{it}) \operatorname{Re} (i e^{i(t+s)}) \, dt \\
& = \int_0^{2\pi} f(e^{it}) (-\sin(t+s)) \, dt\\
& \leq \int_0^{2\pi} |f(e^{it}) |\sin(t+s)| \, dt\\
& \leq \int_0^{2\pi} |\sin(t+s)| \, dt\\
& = \int_0^{2\pi} |\sin(u)| \, du\\
&= 2 \int_0^{\pi} \sin(u) \, du\\
& = 4.
\end{align}
The real-valuedness of $f$ was used to deduce the fourth equality in the above chain.
The first inequality above is an instance of the general fact that $|\int_0^{2\pi} g(t) \, dt| \leq \int_0^{2\pi} |g(t)| \,dt$ for any complex valued function $g$ on $[0,2\pi]$ (then notice that in our case $\int_0^{2\pi} g(t) \, dt \geq 0$).
The second inequality above is where the hypothesis that $|f(z)| \leq 1$ for all $|z|=1$ was used.
Hopefully the rest of the steps are clear.
