提交 b1504b02 编写于 作者: K Ka Ho Ng

oss-audio: Use util_mul_div64() to do time scaling

util_mul_div64() is a new helper to do scaling. This commit sweeps the
oss-audio plugin code to generalize the way of doing scaling.
上级 4b17b82a
......@@ -29,7 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define blog(level, msg, ...) blog(level, "oss-audio: " msg, ##__VA_ARGS__)
#define NSEC_PER_SEC 1000000000LL
#define NSEC_PER_SEC 1000000000ULL
#define OSS_MAX_CHANNELS 8
......@@ -255,9 +255,9 @@ static void *oss_reader_thr(void *vptr)
oss_channels_to_obs_speakers(handle->channels);
out.samples_per_sec = handle->rate;
out.frames = nbytes / framesize;
out.timestamp =
os_gettime_ns() -
((out.frames * NSEC_PER_SEC) / handle->rate);
out.timestamp = os_gettime_ns() -
util_mul_div64(out.frames, NSEC_PER_SEC,
handle->rate);
obs_source_output_audio(handle->source, &out);
}
if (fds[1].revents & POLLIN) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册