[rygel/rygel-0-38] engine-gst: Do not seek on the encodebin
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel/rygel-0-38] engine-gst: Do not seek on the encodebin
- Date: Mon, 4 May 2020 19:53:56 +0000 (UTC)
commit 5bd59cbfad9bc896950453c38f4d12fa7f720992
Author: Jens Georg <mail jensge org>
Date: Mon May 4 21:23:10 2020 +0200
engine-gst: Do not seek on the encodebin
Hackish fix for #157
.../gstreamer/rygel-gst-data-source.vala | 29 ++++++++++++++++++----
.../gstreamer/rygel-gst-transcoder.vala | 3 ++-
2 files changed, 26 insertions(+), 6 deletions(-)
---
diff --git a/src/media-engines/gstreamer/rygel-gst-data-source.vala
b/src/media-engines/gstreamer/rygel-gst-data-source.vala
index 198ada54..5d58a486 100644
--- a/src/media-engines/gstreamer/rygel-gst-data-source.vala
+++ b/src/media-engines/gstreamer/rygel-gst-data-source.vala
@@ -208,10 +208,6 @@ internal class Rygel.GstDataSource : Rygel.DataSource, GLib.Object {
if (message.type == MessageType.EOS) {
ret = false;
} else if (message.type == MessageType.STATE_CHANGED) {
- if (message.src != this.pipeline) {
- return true;
- }
-
State old_state;
State new_state;
@@ -219,6 +215,29 @@ internal class Rygel.GstDataSource : Rygel.DataSource, GLib.Object {
out new_state,
null);
+ var encodebin = this.pipeline.get_by_name (GstTranscoder.DECODE_BIN_NAME);
+ if (message.src == encodebin && old_state == State.READY && new_state == State.PAUSED) {
+ if (this.seek is HTTPTimeSeekRequest) {
+ debug ("Trying to seek encodebin directly...");
+ var time_seek = (HTTPTimeSeekRequest) this.seek;
+ debug ("%lld %lld", time_seek.start_time * Gst.USECOND, time_seek.end_time *
Gst.USECOND);
+ if (!encodebin.seek (1.0,
+ Format.TIME,
+ SeekFlags.ACCURATE| SeekFlags.FLUSH,
+ Gst.SeekType.SET,
+ time_seek.start_time * Gst.USECOND,
+ time_seek.end_time == 0 ?
+ Gst.SeekType.NONE : Gst.SeekType.SET,
+ time_seek.end_time * Gst.USECOND + 1)) {
+ critical ("Failed to seek...");
+ }
+ }
+ }
+ if (message.src != this.pipeline) {
+ return true;
+ }
+
+
if (old_state == State.NULL && new_state == State.READY) {
dynamic Element element = this.pipeline.get_by_name ("muxer");
if (element != null) {
@@ -239,7 +258,7 @@ internal class Rygel.GstDataSource : Rygel.DataSource, GLib.Object {
if (this.seek != null) {
if (old_state == State.READY && new_state == State.PAUSED) {
- if (this.perform_seek ()) {
+ if ((encodebin != null && this.seek is HTTPTimeSeekRequest) || this.perform_seek ()) {
this.pipeline.set_state (State.PLAYING);
}
}
diff --git a/src/media-engines/gstreamer/rygel-gst-transcoder.vala
b/src/media-engines/gstreamer/rygel-gst-transcoder.vala
index 8920109a..45b133fb 100644
--- a/src/media-engines/gstreamer/rygel-gst-transcoder.vala
+++ b/src/media-engines/gstreamer/rygel-gst-transcoder.vala
@@ -39,6 +39,7 @@ public errordomain Rygel.GstTranscoderError {
* implement get_resources_for_item and get_encoding_profile methods.
*/
internal abstract class Rygel.GstTranscoder : GLib.Object {
+ public const string DECODE_BIN_NAME = "RygelTranscoderDecodebin";
public string name { get; construct; }
public string mime_type { get; construct; }
public string dlna_profile { get; construct; }
@@ -129,7 +130,7 @@ internal abstract class Rygel.GstTranscoder : GLib.Object {
var orig_source = src as GstDataSource;
this.decoder = GstUtils.create_element (DECODE_BIN,
- DECODE_BIN);
+ DECODE_BIN_NAME);
this.encoder = GstUtils.create_element (ENCODE_BIN,
ENCODE_BIN);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]