Skip to content
Snippets Groups Projects
Commit 9c60e53c authored by Aline Gondim Santos's avatar Aline Gondim Santos
Browse files

plugins: fix streams creation

After b8e03c79, the streams were sharing a single subject for
input/output causing an undefined behavior.

Change-Id: I8e1fce46893233820ff452a278d3416564c547e8
parent 7c1cd4e1
Branches
No related tags found
No related merge requests found
...@@ -282,7 +282,6 @@ SIPCall::createCallAVStreams() ...@@ -282,7 +282,6 @@ SIPCall::createCallAVStreams()
for (const auto& rtpSession : getRtpSessionList()) { for (const auto& rtpSession : getRtpSessionList()) {
auto isVideo = rtpSession->getMediaType() == MediaType::MEDIA_VIDEO; auto isVideo = rtpSession->getMediaType() == MediaType::MEDIA_VIDEO;
auto streamType = isVideo ? StreamType::video : StreamType::audio; auto streamType = isVideo ? StreamType::video : StreamType::audio;
std::shared_ptr<MediaStreamSubject> subject = std::make_shared<MediaStreamSubject>(mediaMap);
StreamData previewStreamData {baseId, false, streamType, getPeerNumber(), getAccountId()}; StreamData previewStreamData {baseId, false, streamType, getPeerNumber(), getAccountId()};
StreamData receiveStreamData {baseId, true, streamType, getPeerNumber(), getAccountId()}; StreamData receiveStreamData {baseId, true, streamType, getPeerNumber(), getAccountId()};
#ifdef ENABLE_VIDEO #ifdef ENABLE_VIDEO
...@@ -290,19 +289,27 @@ SIPCall::createCallAVStreams() ...@@ -290,19 +289,27 @@ SIPCall::createCallAVStreams()
// Preview // Preview
auto videoRtp = std::static_pointer_cast<video::VideoRtpSession>(rtpSession); auto videoRtp = std::static_pointer_cast<video::VideoRtpSession>(rtpSession);
if (auto& videoPreview = videoRtp->getVideoLocal()) if (auto& videoPreview = videoRtp->getVideoLocal())
createCallAVStream(previewStreamData, *videoPreview, subject); createCallAVStream(previewStreamData,
*videoPreview,
std::make_shared<MediaStreamSubject>(mediaMap));
// Receive // Receive
if (auto& videoReceive = videoRtp->getVideoReceive()) if (auto& videoReceive = videoRtp->getVideoReceive())
createCallAVStream(receiveStreamData, *videoReceive, subject); createCallAVStream(receiveStreamData,
*videoReceive,
std::make_shared<MediaStreamSubject>(mediaMap));
} else { } else {
#endif #endif
auto audioRtp = std::static_pointer_cast<AudioRtpSession>(rtpSession); auto audioRtp = std::static_pointer_cast<AudioRtpSession>(rtpSession);
// Preview // Preview
if (auto& localAudio = audioRtp->getAudioLocal()) if (auto& localAudio = audioRtp->getAudioLocal())
createCallAVStream(previewStreamData, *localAudio, subject); createCallAVStream(previewStreamData,
*localAudio,
std::make_shared<MediaStreamSubject>(mediaMap));
// Receive // Receive
if (auto& audioReceive = audioRtp->getAudioReceive()) if (auto& audioReceive = audioRtp->getAudioReceive())
createCallAVStream(receiveStreamData, (AVMediaStream&) *audioReceive, subject); createCallAVStream(receiveStreamData,
(AVMediaStream&) *audioReceive,
std::make_shared<MediaStreamSubject>(mediaMap));
#ifdef ENABLE_VIDEO #ifdef ENABLE_VIDEO
} }
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment