Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9ea65d0f authored by Glenn Kasten's avatar Glenn Kasten
Browse files

Fix uses of KeyedVector

Constructor for AudioFlinger::mAudioHwDevs was missing, and so
AudioFlinger::findSuitableHwDev_l() could return an undefined pointer
if a non-0 module wasn't found.

A KeyedVector of Plain Old Data (POD) element type must specify the
default value in the constructor, or else the default will be undefined.

Minor:
 - Parameter had wrong type in constructor for AudioSystem::gOutputs.
 - Remove obsolete AudioSystem::gStreamOutputMap.

Change-Id: I9841493e018440e559d8b8b0e4e748ba2b2d365b
parent 1392eb3d
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -318,8 +318,6 @@ private:

    static sp<IAudioPolicyService> gAudioPolicyService;

    // mapping between stream types and outputs
    static DefaultKeyedVector<audio_stream_type_t, audio_io_handle_t> gStreamOutputMap;
    // list of output descriptors containing cached parameters
    // (sampling rate, framecount, channel count...)
    static DefaultKeyedVector<audio_io_handle_t, OutputDescriptor *> gOutputs;
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ sp<AudioSystem::AudioFlingerClient> AudioSystem::gAudioFlingerClient;
audio_error_callback AudioSystem::gAudioErrorCallback = NULL;
// Cached values

DefaultKeyedVector<audio_io_handle_t, AudioSystem::OutputDescriptor *> AudioSystem::gOutputs(0);
DefaultKeyedVector<audio_io_handle_t, AudioSystem::OutputDescriptor *> AudioSystem::gOutputs(NULL);

// Cached values for recording queries, all protected by gLock
uint32_t AudioSystem::gPrevInSamplingRate;
+1 −0
Original line number Diff line number Diff line
@@ -159,6 +159,7 @@ out:
AudioFlinger::AudioFlinger()
    : BnAudioFlinger(),
      mPrimaryHardwareDev(NULL),
      mAudioHwDevs(NULL),
      mHardwareStatus(AUDIO_HW_IDLE),
      mMasterVolume(1.0f),
      mMasterMute(false),