Don't try to write an audio frame if there aren't any planes
This commit is contained in:
parent
3beb1a8519
commit
3cad3b1e29
|
@ -308,12 +308,12 @@ static bool ffmpeg_init_config(struct ff_config_param *params,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assumption: if there is a video frame, there is an audio frame.
|
|
||||||
let mut aframe = frame::Audio::new(
|
let mut aframe = frame::Audio::new(
|
||||||
format::Sample::I16(format::sample::Type::Packed),
|
format::Sample::I16(format::sample::Type::Packed),
|
||||||
self.audio_buf.len(),
|
self.audio_buf.len(),
|
||||||
ChannelLayout::STEREO
|
ChannelLayout::STEREO
|
||||||
);
|
);
|
||||||
|
if aframe.planes() > 0 {
|
||||||
aframe.set_channels(2);
|
aframe.set_channels(2);
|
||||||
aframe.set_rate(44100);
|
aframe.set_rate(44100);
|
||||||
aframe.set_pts(Some(frame));
|
aframe.set_pts(Some(frame));
|
||||||
|
@ -348,6 +348,7 @@ static bool ffmpeg_init_config(struct ff_config_param *params,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
None => println!("Video not ready during frame {}", self.frame)
|
None => println!("Video not ready during frame {}", self.frame)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue