Welcome to the new FlexRadio Community! Please review the new Community Rules and other important new Community information on the Message Board.
If you are having a problem, please check the Help Center for known solutions.
Need technical support from FlexRadio? It's as simple as Creating a HelpDesk ticket.

OPUS paypload

W4WHLW4WHL Member
edited February 2017 in SmartSDR API
How do I start an Opus stream using TCP commands?

I have tried

stream create opus

remote_audio rx_on 1

"remote_audio rx_on 1" mutes lineout and headphone, but no stream is created

Any help on how to start the stream.  Since I do not use the API, how do I tell the radio to start the stream?

Regards,

William






Answers

  • Ed.GEd.G FlexRadio Employee ✭✭
    edited February 2017
    If you have specified that your client is the GUI client via the command "client gui" then when you send the UDP port command "client udpport <port>" it automatically creates an OpusStream for that client so you should receive something along the lines of:
    S61EF7B6A|opus_stream 0x4A000000 ip=192.168.22.226 port=4993 opus_rx_stream_stopped=0 rx_on=1 tx_on=0 
    Then when you enable remote audio with "remote_audio rx_on 1" the data begins streaming over UDP using the SL_VITA_OPUS_CLASS = 0x8005 for the PacketClassCode and the stream ID supplied in the status message.


  • W4WHLW4WHL Member
    edited July 2016
    Brilliant Ed.  That worked!  Thanks a ton!  Now receiving class 8005 packets.



    William
  • W4WHLW4WHL Member
    edited February 2017
    New question.

    What is the sample rate?

    Also when setting client udpport to say 4994, does that send all data to that port, including metering, waterfall etc?

    Thanks!

    William
  • W4WHLW4WHL Member
    edited July 2016
    And one more question I can't figure out.

    When I do a "client gui" it automatically creates a panadapter with x=50 and y=0.  If I try setting client gui after I create the panadapter, it does nothing and does not create opus stream.

    So how do I reconfigure the panadapter to the correct x/y paramenters after doing a client gui?  I even tried removing the panadapter and recreating it the correct size, but it then kills the opus stream.

    And like I said, I can not do a client gui after panadapter creation.  The only thing I found that sorta works is, Do a client gui, create new panadapter with proper parameters, use second panadapter.  But I only want a single panadapter, as this floods my app with 2 panadapter streams.

    What am I missing here?

    William
  • W4WHLW4WHL Member
    edited July 2016
    Nevermind this question, I figured it out.  I have to do it in this order

    create pan
    client gui
    client udpport
    remote_audio on


    Now if you could just help me out on the OPUS specs.   Such as;

    Bitrate
    sample rate
    etc

    Anything you have will be helpful

    Regards,

    William
  • Phil - N4MTPhil - N4MT Member
    edited May 2015
    The radio sends 2 channels at 24kHz at 10 ms duration in each packet. You will decode 240 samples per packet and that is the max frame size you pass to the decoder. (Note: the decoded data is interlaced, in case you need to de-interlace it to play it.)
  • W4WHLW4WHL Member
    edited July 2016
    Isnt this the specs for DAX?
  • W4WHLW4WHL Member
    edited July 2016
    The packets I'm seeing for class 0x8005 in wireshark are only 138bytes. 18 bytes for Ethernet, 28 bytes for IP/UDP headers + 28 bytes for VRT header leaves only 64 bytes for payload.  Is this correct?
  • Phil - N4MTPhil - N4MT Member
    edited May 2015
    Yes, sounds right, but packets will be varying lengths since the data will compress to a different amount.
    samples: 240 bytes: 69 packet_count: 0 
    samples: 240 bytes: 63 packet_count: 1 
    samples: 240 bytes: 80 packet_count: 2 
    samples: 240 bytes: 67 packet_count: 3 
    samples: 240 bytes: 64 packet_count: 4 
    samples: 240 bytes: 64 packet_count: 5 


  • W4WHLW4WHL Member
    edited July 2016
    Thanks Phil!
  • W4WHLW4WHL Member
    edited February 2017
    I'm still not 100% sure on the OPUS packets.  I have studied the API files and really don't understand what is happening with these packets.  What I did get from the API was that the payload is packetdata-28 bytes.  So in this example packet we have:

    38:dc:00:17: Header
    4a:00:00:00: Stream ID
    00:00:1c:2d: OUI
    53:4c:80:05: Class ID
    00:00:00:00: unused
    00:00:00:00: unused
    00:00:00:00: unused

    d4:04:63:76: Payload (this is variable length)
    8d:74:63:15:
    12:c5:b7:d6:
    19:ea:68:de:
    ed:b9:6d:9f:
    2c:e9:4a:3b:
    54:df:d8:9e:
    d0:23:63:e4:
    c3:0f:64:fc:
    ee:12:c3:84:
    92:37:7d:82:
    e0:72:3a:60:
    13:51:81:31:
    bb:e8:56:39:
    38:0d:99:e6:
    cf:0f:c3:0f:e8

    So, I'm attempting to send the payload directly to a OPUS decoder, but it does not like the format.  So what is the format of the payload?  What do I need to do with this data before it is sent to decoder.  Is there information I need to extract from this payload in order to decode it?

    Can one of the flex engineers give me a high level breakdown of how OPUS packets are formatted?

    Sorry for all the questions, but I do not follow C# well.

    Regards,

    William


  • Steve-N5ACSteve-N5AC Community Manager admin
    edited December 2016
    Phil who has been responding to you has implemented Opus also William.  I do not know the details on the Opus data stream directly -- we simply encapsulate the data from Opus and provide it to the codec (Opus).  You shouldn't need to understand the format either.  If Opus doesn't like what you are sending, you should look at how you're packaging the data.  For example, if you take individual bytes out of the data we provide and then store them in an integer array and pass to Opus, it's likely to ****.  You should match the data type in the call you're making to Opus and avoid data conversion in the process.
  • W4WHLW4WHL Member
    edited July 2016
    Steve, I'm passing a straight byte array to the codec.  I am only stripping off the first 28 bytes of header, stream ID, etc. 

    Its highly possible that there is an issue with my codec implementation or the codec itself.

    This is a very new codec for android, and its possible it might not function correctly on my device.  I will look more into my code, since you have now confirmed that I just need to pass the payload directly to the codec.

    Thanks,

    William
  • Ed.GEd.G FlexRadio Employee ✭✭
    edited December 2016
    Another thing to check is that you are using the float decode function of Opus since it has both an integer decode and a float decode. In FlexLib we use an Opus library whose default is the integer version which is called "DecodePacket" but we use "DecodePacketFloat".

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.