pause/start playback, and repeat this process many times, the playback will be stuck

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

pause/start playback, and repeat this process many times, the playback will be stuck

Donghui Bai
This post was updated on .
Hi all,
 
I use gstreamer 1.8.2 to instead of MediaPlayer in Android, and use the androidmedia(playbin2 automatically linked) plugin to decode the H264 video.

The playback is fine normally, but when I pause playback, then start playback after 1-2s, and repeat this process many times (100+ times),  the playback will be stuck.
log.log
I add some log in androidmedia (gstamcvideodec.c gst_amc_video_dec_loop), as follow:
------------------------------------------------------------------------------------
static void
gst_amc_video_dec_loop (GstAmcVideoDec * self)
{  
  ...
  if (frame
      && (deadline =
          gst_video_decoder_get_max_decode_time (GST_VIDEO_DECODER (self),
              frame)) < 0) {
          ...
  } else if (frame && self->codec_config == AMC_CODEC_CONFIG_WITH_SURFACE) {
    ...
    __android_log_print(ANDROID_LOG_DEBUG,
                      "TEST",
                      "%s %s %d",
                      __FILE__, GST_FUNCTION, __LINE__);
    flow_ret = gst_video_decoder_finish_frame (GST_VIDEO_DECODER (self), frame);
    __android_log_print(ANDROID_LOG_DEBUG,
                      "TEST",
                      "%s %s %d",
                      __FILE__, GST_FUNCTION, __LINE__);
  }
  ...
}
------------------------------------------------------------------------------------
then found that gst_video_decoder_finish_frame blocked and did not return in gst_amc_video_dec_loop, I think it result in stuck.

Why gst_video_decoder_finish_frame blocked? Is this some kind of bug, or am I missing something?

Best regards,
Bai
Reply | Threaded
Open this post in threaded view
|

Re: pause playback, then start playback after 1-2s, and repeat this process many times (100+ times), the playback will be stuck

Sebastian Dröge-3
On Mo, 2016-06-13 at 00:09 -0700, Donghui Bai wrote:

> then found that gst_video_decoder_finish_frame blocked and did not return in
> gst_amc_video_dec_loop, I think it result in stuck.
>
> Why gst_video_decoder_finish_frame blocked? Is this some kind of bug, or am
> I missing something?

It would be a bug. Can you get a backtrace of all threads when it is
blocked?

Which device and codec is this on?

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (968 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: pause playback, then start playback after 1-2s, and repeat this process many times (100+ times), the playback will be stuck

Donghui Bai
This post was updated on .
Hi Sebastian,

Thanks very much for your reply.

>
>Can you get a backtrace of all threads when it is blocked?
stuck.log
debuggered.txt: the backtrace by debuggerd -b <pid>
traces.txt: the backtrace by kill -3 <pid>

>
>Which device and codec is this on?
device: armv7 + Android 4.4
codec:amcviddec-omxmtkvideodecoderavc

And I use the avdec_h264 plugin to decode the H264 video, can also appear this phenomenon.
Reply | Threaded
Open this post in threaded view
|

Re: pause playback, then start playback after 1-2s, and repeat this process many times (100+ times), the playback will be stuck

Donghui Bai
I get more infomation about libgstreamer_android.so by addr2line.
debuggered_more.txt
traces_more.txt

Hope that it's helpful to investigate the problem.
Reply | Threaded
Open this post in threaded view
|

Re: pause playback, then start playback after 1-2s, and repeat this process many times (100+ times), the playback will be stuck

Sebastian Dröge-3
In reply to this post by Donghui Bai
On Mo, 2016-06-13 at 03:57 -0700, Donghui Bai wrote:

> Hi Sebastian, 
>
> Thanks very much for your reply. 
>
> >
> > Can you get a backtrace of all threads when it is blocked? 
> stuck.log
> <http://gstreamer-devel.966125.n4.nabble.com/file/n4678000/stuck.log>
>   
> debuggered.txt
> <http://gstreamer-devel.966125.n4.nabble.com/file/n4678000/debuggered
> .txt> 
> : the backtrace by *debuggerd -b <pid>*
> traces.txt
> <http://gstreamer-devel.966125.n4.nabble.com/file/n4678000/traces.txt
> >  :
> the backtrace by *kill -3 <pid>*
>
> >
> > Which device and codec is this on?
> device: armv7 + Android 4.4
> codec:amcvideodec-omxmtkvideodecoderavc
>
> And I use the avdec_h264 plugin to decode the H264 video, can also
> appear this phenomenon.
Ok, so it's unrelated to the Android codecs. Can you try to create a
testcase for this that runs on the commandline?

Does it happen on all files, or only specific ones?

Your backtraces looks like nothing is really wrong, just that both
sinks are waiting to be set to PLAYING but are prerolled and waiting in
PAUSED. At least that's what I could guess, your backtrace is missing
most symbols.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (968 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: pause playback, then start playback after 1-2s, and repeat this process many times (100+ times), the playback will be stuck

Donghui Bai
This post was updated on .
Hi Sebastian,  

>
> Can you try to create a testcase for this that runs on the commandline?
I create a test apk by modify the Tutorial5.java in android-tutorial-5 using gstreamer 1.8.2. It
can pause playback, then start playback after 2s, and repeat this process.

And I use it to test on my TV (android 4.4&5.0) and phone (android 4.4), the playback will
also be stuck.


Specific changes to see Tutorial5.java
apk: Tutorial5.z01 Tutorial5.z02 Tutorial5.z03 Tutorial5.z04 Tutorial5.zip
       
>
>Does it happen on all files, or only specific ones?
My test videos are hls/mkv/mp4/h264+aac, it happen on all files.
Reply | Threaded
Open this post in threaded view
|

Re: pause playback, then start playback after 1-2s, and repeat this process many times (100+ times), the playback will be stuck

Sebastian Dröge-3
On Di, 2016-06-14 at 22:57 -0700, Donghui Bai wrote:
> Hi Sebastian,  
>
> >
> > Can you try to create a testcase for this that runs on the
> > commandline?
> I create a testcase by modify the Tutorial5.java in *android-
> tutorial-5*
> using gstreamer 1.8.2. It can pause playback, 
> then start playback after 2s, and repeat this process. 

Can you try to create a commandline testcase, something that would not
run only on Android but could easily be run by anybody here? Your
problems seem unrelated to Android and should be reproducible on other
platforms too.

--

Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (968 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: pause playback, then start playback after 1-2s, and repeat this process many times (100+ times), the playback will be stuck

rland
This post was updated on .
<quote author="Sebastian Dröge-3">
On Di, 2016-06-14 at 22:57 -0700, Donghui Bai wrote:
> Hi Sebastian,  
>
> >
> > Can you try to create a testcase for this that runs on the
> > commandline?
> I create a testcase by modify the Tutorial5.java in *android-
> tutorial-5*
> using gstreamer 1.8.2. It can pause playback, 
> then start playback after 2s, and repeat this process. 

Can you try to create a commandline testcase, something that would not
run only on Android but could easily be run by anybody here? Your
problems seem unrelated to Android and should be reproducible on other
platforms too.

--
I care about whether all platforms have this problem,so I made a simple CMD testcase on  Linux with 1.8.2, 1 s interval to execute pause / play,about 4 hours repeatedly and did not appear stuck。

Maybe, just Android will have this problem ?

test.c
-----------------------
gcc test.c -o test $(pkg-config --cflags --libs gstreamer-1.0)
./test file:///work/contents/test.mp4
----------------------