use ffmpeg for sample packing
FFmpeg has a much more optimized algorithm than we do so may as well use it.
This commit is contained in:
@@ -434,9 +434,13 @@ void ViewerWidget::ReceivedAudioBufferForPlayback()
|
||||
if (watcher->HasResult()) {
|
||||
SampleBufferPtr samples = watcher->Get().value<SampleBufferPtr>();
|
||||
if (samples && audio_playback_device_) {
|
||||
qint64 t = QDateTime::currentMSecsSinceEpoch();
|
||||
QByteArray pack = samples->toPackedData();
|
||||
qDebug() << "Packing took:" << (QDateTime::currentMSecsSinceEpoch() - t);
|
||||
if (!packed_processor_.IsOpen()) {
|
||||
packed_processor_.Open(samples->audio_params());
|
||||
}
|
||||
|
||||
// Convert to packed data for audio output
|
||||
QByteArray pack = packed_processor_.Convert(samples);
|
||||
|
||||
audio_playback_device_->Push(pack);
|
||||
|
||||
if (prequeuing_audio_) {
|
||||
@@ -627,6 +631,7 @@ void ViewerWidget::PauseInternal()
|
||||
audio_playback_device_.reset(nullptr);
|
||||
qDeleteAll(audio_playback_queue_);
|
||||
audio_playback_queue_.clear();
|
||||
packed_processor_.Close();
|
||||
|
||||
UpdateTextureFromNode();
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <QTimer>
|
||||
#include <QWidget>
|
||||
|
||||
#include "audio/packedprocessor.h"
|
||||
#include "audiowaveformview.h"
|
||||
#include "common/rational.h"
|
||||
#include "node/output/viewer/viewer.h"
|
||||
@@ -257,6 +258,7 @@ private:
|
||||
std::unique_ptr<PreviewAudioDevice> audio_playback_device_;
|
||||
std::list<RenderTicketWatcher*> audio_playback_queue_;
|
||||
rational audio_playback_queue_time_;
|
||||
PackedProcessor packed_processor_;
|
||||
|
||||
static QVector<ViewerWidget*> instances_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user