Commit 746685eb authored by Stefan Westerfeld's avatar Stefan Westerfeld

Cleanup top level seeking code.

Signed-off-by: Stefan Westerfeld's avatarStefan Westerfeld <stefan@space.twc.de>
parent 8200826a
...@@ -6,5 +6,4 @@ opus length ffprobe -show_format phil.mkv ...@@ -6,5 +6,4 @@ opus length ffprobe -show_format phil.mkv
video-streaming: video-streaming:
- total sample test should be reenabled - total sample test should be reenabled
- localize audio_buffer_frames
- clang - clang
...@@ -687,28 +687,24 @@ add_stream_watermark (AudioInputStream *in_stream, AudioOutputStream *out_stream ...@@ -687,28 +687,24 @@ add_stream_watermark (AudioInputStream *in_stream, AudioOutputStream *out_stream
size_t total_input_frames = 0; size_t total_input_frames = 0;
size_t total_output_frames = 0; size_t total_output_frames = 0;
size_t audio_buffer_frames = 0;
size_t zero_frames_out = zero_frames; size_t zero_frames_out = zero_frames;
Error err; Error err;
if (zero_frames >= Params::frame_size) if (zero_frames >= Params::frame_size)
{ {
size_t skip_blocks = zero_frames / Params::frame_size; const size_t skip_frames = zero_frames - zero_frames % Params::frame_size;
total_input_frames += Params::frame_size * skip_blocks; total_input_frames += skip_frames;
audio_buffer_frames += Params::frame_size * skip_blocks; size_t out = wm_resampler.skip (skip_frames);
size_t frames = wm_resampler.skip (Params::frame_size * skip_blocks);
audio_buffer_frames -= frames;
frames = limiter.skip (frames); audio_buffer.write_frames (std::vector<float> ((skip_frames - out) * n_channels));
assert (frames < zero_frames_out); out = limiter.skip (out);
zero_frames_out -= frames; assert (out < zero_frames_out);
total_output_frames += frames; zero_frames_out -= out;
total_output_frames += out;
zero_frames -= Params::frame_size * skip_blocks; zero_frames -= skip_frames;
} }
audio_buffer.write_frames (std::vector<float> (audio_buffer_frames * n_channels));
while (true) while (true)
{ {
if (zero_frames > 0) if (zero_frames > 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment