From b5a088d01f0a87b597d881aa3358a173fa47af97 Mon Sep 17 00:00:00 2001 From: beveloper Date: Mon, 30 Jun 2003 16:21:01 +0000 Subject: [PATCH] avoid creation of loopback connections git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3764 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp b/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp index e347538f51..3e25facbfb 100644 --- a/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp +++ b/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp @@ -287,7 +287,7 @@ AudioMixer::Connected(const media_source &producer, const media_destination &whe const media_format &with_format, media_input *out_input) { // a BBufferProducer is connection to our BBufferConsumer - + // incoming connections should always have an incoming ID=0, // and the port number must match our ControlPort() if (where.id != 0 || where.port != ControlPort()) @@ -561,7 +561,11 @@ AudioMixer::PrepareToConnect(const media_source &what, const media_destination & // we also create the new output connection and return it in out_source. PRINT_FORMAT("AudioMixer::PrepareToConnect: suggested format", *format); - + + // avoid loop connections + if (where.port == ControlPort()) + return B_MEDIA_BAD_SOURCE; + // is the source valid? if (what.port != ControlPort() || what.id != 0) return B_MEDIA_BAD_SOURCE;