1. 18 Nov, 2021 1 commit
    • Hui Wang's avatar
      card-restore: setting preferred ports in entry_from_card · 484b6986
      Hui Wang authored
      
      
      If the preferred ports are not set in this function, the
      entrys_equal() always returns false in the card_put_hook_callback().
      This will make the entry be written into the metadata and the
      preferred ports will be cleaned by a mistake.
      
      And we met a hdmi audio bug which has sth to do with this issue, on
      the machines with the legacy HDA audio driver, the hdmi port has lower
      priority than speaker, users need to manually select the hdmi to be
      active output port, then the preferred output port is hdmi for this
      sound card, after reboot, the card_put_hook_callback() in the
      module-card-restore.c will be called and the preferred ports are
      cleaned by a mistake, then the hdmi output port or hdmi sink couldn't
      switch to be active after reboot or resume automatically. That is
      because the preferred ports are cleaned and hdmi port has lower
      priority than speaker, the profile_good_for_output() in the
      module-switch-on-port-available.c always returns false.
      
      Signed-off-by: Hui Wang's avatarHui Wang <hui.wang@canonical.com>
      484b6986
  2. 10 Jun, 2021 1 commit
    • Igor Kovalenko's avatar
      card: handle sticky profile flag · e576bd92
      Igor Kovalenko authored and PulseAudio Marge Bot's avatar PulseAudio Marge Bot committed
      New card database entry version 5 for card profile is sticky flag.
      New messaging API handlers set-profile-sticky and get-profile-sticky.
      
      When card profile is sticky, always restore it even if it is unavailable,
      and prevent switching from it when ports become unavailable.
      
      Part-of: <!568>
      e576bd92
  3. 07 Jan, 2021 1 commit
  4. 16 Jun, 2020 1 commit
  5. 08 Dec, 2019 1 commit
  6. 22 Jul, 2018 1 commit
    • João Paulo Rechi Vita's avatar
      card-restore: Don't restore profile on Bluetooth cards by default · 1f45082c
      João Paulo Rechi Vita authored and Tanu Kaskinen's avatar Tanu Kaskinen committed
      We can provide a better overall user experience with Bluetooth cards by
      always choosing the higher audio quality profile (A2DP) by default and
      updating the profile selection dynamically according to which streams
      are active at a certain moment. The default initial selection has been
      addressed by "85daab27 bluetooth: set better priorities for profiles"
      and the dynamic profile selection is covered by module-bluetooth-policy.
      
      In addition, module-card-restore's database entries for Bluetooth devices
      are retained after a device is removed from the system, leading to the
      previously selected profile being restored after a new pairing with the
      same device, with no way for the user to erase this memory and reset the
      default profile except manually fiddling with module-card-restore's
      database.
      
      This commit adds a module argument to have module-card-restore ignore
      Bluetooth profiles and this behavior is set as default.
      1f45082c
  7. 12 Dec, 2017 1 commit
  8. 21 Nov, 2017 2 commits
  9. 10 Aug, 2016 1 commit
    • Tanu Kaskinen's avatar
      card-restore: don't switch profiles when availability changes · c538bc7a
      Tanu Kaskinen authored
      module-card-restore should only restore the initial state of new
      cards, but profile_available_changed_callback() changed the profile
      whenever the saved profile became available. That caused interference
      with module-bluetooth-policy, which also sets card profiles based on
      the availability changes.
      
      The original reason for having this code was to work around the
      problem that bluetooth cards used to be created with only one profile
      available, and other profiles would become available soon after the
      card creation. Now the bluetooth card creation is delayed until all
      profiles are available, so this bad workaround can be removed.
      
      Discussion:
      https://lists.freedesktop.org/archives/pulseaudio-discuss/2016-August/026575.html
      c538bc7a
  10. 28 Jun, 2016 1 commit
    • Tanu Kaskinen's avatar
      card: move profile selection after pa_card_new() · 7b626014
      Tanu Kaskinen authored
      I want module-alsa-card to set the availability of unavailable
      profiles before the initial card profile gets selected, so that the
      selection logic can use correct availability information.
      module-alsa-card initializes the jack state after calling
      pa_card_new(), however, and the profile selection happens in
      pa_card_new(). This patch solves that by moving parts of pa_card_new()
      to pa_card_choose_initial_profile() and pa_card_put().
      
      pa_card_choose_initial_profile() applies the profile selection policy,
      so module-alsa-card can first call pa_card_new(), then initialize the
      jack state, and then call pa_card_choose_initial_profile(). After that
      module-alsa-card can still override the profile selection policy, in
      case module-alsa-card was loaded with the "profile" argument. Finally,
      pa_card_put() finalizes the card creation.
      
      An alternative solution would have been to move the jack
      initialization to happen before pa_card_new() and use pa_card_new_data
      instead of pa_card in the jack initialization code, but I disliked
      that idea (I want to get rid of the "new data" pattern eventually).
      
      The order in which the initial profile policy is applied is reversed
      in this patch. Previously the first one to set it won, now the last
      one to set it wins. I think this is better, because if you have N
      parties that want to set the profile, we avoid checking N times
      whether someone else has already set the profile.
      7b626014
  11. 03 May, 2016 1 commit
  12. 08 Mar, 2016 1 commit
  13. 22 Nov, 2015 2 commits
  14. 16 Sep, 2015 1 commit
  15. 10 Apr, 2015 1 commit
  16. 26 Feb, 2015 1 commit
  17. 14 Jan, 2015 1 commit
  18. 19 Dec, 2014 1 commit
    • Tanu Kaskinen's avatar
      card-restore: Fix profile restoring with bluetooth · 1d3fd4f8
      Tanu Kaskinen authored and David Henningsson's avatar David Henningsson committed
      The bluetooth card is created when the first profile becomes
      available, which means that the card may have profiles that are not
      available when the card is initialized. If module-card-restore tries
      to restore such profile, that will fail, and the card will be
      initialized with the "off" profile active.
      
      This patch modifies module-card-restore so that if follows the profile
      availability status, and when the saved profile becomes available, it
      is activated. Additionally, module-card-restore is modified so that it
      doesn't even try to restore unavailable profiles, when the necessary
      information is available. In practice there are two existing places
      where the profile is restored, and only one of those contexts has the
      necessary information available. Unfortunately, it's the more
      important context (card creation) where the information is not
      available. This means that module-card-restore will set the initial
      profile of a new card even if the profile is unavailable, and this
      will cause an ugly warning in the log, even though there's nothing
      abnormal happening.
      
      BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=87081
      1d3fd4f8
  19. 28 Oct, 2014 1 commit
  20. 29 Jan, 2014 1 commit
  21. 20 Dec, 2013 1 commit
  22. 29 Nov, 2013 1 commit
    • Tanu Kaskinen's avatar
      Pass the profile object instead of the profile name to pa_card_set_profile() · ce304d62
      Tanu Kaskinen authored
      When setting attribute foo, or in this case the card profile, in my
      opinion the thing passed to the set_foo() function should be of the
      type of foo, not a string identifier that can be used to search for
      the actual foo in set_foo().
      
      This is mostly a question of taste, but there's at least some small
      benefit from passing the actual object: often the profile object is
      already available when calling pa_card_set_profile(), so passing the
      card name would cause unnecessary searching when pa_card_set_profile()
      needs to look up the profile from the hashmap.
      ce304d62
  23. 17 Sep, 2013 1 commit
    • Arun Raghavan's avatar
      hashmap: Add the ability to free keys · 6825df8c
      Arun Raghavan authored
      Since the hashmap stores a pointer to the key provided at pa_hashmap_put()
      time, it make sense to allow the hashmap to be given ownership of the key and
      have it free it at pa_hashmap_remove/free time.
      
      To do this cleanly, we now provide the key and value free functions at hashmap
      creation time with a pa_hashmap_new_full. With this, we do away with the free
      function that was provided at remove/free time for freeing the value.
      6825df8c
  24. 08 Sep, 2013 1 commit
  25. 04 Jul, 2013 1 commit
    • poljar (Damir Jelić)'s avatar
      Remove pa_bool_t and replace it with bool. · d806b197
      poljar (Damir Jelić) authored
      commands used for this (executed from the pulseaudio/src directory):
          find . -regex '\(.*\.[hc]\|.*\.cc\|.*\.m4\)' -not -name 'macro.h' \
              -a -not -name 'reserve.[ch]' -a -not -name 'reserve-monitor.[ch]' \
              -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
              -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
              -a -not -name 'poll-win32.c' -a -not -name 'thread-win32.c' \
              -a -not -name 'dllmain.c' -a -not -name 'gconf-helper.c' \
              -exec sed -i -e 's/\bpa_bool_t\b/bool/g' \
              -e 's/\bTRUE\b/true/g' -e 's/\bFALSE\b/false/g' {} \;
      
      and:
          sed -i -e '181,194!s/\bpa_bool_t\b/bool/' \
              -e '181,194!s/\bTRUE\b/true/' -e \
              '181,194!s/\bFALSE\b/false/' pulsecore/macro.h
      d806b197
  26. 27 Mar, 2013 1 commit
    • Mikel Astiz's avatar
      Revert "card: Support adding ports dynamically" · 3d65e9c4
      Mikel Astiz authored and Tanu Kaskinen's avatar Tanu Kaskinen committed
      This reverts commit a9c3f2fb.
      
      It has been recently agreed that ports should somehow have some physical
      meaning, leading to the port merge in module-bluetooth-device.
      
      With this assumption in mind, it is very unlikely that a card would
      add or remove ports dynamically. Therefore, the core can be simplified
      by removing the support for this.
      
      The revert affects the code added to module-card-restore in commit
      a1a0ad1a, which can now be partially
      removed.
      
      Conflicts:
      	src/pulsecore/card.c
      	src/pulsecore/core.h
      3d65e9c4
  27. 15 Feb, 2013 1 commit
    • Tanu Kaskinen's avatar
      hashmap: Use pa_free_cb_t instead of pa_free2_cb_t · 8872c238
      Tanu Kaskinen authored
      The previous patch removed module-gconf's dependency on the userdata
      pointer of the free callback, and that was the only place where the
      userdata pointer of pa_free2_cb_t was used, so now there's no need for
      pa_free2_cb_t in pa_hashmap_free(). Using pa_free_cb_t instead allows
      removing a significant amount of repetitive code.
      8872c238
  28. 21 Jan, 2013 1 commit
  29. 19 Dec, 2012 1 commit
  30. 06 Jul, 2012 1 commit
  31. 05 Jul, 2012 1 commit
  32. 29 Jun, 2012 1 commit
    • Tanu Kaskinen's avatar
      card: Ensure that there's always at least one profile. · 12af302a
      Tanu Kaskinen authored
      In practice there is always at least one profile, and I
      don't think there will ever be cards without profiles.
      Therefore, I added assertions to pa_card_new() stating that
      the card new data must always contain at least one profile.
      Now a lot of code can be simplified, because it's guaranteed
      that the profiles hashmap and the active_profile field are
      always non-NULL.
      12af302a
  33. 31 May, 2012 1 commit
  34. 12 Aug, 2011 1 commit
    • Maarten Bosmans's avatar
      Plug some memory leaks and an invalid read · b430407f
      Maarten Bosmans authored
      Note in protocol-dbus.c specifically, method_signatures needs to be freed
      before method_handlers, because otherwise h->method_name is freed while it is
      still in use as a key in the method_signatures hashmap.
      b430407f
  35. 22 Jun, 2011 3 commits
    • Maarten Bosmans's avatar
      Remove unnecessary #includes · dd9265ac
      Maarten Bosmans authored
      dd9265ac
    • Colin Guthrie's avatar
      database: Support legacy format database entries. · 9ffa9382
      Colin Guthrie authored
      This adds code to specifically support legacy entries.
      I kept this code in a separate commit so that it can be (relatively)
      easily removed at some point in the future.
      9ffa9382
    • Colin Guthrie's avatar
      database: Convert our use of database files to save in tagstruct format. · 695d5363
      Colin Guthrie authored
      This has the advantage of allowing versioned updates in the future,
      thus allowing us to be more user friendly going forward (as opposed
      to just ignoring entries from old versions).
      
      The primary motivation for this, however, is to allow variable length
      storage in each entry which will be needed for upcoming work.
      
      At present this commit will ignore any legacy entries but support
      for reading and subsequently converting legacy entries will be added
      shortly.
      695d5363
  36. 18 Mar, 2011 1 commit