This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

know the negotiated codec (aac or sbc)



Hello,

I used the Bluetopia Platform Manager.

With the good SS1BTPM, I can use my gst-launch pipeline with aac (iphone) and another gst-lauch with sbc (old android).

In the HCI log (by DEVM_EnableBluetoothDebug function), I can saw the right capability (SBC or AAC)

In my application, I need to know the negotiated codec to start the good gst-launch.

I used the AUDM_Query_Audio_Stream_Configuration () function at different times, but the MediaCodecType parameter is always at the same value.

Have you ever had this problem ?

 

Sincerely

Thomas

  • Hi Thomas,

    Does AUDM_Query_Audio_Stream_Configuration return SBC every time for the MediaCodecType parameter? What value are you receiving for the MediaCodecType?

    Thanks,
    Jacob

  • Hi Jacob,

    I called the AUDM_Query_Audio_Stream_Configuration function in the audio AUDM_Event_Callback (case aetAudioStreamConnected).
    I checked parameters (good device addresse, astSNK) and I checked the return parameter.

    The MediaCodecType is always at 0.

    Though I stream with my aac gst-lauch pipeline.

    Thanks,

    Thomas.

  • Hi Thomas,

    I'll try to provide more insight here on tomorrow or early next week.

    Thank you for your patience,

    Jacob

  • Hi Thomas,

    If you are receiving 0x00 for the MediaCodecType, this means your application is defaulting to use the SBC codec. In the A2DPAPI.h file, you can find the media codec type constants:

    These constants are created based on the Bluetooth assigned numbers for A2DP:

    It seems like your program needs to specify the AAC codec for iPhone. Does your gst-launch currently work with Android?

    Can you try setting the AAC codec by using the AUD_Change_Stream_Format function? In this API, you can specify AAC with "AUD_STREAM_FORMAT_FLAGS_CODEC_TYPE_AAC."

    Best regards,
    Jacob

  • Hi,,

    Thanks for your answer Jacob. but my problem is not in this direction.

    I don't need to force the codec type. It's automatic between the stack and the smartphone
    It works very well.
    If I connect an Iphone, I start a gst-launch with the aac codec and it works
    If I connect an Android (old android with only sbc), I start a gst-launch with the sbc codec and it works.


    My goal : start automatically a gst-launch with the right codec.

    So I need to know which codec was decided between the stack and the phone.

    I looked in the HCI logs and I can clearly see this negotiation.
    But I will not parse the HCI logs to know the negotiated codec.

    The AUDM_Query_Audio_Stream_Configuration function should give me this information, right?

    Sincerely, Thomas.

  • Hi Thomas,

    I believe that is the correct function. I'll check to see if there is another function for your use case tomorrow.

    Thanks,
    Jacob

  • Hi Thomas,

    Looking into this some more, I could not find a better API to use. I will have to reproduce this issue on my end.

    Thanks,

    Jacob

  • Hi Thomas,

    Can you show me how you call gst-launch with the return value from AUDM_Query_Audio_Stream_Configuration()? I'm wondering if there is a way for you to identify that you are using iPhone versus Android before calling gst-launch. It seems that BluetopiaPM is defaulting to SBC regardless of which phone you use.

    Also, are you using an external codec? I do not think our controllers support AAC if you are sending audio over I2S.

    Thanks,
    Jacob