Skip to content
This repository was archived by the owner on Jul 12, 2023. It is now read-only.
This repository was archived by the owner on Jul 12, 2023. It is now read-only.

KMS 6.1.1, one2many javascript. Audio quality drop soon after stream started . #17

Closed

Description

@Saradomin

Hello ,

I haved used one2many project and modified it to use audio only .
After the streaming is started , audio quality seems to drop significantly, but the stream has good banwidth.

Client :NodeJS Javascript kurento-one2many-call
KMS : Version: 6.1.1
Found modules:
Module: 'core' version '6.1.2'
Module: 'elements' version '6.1.1'
Module: 'filters' version '6.1.1'
OS : Ubuntu 14.04 for Kms and client, Demo pages were openned from Chrome on Window 8.1.
Links to pictures from peer-to-peer connection test :
http://imgur.com/npIAEWp
http://imgur.com/rac7yC1

I tested the audio using a Fast Track Pro external sound card with a media player. I can quarantee that the sound the audio card gives is perfect quality.
I also did a test by connecting the smartphone into line in soundcard jack and play music .
I also did a test by using virtual sound card (VBCABLE driver) and played songs from media player such as Winamp.
On all, i noticed same behaviour.

Steps to reproduce and result:
Audio stream at first has very good quality, after 4-5 seconds the quallity sudden drops.But the bandwith remains unchanged .

This quality drop is seen with or without SDP changes in code.
I even tried adding properties to Opus codec, but nothing seems to solve it ( https://tools.ietf.org/html/draft-ietf-payload-rtp-opus-11 )

My internet wired connection is 100Mbps in upload and download so i am not considering connection issues.
Here are some configurations i'm using that might help in giving a solution :

//MediaElement.conf.ini

outputBitrate=1500000

/// SdpEndpoint.conf.json
{
"numAudioMedias" : 1,
"numVideoMedias" : 0,
"audioCodecs" : [
{
"name" : "opus/48000/2"
},
{
"name" : "PCMU/8000"
},
{
"name" : "AMR/16000"
}
],

//kurneto-utils .js
//audio only setting
var MEDIA_CONSTRAINTS = {
audio: true,
video:false
};

function set_bandwidth(sdp) {
sdp = sdp.replace(/a=mid:audio\r\n/g, 'a=mid:audio\r\nb=AS:510\r\n'); // biggest bandwidth opus can handle
sdp = sdp.replace(/a=mid:video\r\n/g, 'a=mid:video\r\nb=AS:1000\r\n');
sdp = sdp.replace('a=rtpmap:111 opus/48000/2' , 'a=rtpmap:111 opus/48000/2\r\na=fmtp:111 maxplaybackrate=48000; sprop-maxcapturerate=48000;maxaveragebitrate=510000; stereo=1; useinbandfec=1; usedtx=0; cbr=0;maxptime=120; ');
return sdp;
}

Activity

  1. igracia commented on Dec 4, 2015

    @igracia
    Contributor

    I'm adding the webrtc internals captures here

    viewer
    presenter_test

  2. added
    kms
    on Dec 4, 2015
  3. igracia commented on Dec 4, 2015

    @igracia
    Contributor

    @Saradomin Could you update you KMS to check with the latest version? 'Cos that's the first thing we are going to check ;-)

  4. Saradomin commented on Dec 4, 2015

    @Saradomin
    Author

    ok , i will make the update and i will reply with result and new screenshots if problem remains .Thank you

  5. Saradomin commented on Dec 5, 2015

    @Saradomin
    Author

    Hello again ,

    Sorry for delay.
    I updated the KMS :

    Here is the output of 'kurento-media-server -v':
    Version: 6.2.0
    Found modules:
    Module: 'core' version '6.2.0'
    Module: 'elements' version '6.2.0'
    Module: 'filters' version '6.2.0'

    I did the tests on the source with my changes and the original source and i have same behaviour.
    Quality still drops after first seconds .I can't really understand why this happens .
    Here are the picture for presenter (first) and viewer.

    Thank you again for support .

    pres2

    screenshot 2015-12-04 18 12 40 1

  6. igracia commented on Dec 7, 2015

    @igracia
    Contributor

    Thanks. Let us check some things and we'll try debug this with you.

    Could you provide us with your test project?

  7. Saradomin commented on Dec 7, 2015

    @Saradomin
    Author

    yes , i will send it shortly

  8. dfernandezlop commented on Dec 7, 2015

    @dfernandezlop

    Hi @Saradomin,

    I have checked the one2many demo in Chrome on Windows 7 (only one available for me right now) and everything seem to work fine. I have several questions:

    • Have you checked the demo using the microphone of the computer?
    • Could you check using audio and video (both from webcam) and check the behaviour.
    • Could you record the audio and attach it. It will be useful to check the audio quality that you receives and what means drops. Remember that the presenter browser encode the audio and the viewer browser descompress the audio, and it is possible that there are a quality loss.
    • Have you tested your use case using a simple webrtc p2p application?

    Thanks.

  9. Saradomin commented on Dec 7, 2015

    @Saradomin
    Author

    with microphone (my voice ), you cannot notice the quality drop . Only when playing songs from external sources the quality of the songs i receive as viewer is terrible . Good in first 3-5 seconds , then quality of the sound heard is reduced .

    (or internal if using virtual sound card which basically takes the output of application (winamp) and redirects it to a virtual input .If on windows i set "listen" on presenter computer that virtual device quality is perfect . So i know that the virtual sound card does its job good .)

    I havent tested with any other webrtc applications because kurento uses opus ; and i knew this encoding is the best available . I will try to use other examples from Internet .

  10. dfernandezlop commented on Dec 7, 2015

    @dfernandezlop

    It's a good idea test with a peer2peer aplicattion, because it seems like a problem between your virtual sound card and chrome. If other application works fine we can check our opus encoder/decoder.

    In the other hand, could you test with Firefox?

  11. Saradomin commented on Dec 8, 2015

    @Saradomin
    Author

    Hello,
    I have tried with other peer2peer appications (jitsi, easyRTC) and the overall quality is the same . Really bad in streaming music with webrtc . Also i tested on Firefox, no improvement.
    I have also used Icecast2 server with SAMbroadcast client for comparison and quality is perfect but Icecast is not real-time (there is huge delay ~7s between live feed and viewer feed ).

    I must ask . Is it really no solution to tweak the quality from Kurento ?

  12. Saradomin commented on Dec 8, 2015

    @Saradomin
    Author

    Im sharing this piece of code which is my modification of the SDP ,in order to force bandwidth and opus parameters . Maybe i missed something .
    I forced SDP parameters soon after SDP was created and before being added to peerconnection . I thought is enough to modify only in this.generateOffer since presenter and viewer share same code and the offer will be processed and an answer is generated from it .
    I must repeat this is kurento-one2many-call project :

    //set bandwidth function i used :
    function set_bandwidth(sdp) {
    sdp = sdp.replace(/a=mid:audio\r\n/g, 'a=mid:audio\r\nb=AS:510\r\n');
    sdp = sdp.replace(/a=mid:video\r\n/g, 'a=mid:video\r\nb=AS:3000\r\n');

       sdp = sdp.replace('a=rtpmap:111 opus/48000/2' , 'a=rtpmap:111 opus/48000/2\r\na=fmtp:111 maxplaybackrate=48000; sprop-maxcapturerate=48000;maxaveragebitrate=510000; stereo=1; useinbandfec=0; usedtx=0; cbr=0;maxptime=120; ');
      sdp = sdp.replace('a=fmtp:111 minptime=10;','a=fmtp:111 minptime=60;');
      sdp = sdp.replace('minptime=60; useinbandfec=1','minptime=60;');
    return sdp;
    

    }

    //this.generateOffer function snippet :

    pc.createOffer(function (offer) {
    console.log('Created SDP offer');
    if (simulcast) {
    if (browser.name === 'Chrome' || browser.name === 'Chromium') {
    console.log('Adding multicast info');
    offer = new RTCSessionDescription({
    'type': offer.type,
    'sdp': set_bandwidth(removeFIDFromOffer(offer.sdp)) + getSimulcastInfo(videoStream)
    });
    } else {
    console.warn('Simulcast is only available in Chrome browser.');
    }
    }
    offer.sdp= set_bandwidth(offer.sdp);
    pc.setLocalDescription(offer, function () {
    console.log('Local description set', /set_bandwidth(/offer.sdp/)/);
    callback(null, offer.sdp, self.processAnswer.bind(self));
    }, callback);
    }, callback, constraints);

  13. igracia commented on Dec 18, 2015

    @igracia
    Contributor

    I'm afraid this is not an issue with tweaking Kurento, but how your audio source gets treated by the browsers. Kurento can't do much if the audio quality that arrives is bad. You should probably inquire in other forums how can you raise the quality of the audio encoded by the browsers.

    Closing this issue.

  14. added
    not-a-bug
    on Dec 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kmsnot-a-bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions