+
+/**
+ * Compute when to send a chunk of an audio file.
+ *
+ * \param chunk_num The number of the chunk.
+ * \param chunk_tv The duration of one chunk.
+ * \param stream_start When the first chunk was sent.
+ * \param result The time when to send chunk number \a chunk_num.
+ *
+ * This function computes stream_start + chunk_num * chunk_time.
+ */
+void compute_chunk_time(long unsigned chunk_num,
+ struct timeval *chunk_tv, struct timeval *stream_start,
+ struct timeval *result)
+{
+ struct timeval tmp;
+
+ tv_scale(chunk_num, chunk_tv, &tmp);
+ tv_add(&tmp, stream_start, result);
+}