APP is hang when reverse direction

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

APP is hang when reverse direction

hungbattran
I'm a newbee of gstreamer program. I tried to create a Player to play .MKV file. I met a issue, when I call rewind function that reverse direction then my app is hanging. This is my function:

gboolean Player::trickplay(gint64 position, gdouble rate)
{
    gint64 duration;
    gint64 start, stop;
    if (!this->pipeline) {
        PRINT_ERR("[Player][Error] There isn't a pipeline.\n");
    return FALSE;
}

/* Get duration to encure the position can not be out of the stream */
    if (!getDuration(&duration)) {
        PRINT_ERR ("[Player][Info] Failed get duration.\n");
        return FALSE;0
    }
    if (position < 0)
        position = 0;
    else if (position > duration)
        position = duration;

    if ( rate > 0 ) { /* Run forward from current position to end (positon -> -1) */
        start = position;
        stop = -1;
    } else { /* Run backward from current position to start (positon -> 0) */
        start = 0;
        stop = position;
    }
    if (!gst_element_seek(this->pipeline, rate, GST_FORMAT_TIME,
            (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE),
                        GST_SEEK_TYPE_SET, start, GST_SEEK_TYPE_SET, stop)) {
        PRINT_ERR("[Player][Error] Seeking error.\n");
        return FALSE;
    }
    PRINT_INF("trickplay: start=%" GST_TIME_FORMAT " stop=%"GST_TIME_FORMAT"\n",
    GST_TIME_ARGS(start), GST_TIME_ARGS(stop));
    return TRUE;
}

When I tried to play backward from current position to start: rate = -2, start = 0 and stop = position then app is hang and can't start again. App play .MKV file.

Anyone know root cause, please explain to me in advance. Thank so much.
Reply | Threaded
Open this post in threaded view
|

Re: APP is hang when reverse direction

Nicolas Dufresne-5
Le dimanche 02 avril 2017 à 07:18 -0700, hungbattran a écrit :
> I'm a newbee of gstreamer program. I tried to create a Player to play
> .MKV
> file. I met a issue, when I call rewind function that reverse
> direction then
> my app is hanging. This is my function:

It's not clear if reverse playback support in matroska is complete or
not, see:

https://bugzilla.gnome.org/show_bug.cgi?id=679250

>
> /gboolean Player::trickplay(gint64 position, gdouble rate)
> {
>     gint64 duration;
>     gint64 start, stop;
>     if (!this->pipeline) {
>         PRINT_ERR("[Player][Error] There isn't a pipeline.\n");
>     return FALSE;
> }
>
> /* Get duration to encure the position can not be out of the stream
> */
>     if (!getDuration(&duration)) {
>         PRINT_ERR ("[Player][Info] Failed get duration.\n");
>         return FALSE;0
>     }
>     if (position < 0)
>         position = 0;
>     else if (position > duration)
>         position = duration;
>
>     if ( rate > 0 ) { /* Run forward from current position to end
> (positon
> -> -1) */
>         start = position;
>         stop = -1;
>     } else { /* Run backward from current position to start (positon
> -> 0)
> */
>         start = 0;
>         stop = position;
>     }
>     if (!gst_element_seek(this->pipeline, rate, GST_FORMAT_TIME,
>             (GstSeekFlags)(GST_SEEK_FLAG_FLUSH |
> GST_SEEK_FLAG_ACCURATE),
>                         GST_SEEK_TYPE_SET, start, GST_SEEK_TYPE_SET,
> stop))
> {
>         PRINT_ERR("[Player][Error] Seeking error.\n");
>         return FALSE;
>     }
>     PRINT_INF("trickplay: start=%" GST_TIME_FORMAT "
> stop=%"GST_TIME_FORMAT"\n",
>     GST_TIME_ARGS(start), GST_TIME_ARGS(stop));
>     return TRUE;
> }/
> When I tried to play backward from current position to start: rate =
> -2,
> start = 0 and stop = position then app is hang and can't start again.
> App
> play .MKV file.
>
> Anyone know root cause, please explain to me in advance. Thank so
> much.
>
>
>
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble
> .com/APP-is-hang-when-reverse-direction-tp4682489.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (188 bytes) Download Attachment