1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-16 19:31:02 +01:00

Make visualisations not crash :-)

This commit is contained in:
John Maguire 2010-06-06 22:22:02 +00:00
parent 313daa5fd4
commit 920f7a0f3a

View File

@ -55,10 +55,10 @@ void ProjectMVisualisation::SceneRectChanged(const QRectF &rect) {
} }
void ProjectMVisualisation::ConsumeBuffer(GstBuffer *buffer, GstEnginePipeline*) { void ProjectMVisualisation::ConsumeBuffer(GstBuffer *buffer, GstEnginePipeline*) {
const int samples = GST_BUFFER_SIZE(buffer) / sizeof(short); const int samples_per_channel = GST_BUFFER_SIZE(buffer) / sizeof(short) / 2;
const short* data = reinterpret_cast<short*>(GST_BUFFER_DATA(buffer)); const short* data = reinterpret_cast<short*>(GST_BUFFER_DATA(buffer));
if (projectm_) if (projectm_)
projectm_->pcm()->addPCM16Data(data, samples); projectm_->pcm()->addPCM16Data(data, samples_per_channel);
gst_buffer_unref(buffer); gst_buffer_unref(buffer);
} }