1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

SquashSRS4: Refine SDK

This commit is contained in:
winlin 2021-05-21 19:57:59 +08:00
parent a7ab78a588
commit e50582f9c7
6 changed files with 102 additions and 89 deletions

View file

@ -181,6 +181,7 @@ The ports used by SRS:
## V4 changes ## 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, 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-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 * 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 #2355]: https://github.com/ossrs/srs/issues/2355
[bug #307]: https://github.com/ossrs/srs/issues/307 [bug #307]: https://github.com/ossrs/srs/issues/307
[bug #2362]: https://github.com/ossrs/srs/issues/2362 [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 #yyyyyyyyyyyyy]: https://github.com/ossrs/srs/issues/yyyyyyyyyyyyy
[bug #1631]: https://github.com/ossrs/srs/issues/1631 [bug #1631]: https://github.com/ossrs/srs/issues/1631

View file

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

View file

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

View file

@ -3096,6 +3096,10 @@ srs_error_t SrsRtcConnection::negotiate_play_capability(SrsRtcUserConfig* ruc, s
for (int j = 0; j < (int)track_descs.size(); ++j) { for (int j = 0; j < (int)track_descs.size(); ++j) {
SrsRtcTrackDescription* track = track_descs.at(j)->copy(); 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. // Use remote/source/offer PayloadType.
track->media_->pt_of_publisher_ = track->media_->pt_; track->media_->pt_of_publisher_ = track->media_->pt_;
track->media_->pt_ = remote_payload.payload_type_; track->media_->pt_ = remote_payload.payload_type_;

View file

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