Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Commit 3161390

Browse files
authored
Optmize mute process (#770)
1 parent 1ee0367 commit 3161390

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

source/core/owt_base/AudioFrameConstructor.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ std::unique_ptr<AudioLevel> parseAudioLevel(std::shared_ptr<erizo::DataPacket> p
101101

102102
int AudioFrameConstructor::deliverAudioData_(std::shared_ptr<erizo::DataPacket> audio_packet)
103103
{
104+
if (!m_enabled) {
105+
return 0;
106+
}
107+
104108
if (audio_packet->length <= 0)
105109
return 0;
106110

@@ -131,9 +135,8 @@ int AudioFrameConstructor::deliverAudioData_(std::shared_ptr<erizo::DataPacket>
131135
ELOG_DEBUG("No audio level extension");
132136
}
133137

134-
if (m_enabled) {
135-
deliverFrame(frame);
136-
}
138+
deliverFrame(frame);
139+
137140
return audio_packet->length;
138141
}
139142

source/core/owt_base/VideoFrameConstructor.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,13 @@ void VideoFrameConstructor::unbindTransport()
9292
void VideoFrameConstructor::enable(bool enabled)
9393
{
9494
m_enabled = enabled;
95-
RequestKeyFrame();
95+
if(!m_enabled) {
96+
m_ssrc = 0;
97+
m_rtcAdapter->destoryVideoReceiver(m_videoReceive);
98+
m_videoReceive = nullptr;
99+
} else {
100+
RequestKeyFrame();
101+
}
96102
}
97103

98104
int32_t VideoFrameConstructor::RequestKeyFrame()
@@ -143,6 +149,10 @@ void VideoFrameConstructor::onAdapterData(char* data, int len)
143149

144150
int VideoFrameConstructor::deliverVideoData_(std::shared_ptr<erizo::DataPacket> video_packet)
145151
{
152+
if (!m_enabled) {
153+
return 0;
154+
}
155+
146156
RTCPHeader* chead = reinterpret_cast<RTCPHeader*>(video_packet->data);
147157
uint8_t packetType = chead->getPacketType();
148158

0 commit comments

Comments
 (0)