NULL audio is now keyframeable

This commit is contained in:
itsmattkc
2018-09-10 16:23:51 +10:00
parent a2e73fd87e
commit 99df7879e3
2 changed files with 19 additions and 5 deletions
+10
View File
@@ -74,8 +74,18 @@ void clear_audio_ibuffer() {
}
int get_buffer_offset_from_frame(long frame) {
// currently debugging this function. since it has a high potential of failure and isn't actually fatal, we only assert on debug mode
#ifdef QT_DEBUG
Q_ASSERT(frame >= audio_ibuffer_frame);
return qFloor(av_samples_get_buffer_size(NULL, av_get_channel_layout_nb_channels(sequence->audio_layout), qRound(((frame-audio_ibuffer_frame)/sequence->frame_rate)*sequence->audio_frequency), AV_SAMPLE_FMT_S16, 1)/4)*4;
#else
if (frame >= audio_ibuffer_frame) {
return qFloor(av_samples_get_buffer_size(NULL, av_get_channel_layout_nb_channels(sequence->audio_layout), qRound(((frame-audio_ibuffer_frame)/sequence->frame_rate)*sequence->audio_frequency), AV_SAMPLE_FMT_S16, 1)/4)*4;
} else {
qDebug() << "[WARNING] Invalid values passed to get_buffer_offset_from_frame";
return 0;
}
#endif
}
AudioSenderThread::AudioSenderThread() : close(false) {