Skip to content

Commit

Permalink
Fix ffmpeg audio decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
dontpanic92 committed Mar 31, 2024
1 parent 6791cd3 commit a572060
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion radiance/radiance/src/imgui/platform/windows.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{cell::RefCell, collections::HashMap, ptr::null_mut, rc::Rc, time::Duration};
use std::{cell::RefCell, collections::HashMap, ptr::null_mut, rc::Rc};

use imgui::{BackendFlags, ConfigFlags, Context, Key};
use winapi::{
Expand Down
2 changes: 1 addition & 1 deletion radiance/radiance/src/rendering/vulkan/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use ash::vk;
use std::error::Error;
use std::mem::size_of;
use std::rc::Rc;
use vma::{self, Alloc};
use vma::Alloc;

pub enum BufferType {
Index = 0,
Expand Down
1 change: 0 additions & 1 deletion radiance/radiance/src/rendering/vulkan/vulkan_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use crate::{
use ash::extensions::ext::DebugUtils;
use ash::{vk, Entry};
use crosscom::ComRc;
use std::iter::Iterator;
use std::ptr;
use std::rc::Rc;
use std::sync::Arc;
Expand Down
18 changes: 11 additions & 7 deletions yaobow/shared/src/video/ffmpeg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -755,13 +755,17 @@ fn resample_source_frame(
let mut resampled_frame = AudioFrame::empty();
let mut delay = context.run(source_frame, &mut resampled_frame).unwrap();
resampled_frames.push(resampled_frame);
while let Some(_) = delay {
let mut resampled_frame = AudioFrame::empty();
resampled_frame.set_channel_layout(audio.target_channel_layout);
resampled_frame.set_format(audio.target_format);
resampled_frame.set_rate(audio.target_sample_rate);
delay = context.flush(&mut resampled_frame).unwrap();
resampled_frames.push(resampled_frame);
while let Some(d) = delay {
if d.input > source_frame.samples() as i64 {
let mut resampled_frame = AudioFrame::empty();
resampled_frame.set_channel_layout(audio.target_channel_layout);
resampled_frame.set_format(audio.target_format);
resampled_frame.set_rate(audio.target_sample_rate);
delay = context.flush(&mut resampled_frame).unwrap();
resampled_frames.push(resampled_frame);
} else {
break;
}
}

resampled_frames
Expand Down

0 comments on commit a572060

Please sign in to comment.