~aleteoryx/muditaos

00a9d5d0b3255999d35299e8eac01312a1273426 — Jakub Pyszczak 4 years ago 1d66d0d
[EGD-6438] Loudspeaker headset fix

Fixed enabling loudspeaker during phone call with headphones plugged.
M module-audio/Audio/Operation/RouterOperation.cpp => module-audio/Audio/Operation/RouterOperation.cpp +5 -0
@@ 139,6 139,7 @@ namespace audio
        switch (evt->getType()) {
        case EventType::JackState:
            SetProfileAvailability({Profile::Type::RoutingHeadphones}, isAvailable);
            jackState = isAvailable ? JackState::Plugged : JackState::Unplugged;
            SwitchToPriorityProfile();
            break;
        case EventType::BlutoothHSPDeviceState:


@@ 147,10 148,14 @@ namespace audio
            break;
        case EventType::CallLoudspeakerOn:
            SetProfileAvailability({Profile::Type::RoutingEarspeaker}, false);
            SetProfileAvailability({Profile::Type::RoutingHeadphones}, false);
            SwitchProfile(Profile::Type::RoutingLoudspeaker);
            break;
        case EventType::CallLoudspeakerOff:
            SetProfileAvailability({Profile::Type::RoutingEarspeaker}, true);
            if (jackState == JackState::Plugged) {
                SetProfileAvailability({Profile::Type::RoutingHeadphones}, true);
            }
            SwitchToPriorityProfile();
            break;
        case EventType::CallMute:

M module-audio/Audio/Operation/RouterOperation.hpp => module-audio/Audio/Operation/RouterOperation.hpp +7 -0
@@ 34,6 34,12 @@ namespace audio
            Disabled
        };

        enum class JackState : bool
        {
            Plugged,
            Unplugged
        };

      public:
        RouterOperation(const char *file, AudioServiceMessage::Callback callback);
        ~RouterOperation();


@@ 55,6 61,7 @@ namespace audio
        static constexpr Endpoint::Capabilities routerCapabilities{.minBlockSize = minimumBlockSize,
                                                                   .maxBlockSize = maximumBlockSize};
        Mute mute = Mute::Disabled;
        JackState jackState = JackState::Unplugged;

        void Mute();
        void Unmute();