|
@@ -1346,7 +1346,7 @@ const enforceSendRecv = function(localDescription, options) {
|
1346
|
1346
|
}
|
1347
|
1347
|
|
1348
|
1348
|
const transformer = new SdpTransformWrap(localDescription.sdp);
|
1349
|
|
- const audioMedia = transformer.selectMedia(MediaType.AUDIO);
|
|
1349
|
+ const audioMedia = transformer.selectMedia(MediaType.AUDIO)?.[0];
|
1350
|
1350
|
let changed = false;
|
1351
|
1351
|
|
1352
|
1352
|
if (audioMedia && audioMedia.direction !== MediaDirection.SENDRECV) {
|
|
@@ -1359,7 +1359,7 @@ const enforceSendRecv = function(localDescription, options) {
|
1359
|
1359
|
changed = true;
|
1360
|
1360
|
}
|
1361
|
1361
|
|
1362
|
|
- const videoMedia = transformer.selectMedia(MediaType.VIDEO);
|
|
1362
|
+ const videoMedia = transformer.selectMedia(MediaType.VIDEO)?.[0];
|
1363
|
1363
|
|
1364
|
1364
|
if (videoMedia && videoMedia.direction !== MediaDirection.SENDRECV) {
|
1365
|
1365
|
videoMedia.direction = MediaDirection.SENDRECV;
|
|
@@ -2079,7 +2079,7 @@ TraceablePeerConnection.prototype._ensureSimulcastGroupIsLast = function(localSd
|
2079
|
2079
|
TraceablePeerConnection.prototype._adjustLocalMediaDirection = function(localDescription) {
|
2080
|
2080
|
const transformer = new SdpTransformWrap(localDescription.sdp);
|
2081
|
2081
|
let modifiedDirection = false;
|
2082
|
|
- const audioMedia = transformer.selectMedia(MediaType.AUDIO);
|
|
2082
|
+ const audioMedia = transformer.selectMedia(MediaType.AUDIO)?.[0];
|
2083
|
2083
|
|
2084
|
2084
|
if (audioMedia) {
|
2085
|
2085
|
const desiredAudioDirection = this.getDesiredMediaDirection(MediaType.AUDIO);
|
|
@@ -2093,7 +2093,7 @@ TraceablePeerConnection.prototype._adjustLocalMediaDirection = function(localDes
|
2093
|
2093
|
logger.warn(`${this} No "audio" media found in the local description`);
|
2094
|
2094
|
}
|
2095
|
2095
|
|
2096
|
|
- const videoMedia = transformer.selectMedia(MediaType.VIDEO);
|
|
2096
|
+ const videoMedia = transformer.selectMedia(MediaType.VIDEO)?.[0];
|
2097
|
2097
|
|
2098
|
2098
|
if (videoMedia) {
|
2099
|
2099
|
const desiredVideoDirection = this.getDesiredMediaDirection(MediaType.VIDEO);
|
|
@@ -2129,7 +2129,7 @@ TraceablePeerConnection.prototype._adjustRemoteMediaDirection = function(remoteD
|
2129
|
2129
|
const transformer = new SdpTransformWrap(remoteDescription.sdp);
|
2130
|
2130
|
|
2131
|
2131
|
[ MediaType.AUDIO, MediaType.VIDEO ].forEach(mediaType => {
|
2132
|
|
- const media = transformer.selectMedia(mediaType);
|
|
2132
|
+ const media = transformer.selectMedia(mediaType)?.[0];
|
2133
|
2133
|
const hasLocalSource = this.hasAnyTracksOfType(mediaType);
|
2134
|
2134
|
const hasRemoteSource = this.getRemoteTracks(null, mediaType).length > 0;
|
2135
|
2135
|
|