Skip to content

Commit

Permalink
[GStreamer][WebRTC] Renegotiation signalling improvement
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=252756

Reviewed by Xabier Rodriguez-Calvar.

When webrtcbin emits its on-negotiation-needed it has already made sure the negotiation is really
needed according to the spec, but our implementation wasn't resetting the corresponding flag
afterwards. We now match the event serial number, similarly to the libwebrtc implementation.

* Source/WebCore/Modules/mediastream/gstreamer/GStreamerMediaEndpoint.cpp:
(WebCore::GStreamerMediaEndpoint::onNegotiationNeeded):
* Source/WebCore/Modules/mediastream/gstreamer/GStreamerMediaEndpoint.h:
(WebCore::GStreamerMediaEndpoint::isNegotiationNeeded const):
* Source/WebCore/Modules/mediastream/gstreamer/GStreamerPeerConnectionBackend.cpp:
(WebCore::GStreamerPeerConnectionBackend::isNegotiationNeeded const):

Canonical link: https://commits.webkit.org/260731@main
  • Loading branch information
philn committed Feb 23, 2023
1 parent 46c041d commit 74387c5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
Expand Up @@ -1140,13 +1140,10 @@ void GStreamerMediaEndpoint::resume()

void GStreamerMediaEndpoint::onNegotiationNeeded()
{
m_isNegotiationNeeded = true;

++m_negotiationNeededEventId;
callOnMainThread([protectedThis = Ref(*this), this] {
if (isStopped())
return;
GST_DEBUG_OBJECT(m_pipeline.get(), "Negotiation needed!");
m_peerConnectionBackend.markAsNeedingNegotiation(0);
m_peerConnectionBackend.markAsNeedingNegotiation(m_negotiationNeededEventId);
});
}

Expand Down
Expand Up @@ -76,7 +76,7 @@ class GStreamerMediaEndpoint : public ThreadSafeRefCounted<GStreamerMediaEndpoin
void resume();

void gatherDecoderImplementationName(Function<void(String&&)>&&);
bool isNegotiationNeeded() const { return m_isNegotiationNeeded; }
bool isNegotiationNeeded(uint32_t eventId) const { return eventId == m_negotiationNeededEventId; }

void configureAndLinkSource(RealtimeOutgoingMediaSourceGStreamer&);

Expand Down Expand Up @@ -176,7 +176,7 @@ class GStreamerMediaEndpoint : public ThreadSafeRefCounted<GStreamerMediaEndpoin
int m_ptCounter { 96 };
unsigned m_pendingIncomingStreams { 0 };
bool m_isInitiator { false };
bool m_isNegotiationNeeded { false };
uint32_t m_negotiationNeededEventId { 0 };

#if !RELEASE_LOG_DISABLED
Timer m_statsLogTimer;
Expand Down
Expand Up @@ -365,9 +365,9 @@ void GStreamerPeerConnectionBackend::gatherDecoderImplementationName(Function<vo
m_endpoint->gatherDecoderImplementationName(WTFMove(callback));
}

bool GStreamerPeerConnectionBackend::isNegotiationNeeded(uint32_t) const
bool GStreamerPeerConnectionBackend::isNegotiationNeeded(uint32_t eventId) const
{
return m_endpoint->isNegotiationNeeded();
return m_endpoint->isNegotiationNeeded(eventId);
}

} // namespace WebCore
Expand Down

0 comments on commit 74387c5

Please sign in to comment.