Commit 6bd2ba15 authored by Benjamin Berg's avatar Benjamin Berg
Browse files

wfd: Implement injection of IDR frames

This is a basic implementation to inject IDR frames. Note that it
currently assumes that any SET_PARAMS request is actually an IDR
request.
parent 839a1670
......@@ -17,6 +17,7 @@ wfd_server_sources = [
#)
wfd_server_deps = [
dependency('gstreamer-video-1.0', version: '>= 1.14'),
dependency('gstreamer-rtsp-1.0', version: '>= 1.14'),
dependency('gstreamer-rtsp-server-1.0', version: '>= 1.14'),
]
......
#include <glib-object.h>
#include <gst/rtsp/gstrtspmessage.h>
#include <gst/video/video.h>
#include "wfd-client.h"
#include "wfd-media-factory.h"
#include "wfd-media.h"
......@@ -23,6 +24,7 @@ struct _WfdClient
guint keep_alive_source_id;
WfdClientInitState init_state;
WfdMedia *media;
WfdParams *params;
};
......@@ -207,6 +209,8 @@ wfd_client_configure_client_media (GstRTSPClient * client,
g_return_val_if_fail (self->params->selected_codec, FALSE);
g_return_val_if_fail (self->params->selected_resolution, FALSE);
self->media = WFD_MEDIA (media);
element = gst_rtsp_media_get_element (media);
wfd_configure_media_element (GST_BIN (element), self->params->selected_codec, self->params->selected_resolution);
......@@ -402,9 +406,33 @@ wfd_client_new_session (GstRTSPClient *client, GstRTSPSession *session)
static GstRTSPResult
wfd_client_params_set (GstRTSPClient *client, GstRTSPContext *ctx)
{
WfdClient *self = WFD_CLIENT (client);
gst_rtsp_message_init_response (ctx->response, GST_RTSP_STS_OK,
gst_rtsp_status_as_text (GST_RTSP_STS_OK), ctx->request);
/* Force a key unit event. */
if (self->media)
{
GstRTSPStream *stream;
g_autoptr(GstPad) srcpad = NULL;
g_autoptr(GstEvent) event = NULL;
stream = gst_rtsp_media_get_stream (GST_RTSP_MEDIA (self->media), 0);
if (!stream)
return GST_RTSP_OK;
srcpad = gst_rtsp_stream_get_srcpad (stream);
g_debug ("Forcing a keyframe!");
event = gst_video_event_new_upstream_force_key_unit (GST_CLOCK_TIME_NONE, TRUE, 0);
gst_pad_send_event (srcpad, g_steal_pointer (&event));
}
else
{
g_debug ("Cannot force key frame currently, no media!");
}
return GST_RTSP_OK;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment