<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[My problem is to add codec to my webrtc]]></title><description><![CDATA[<p dir="auto">hello guys im coding a new webrtc while the codec function works fine in chrome edge brave browsers it picks opus and H246 If i try opera gx it pick rtx and AUDIO G722</p>
<pre><code>
function forceH264Codec(sdp) {
    const lines = sdp.split('\r\n');
    let mLineIndex = -1;
    for (let i = 0; i &lt; lines.length; i++) {
        if (lines[i].startsWith('m=video')) {
            mLineIndex = i;
            break;
        }
    }

    if (mLineIndex === -1) {
        console.warn("No 'm=video' line found in SDP, cannot force H264");
        return sdp;
    }

    const h264PayloadTypes = lines
        .filter(line =&gt; line.startsWith('a=rtpmap') &amp;&amp; line.includes('H264'))
        .map(line =&gt; line.split(':')[1].split(' ')[0]);

    if (h264PayloadTypes.length === 0) {
        console.warn("No H264 payload types found in SDP, cannot force H264");
        return sdp;
    }

    const originalMLine = lines[mLineIndex];
    const mLineParts = originalMLine.split(' ');
    let preferredMLine = mLineParts.slice(0, 3); // 'm=video', port, protocol
    preferredMLine.push(...h264PayloadTypes); // Add H264 payload types first

    // Add back other non-H264 payload types if any were present (though usually not needed when forcing H264)
    const existingPayloadTypes = new Set(mLineParts.slice(3));
    const otherPayloadTypes = [...existingPayloadTypes].filter(pt =&gt; !h264PayloadTypes.includes(pt)); // Ensure no duplicates
    preferredMLine.push(...otherPayloadTypes);


    lines[mLineIndex] = preferredMLine.join(' ');
    return lines.join('\r\n');
}


 Stats: 
{codec: {…}, packetsLost: 0, packetsReceived: 0, lossRate: '0%', bytesReceived: '0.00 MB', …}
bytesReceived: "0.00 MB"
codec: {mimeType: 'video/rtx', payloadType: 99, clockRate: 90000, channels: undefined}
currentBitrate: "0 kbps"
frameHeight: undefined
frameWidth: undefined
framesDropped: 0
framesPerSecond: 0
framesReceived: 0
lossRate: "0%"
packetsLost: 0
packetsReceived: 0
&lsqb;&lsqb;Prototype&rsqb;&rsqb;: Object
script.js:2445 Increasing bitrate to 3300 kbps
script.js:2554 Audio Stats: 
{codec: {…}, packetsLost: 0, packetsReceived: 0, lossRate: '0%', bytesReceived: '0.00 MB', …}
audioLevel: undefined
bytesReceived: "0.00 MB"
codec: {mimeType: 'audio/G722', payloadType: 9, clockRate: 8000, channels: 1}
jitter: "0 ms"
lossRate: "0%"
packetsLost: 0
packetsReceived: 0
totalSamplesDuration: 0
&lsqb;&lsqb;Prototype&rsqb;&rsqb;: Object

</code></pre>
]]></description><link>https://forums.opera.com/topic/75994/my-problem-is-to-add-codec-to-my-webrtc</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Mar 2026 23:45:46 GMT</lastBuildDate><atom:link href="https://forums.opera.com/topic/75994.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 30 Jan 2025 17:44:46 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to My problem is to add codec to my webrtc on Fri, 31 Jan 2025 00:34:56 GMT]]></title><description><![CDATA[<p dir="auto">and opera made this feature taht makes my website handle more bandwith Disable non-proxied UDP i needed to add turn to the webrtc to solve video not being able to be processed</p>
]]></description><link>https://forums.opera.com/post/369737</link><guid isPermaLink="true">https://forums.opera.com/post/369737</guid><dc:creator><![CDATA[BOSSXXXL]]></dc:creator><pubDate>Fri, 31 Jan 2025 00:34:56 GMT</pubDate></item><item><title><![CDATA[Reply to My problem is to add codec to my webrtc on Thu, 30 Jan 2025 22:48:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forums.opera.com/uid/73">@leocg</a> no opera have all the codecs its like in chrome to open console you use f12 in opera different its same thing for opera they changed a lot of parameters even in codecs</p>
]]></description><link>https://forums.opera.com/post/369736</link><guid isPermaLink="true">https://forums.opera.com/post/369736</guid><dc:creator><![CDATA[BOSSXXXL]]></dc:creator><pubDate>Thu, 30 Jan 2025 22:48:54 GMT</pubDate></item><item><title><![CDATA[Reply to My problem is to add codec to my webrtc on Thu, 30 Jan 2025 22:24:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forums.opera.com/uid/919987">@BOSSXXXL</a> Maybe Opera uses different codecs?</p>
]]></description><link>https://forums.opera.com/post/369732</link><guid isPermaLink="true">https://forums.opera.com/post/369732</guid><dc:creator><![CDATA[leocg]]></dc:creator><pubDate>Thu, 30 Jan 2025 22:24:07 GMT</pubDate></item><item><title><![CDATA[Reply to My problem is to add codec to my webrtc on Thu, 30 Jan 2025 22:07:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forums.opera.com/uid/73">@leocg</a> I'm not trying to add actually the codecs are already there but the parameters are different from chrome</p>
]]></description><link>https://forums.opera.com/post/369728</link><guid isPermaLink="true">https://forums.opera.com/post/369728</guid><dc:creator><![CDATA[BOSSXXXL]]></dc:creator><pubDate>Thu, 30 Jan 2025 22:07:45 GMT</pubDate></item><item><title><![CDATA[Reply to My problem is to add codec to my webrtc on Thu, 30 Jan 2025 21:37:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forums.opera.com/uid/919987">@BOSSXXXL</a> I don't think you can add codecs to Opera</p>
]]></description><link>https://forums.opera.com/post/369725</link><guid isPermaLink="true">https://forums.opera.com/post/369725</guid><dc:creator><![CDATA[leocg]]></dc:creator><pubDate>Thu, 30 Jan 2025 21:37:49 GMT</pubDate></item></channel></rss>