androidc++stagefright

Undefined Reference to android::LPAPlayer::*


I am having great difficulty with a step in compiling CyanogenMod 11(Android 4.4) for an unsupported device based on an MSM7x27A/Snapdragon S1 platform. When I attempt to build libstagefright, I come up with an undefined reference error to functions in android::LPAPlayer::*, including the constructor. The error I get is:

Copying: /home/dyngar-f/android/android/out/target/common/obj/JAVA_LIBRARIES/mms-common_intermediates/noproguard.classes.jar
frameworks/av/media/libstagefright/AwesomePlayer.cpp:1282: error: undefined reference to 'android::LPAPlayer::LPAPlayer(android::sp<android::MediaPlayerBase::AudioSink> const&, bool&, android::AwesomePlayer*)'
frameworks/av/media/libstagefright/AwesomePlayer.cpp:1306: error: undefined reference to 'android::LPAPlayer::mObjectsAlive'
frameworks/av/media/libstagefright/AwesomePlayer.cpp:1882: error: undefined reference to 'android::LPAPlayer::mObjectsAlive'
collect2: error: ld returned 1 exit statusbuild/core/shared_library.mk:81: recipe for target '/home/dyngar-f/android/android/out/target/product/schS738c/obj/SHARED_LIBRARIES/libstagefright_intermediates/LINKED/libstagefright.so' failed
make: *** [/home/dyngar-f/android/android/out/target/product/schS738c/obj/SHARED_LIBRARIES/libstagefright_intermediates/LINKED/libstagefright.so] Error 1make: *** Waiting for unfinished jobs....

I have searched high and low and I found no mention of this error that leads me to a solution to this problem, and I haven't arrived at a solution myself. Here are the references to this issue I have found from others:

Gist from CMartinBaughman
Mentioned in XDA Thread on this page there is also an answer that doesn't seem to work.

Can anyone guide me to a solution for this issue?


Solution

  • The error is coming from the linker which is unable to find the reference to LPAPlayer which is actually a customization in CyanogenMod sources. From the latest tree, Android.mk for libstagefright is not including LPAPlayer.cpp for all platforms.

    To resolve your issue, please try by adding the following files in Android.mk between lines 114-117

    #New lines included
    ifeq ($(call is-chipset-in-board-platform,msm7x27),true)
        LOCAL_SRC_FILES += LPAPlayer.cpp
        LOCAL_CFLAGS += -DLEGACY_LPA -DUSE_LPA_MODE
    endif
    
    ifeq ($(call is-chipset-in-board-platform,msm7x30),true)
       LOCAL_SRC_FILES += LPAPlayer.cpp
       LOCAL_CFLAGS += -DLEGACY_LPA -DUSE_LPA_MODE
    endif
    

    The platform name may need to be modified to suit the actual name (Please refer to BoardConfig.mk).