mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
RTC: Support av1 for Chrome M90 enabled it. 4.0.91 (#2324)
* RTC: Support av1 for Chrome M90 enabled it. 4.0.91 * RTC: Show codec for WebRTC publisher
This commit is contained in:
parent
a9d39f6946
commit
e8fe66e3ba
7 changed files with 93 additions and 5 deletions
|
@ -470,3 +470,32 @@ function SrsRtcPlayerAsync() {
|
|||
return self;
|
||||
}
|
||||
|
||||
// Format the codec of RTCRtpSender, kind(audio/video) is optional filter.
|
||||
// https://developer.mozilla.org/en-US/docs/Web/Media/Formats/WebRTC_codecs#getting_the_supported_codecs
|
||||
function SrsRtcFormatSenders(senders, kind) {
|
||||
var codecs = [];
|
||||
senders.forEach(function (sender) {
|
||||
sender.getParameters().codecs.forEach(function(c) {
|
||||
if (kind && sender.track.kind !== kind) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (c.mimeType.indexOf('/red') > 0 || c.mimeType.indexOf('/rtx') > 0 || c.mimeType.indexOf('/fec') > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var s = '';
|
||||
|
||||
s += c.mimeType.replace('audio/', '').replace('video/', '');
|
||||
s += ', ' + c.clockRate + 'HZ';
|
||||
if (sender.track.kind === "audio") {
|
||||
s += ', channels: ' + c.channels;
|
||||
}
|
||||
s += ', pt: ' + c.payloadType;
|
||||
|
||||
codecs.push(s);
|
||||
});
|
||||
});
|
||||
return codecs.join(", ");
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,10 @@
|
|||
<label></label>
|
||||
SessionID: <span id='sessionid'></span>
|
||||
|
||||
<label></label>
|
||||
Audio: <span id='acodecs'></span><br/>
|
||||
Video: <span id='vcodecs'></span>
|
||||
|
||||
<label></label>
|
||||
Simulator: <a href='#' id='simulator-drop'>Drop</a>
|
||||
|
||||
|
@ -81,6 +85,14 @@
|
|||
$('#rtc_media_player').prop('srcObject', event.stream);
|
||||
};
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/Media/Formats/WebRTC_codecs#getting_the_supported_codecs
|
||||
sdk.pc.onicegatheringstatechange = function (event) {
|
||||
if (sdk.pc.iceGatheringState === "complete") {
|
||||
$('#acodecs').html(SrsRtcFormatSenders(sdk.pc.getSenders(), "audio"));
|
||||
$('#vcodecs').html(SrsRtcFormatSenders(sdk.pc.getSenders(), "video"));
|
||||
}
|
||||
};
|
||||
|
||||
// For example:
|
||||
// webrtc://r.ossrs.net/live/livestream
|
||||
var url = $("#txt_url").val();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue