Merge remote-tracking branch 'origin/master' into cross-signing
This commit is contained in:
commit
99ba1f17d3
21 changed files with 2228 additions and 279 deletions
|
|
@ -1,3 +1,4 @@
|
|||
#include <QQmlEngine>
|
||||
#include <cctype>
|
||||
|
||||
#include "Logging.h"
|
||||
|
|
@ -14,12 +15,17 @@ extern "C"
|
|||
}
|
||||
#endif
|
||||
|
||||
Q_DECLARE_METATYPE(WebRTCSession::State)
|
||||
Q_DECLARE_METATYPE(webrtc::State)
|
||||
|
||||
using webrtc::State;
|
||||
|
||||
WebRTCSession::WebRTCSession()
|
||||
: QObject()
|
||||
{
|
||||
qRegisterMetaType<WebRTCSession::State>();
|
||||
qRegisterMetaType<webrtc::State>();
|
||||
qmlRegisterUncreatableMetaObject(
|
||||
webrtc::staticMetaObject, "im.nheko", 1, 0, "WebRTCState", "Can't instantiate enum");
|
||||
|
||||
connect(this, &WebRTCSession::stateChanged, this, &WebRTCSession::setState);
|
||||
init();
|
||||
}
|
||||
|
|
@ -246,12 +252,10 @@ iceGatheringStateChanged(GstElement *webrtc,
|
|||
nhlog::ui()->debug("WebRTC: GstWebRTCICEGatheringState -> Complete");
|
||||
if (isoffering_) {
|
||||
emit WebRTCSession::instance().offerCreated(localsdp_, localcandidates_);
|
||||
emit WebRTCSession::instance().stateChanged(
|
||||
WebRTCSession::State::OFFERSENT);
|
||||
emit WebRTCSession::instance().stateChanged(State::OFFERSENT);
|
||||
} else {
|
||||
emit WebRTCSession::instance().answerCreated(localsdp_, localcandidates_);
|
||||
emit WebRTCSession::instance().stateChanged(
|
||||
WebRTCSession::State::ANSWERSENT);
|
||||
emit WebRTCSession::instance().stateChanged(State::ANSWERSENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -264,10 +268,10 @@ onICEGatheringCompletion(gpointer timerid)
|
|||
*(guint *)(timerid) = 0;
|
||||
if (isoffering_) {
|
||||
emit WebRTCSession::instance().offerCreated(localsdp_, localcandidates_);
|
||||
emit WebRTCSession::instance().stateChanged(WebRTCSession::State::OFFERSENT);
|
||||
emit WebRTCSession::instance().stateChanged(State::OFFERSENT);
|
||||
} else {
|
||||
emit WebRTCSession::instance().answerCreated(localsdp_, localcandidates_);
|
||||
emit WebRTCSession::instance().stateChanged(WebRTCSession::State::ANSWERSENT);
|
||||
emit WebRTCSession::instance().stateChanged(State::ANSWERSENT);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -285,7 +289,7 @@ addLocalICECandidate(GstElement *webrtc G_GNUC_UNUSED,
|
|||
localcandidates_.push_back({"audio", (uint16_t)mlineIndex, candidate});
|
||||
return;
|
||||
#else
|
||||
if (WebRTCSession::instance().state() >= WebRTCSession::State::OFFERSENT) {
|
||||
if (WebRTCSession::instance().state() >= State::OFFERSENT) {
|
||||
emit WebRTCSession::instance().newICECandidate(
|
||||
{"audio", (uint16_t)mlineIndex, candidate});
|
||||
return;
|
||||
|
|
@ -314,11 +318,11 @@ iceConnectionStateChanged(GstElement *webrtc,
|
|||
switch (newState) {
|
||||
case GST_WEBRTC_ICE_CONNECTION_STATE_CHECKING:
|
||||
nhlog::ui()->debug("WebRTC: GstWebRTCICEConnectionState -> Checking");
|
||||
emit WebRTCSession::instance().stateChanged(WebRTCSession::State::CONNECTING);
|
||||
emit WebRTCSession::instance().stateChanged(State::CONNECTING);
|
||||
break;
|
||||
case GST_WEBRTC_ICE_CONNECTION_STATE_FAILED:
|
||||
nhlog::ui()->error("WebRTC: GstWebRTCICEConnectionState -> Failed");
|
||||
emit WebRTCSession::instance().stateChanged(WebRTCSession::State::ICEFAILED);
|
||||
emit WebRTCSession::instance().stateChanged(State::ICEFAILED);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -355,8 +359,7 @@ linkNewPad(GstElement *decodebin G_GNUC_UNUSED, GstPad *newpad, GstElement *pipe
|
|||
if (GST_PAD_LINK_FAILED(gst_pad_link(newpad, queuepad)))
|
||||
nhlog::ui()->error("WebRTC: unable to link new pad");
|
||||
else {
|
||||
emit WebRTCSession::instance().stateChanged(
|
||||
WebRTCSession::State::CONNECTED);
|
||||
emit WebRTCSession::instance().stateChanged(State::CONNECTED);
|
||||
}
|
||||
gst_object_unref(queuepad);
|
||||
}
|
||||
|
|
@ -632,21 +635,30 @@ WebRTCSession::createPipeline(int opusPayloadType)
|
|||
}
|
||||
|
||||
bool
|
||||
WebRTCSession::toggleMuteAudioSrc(bool &isMuted)
|
||||
WebRTCSession::isMicMuted() const
|
||||
{
|
||||
if (state_ < State::INITIATED)
|
||||
return false;
|
||||
|
||||
GstElement *srclevel = gst_bin_get_by_name(GST_BIN(pipe_), "srclevel");
|
||||
if (!srclevel)
|
||||
gboolean muted;
|
||||
g_object_get(srclevel, "mute", &muted, nullptr);
|
||||
gst_object_unref(srclevel);
|
||||
return muted;
|
||||
}
|
||||
|
||||
bool
|
||||
WebRTCSession::toggleMicMute()
|
||||
{
|
||||
if (state_ < State::INITIATED)
|
||||
return false;
|
||||
|
||||
GstElement *srclevel = gst_bin_get_by_name(GST_BIN(pipe_), "srclevel");
|
||||
gboolean muted;
|
||||
g_object_get(srclevel, "mute", &muted, nullptr);
|
||||
g_object_set(srclevel, "mute", !muted, nullptr);
|
||||
gst_object_unref(srclevel);
|
||||
isMuted = !muted;
|
||||
return true;
|
||||
return !muted;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -777,7 +789,13 @@ WebRTCSession::createPipeline(int)
|
|||
}
|
||||
|
||||
bool
|
||||
WebRTCSession::toggleMuteAudioSrc(bool &)
|
||||
WebRTCSession::isMicMuted() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
WebRTCSession::toggleMicMute()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue