SquashSRS4: Refine SDK

pull/2373/head
winlin 4 years ago
parent a7ab78a588
commit e50582f9c7

@ -181,6 +181,7 @@ The ports used by SRS:
## V4 changes
* v4.0, 2021-05-21, Fix [#2370][bug #2370] bug for Firefox play stream(published by Chrome). 4.0.121
* v4.0, 2021-05-21, RTC: Refine sdk, migrate from onaddstream to ontrack. 4.0.120
* v4.0, 2021-05-21, Tools: Refine configure options. 4.0.119
* v4.0, 2021-05-20, Fix build fail when disable RTC by --rtc=off. 4.0.118
@ -1924,6 +1925,7 @@ Winlin
[bug #2355]: https://github.com/ossrs/srs/issues/2355
[bug #307]: https://github.com/ossrs/srs/issues/307
[bug #2362]: https://github.com/ossrs/srs/issues/2362
[bug #2370]: https://github.com/ossrs/srs/issues/2370
[bug #yyyyyyyyyyyyy]: https://github.com/ossrs/srs/issues/yyyyyyyyyyyyy
[bug #1631]: https://github.com/ossrs/srs/issues/1631

@ -29,6 +29,14 @@
function SrsRtcPublisherAsync() {
var self = {};
// https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
self.constraints = {
audio: true,
video: {
width: {ideal: 320, max: 576}
}
};
// @see https://github.com/rtcdn/rtcdn-draft
// @url The WebRTC url to play with, for example:
// webrtc://r.ossrs.net/live/livestream
@ -56,9 +64,8 @@ function SrsRtcPublisherAsync() {
self.pc.addTransceiver("audio", {direction: "sendonly"});
self.pc.addTransceiver("video", {direction: "sendonly"});
var stream = await navigator.mediaDevices.getUserMedia(
{audio: true, video: {width: {max: 320}}}
);
var stream = await navigator.mediaDevices.getUserMedia(self.constraints);
// @see https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/addStream#Migrating_to_addTrack
stream.getTracks().forEach(function (track) {
self.pc.addTrack(track);
@ -500,7 +507,8 @@ function SrsRtcPlayerAsync() {
function SrsRtcFormatSenders(senders, kind) {
var codecs = [];
senders.forEach(function (sender) {
sender.getParameters().codecs.forEach(function(c) {
var params = sender.getParameters();
params && params.codecs && params.codecs.forEach(function(c) {
if (kind && sender.track.kind !== kind) {
return;
}

@ -68,7 +68,6 @@
</footer>
</div>
<script type="text/javascript">
var pc = null; // Global handler to do cleanup when replaying.
$(function(){
var sdk = null; // Global handler to do cleanup when republishing.
var startPublish = function() {

@ -3096,6 +3096,10 @@ srs_error_t SrsRtcConnection::negotiate_play_capability(SrsRtcUserConfig* ruc, s
for (int j = 0; j < (int)track_descs.size(); ++j) {
SrsRtcTrackDescription* track = track_descs.at(j)->copy();
// We should clear the extmaps of source(publisher).
// @see https://github.com/ossrs/srs/issues/2370
track->extmaps_.clear();
// Use remote/source/offer PayloadType.
track->media_->pt_of_publisher_ = track->media_->pt_;
track->media_->pt_ = remote_payload.payload_type_;

@ -26,6 +26,6 @@
#define VERSION_MAJOR 4
#define VERSION_MINOR 0
#define VERSION_REVISION 120
#define VERSION_REVISION 121
#endif

Loading…
Cancel
Save