From 692d4a3a16a4f42303d20bbf3bc2c179b4debba4 Mon Sep 17 00:00:00 2001
From: Eva Pace <eba.pachi@gmail.com>
Date: Thu, 6 Apr 2023 16:50:23 -0300
Subject: [PATCH] webrtcbin: Fix trace log 'from' value
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

`webrtc->signaling_state` (from) and `new_signaling_state` (to) had the
same value when printed in a trace log. This commit adds a
`old_signaling_state` variable to hold the previous value, so that the
print statement works as intented.

Spotted by: Mustafa Asım REYHAN
Fixes #1802

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4362>
---
 subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c b/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c
index 26d954eb59..2cd502c503 100644
--- a/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c
+++ b/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c
@@ -6300,6 +6300,7 @@ get_last_generated_description (GstWebRTCBin * webrtc, SDPSource source,
 static GstStructure *
 _set_description_task (GstWebRTCBin * webrtc, struct set_description *sd)
 {
+  GstWebRTCSignalingState old_signaling_state = webrtc->signaling_state;
   GstWebRTCSignalingState new_signaling_state = webrtc->signaling_state;
   gboolean signalling_state_changed = FALSE;
   GError *error = NULL;
@@ -6654,7 +6655,7 @@ _set_description_task (GstWebRTCBin * webrtc, struct set_description *sd)
    */
   if (signalling_state_changed) {
     const gchar *from = _enum_value_to_string (GST_TYPE_WEBRTC_SIGNALING_STATE,
-        webrtc->signaling_state);
+        old_signaling_state);
     const gchar *to = _enum_value_to_string (GST_TYPE_WEBRTC_SIGNALING_STATE,
         new_signaling_state);
     GST_TRACE_OBJECT (webrtc, "notify signaling-state from %s "