<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <br>
    <br>
    <div class="moz-cite-prefix">On 3/2/19 10:58 AM, Mark Kendall wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAG323RRRScQ4r8scWhzsfk5ZVp7xLJjchSbGVyS8qHiAnbpHAA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="auto">
        <div><br>
          <br>
          <div class="gmail_quote">
            <div dir="ltr" class="gmail_attr">On Sat, Mar 2, 2019, 3:31
              PM Peter Bennett <<a href="mailto:pb.mythtv@gmail.com"
                moz-do-not-send="true">pb.mythtv@gmail.com</a>>
              wrote:</div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              > Stuttering occurs right at the start of the program
              with mediacodec <br>
              > decoder. SW dec is fine. Either avsync method
              exhibits this so its <br>
              > mediacodec related.<br>
              ><br>
              I am hoping that the direct render fixes it. Mark K said
              that he will be <br>
              looking into direct render. Anyway I will download some of
              that file and <br>
              see if I can do anything to understand what is happening,<br>
            </blockquote>
          </div>
        </div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">Has anyone tried increasing the number of
          mediacodec video buffers? Its only 8 at the moment. I had
          similar problems with VideoToolBox decoding this week and
          increasing the buffer count was the key. 8 gives you very
          little headroom for the simplest of system glitches.</div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">Direct render is getting there - only problem is
          it crashes as soon as it tries to display anything:)</div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">Regards, Mark</div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________

</pre>
    </blockquote>
    I tried the video that gives the problem. It is H264 interlaced.
    Normally, mediacodec on shield should deinterlace it and hand it to
    MythTV as progressive. MythTV is seeing this as progressive
    switching to interlaced and back to progressive again about once
    every second. This causes the OpenGL rendering and deinterlacing to
    be re-initialized twice every second. It is not surprising that this
    results in jerky playback.<br>
    <br>
    I will trace through it and see whether ffmpeg is actually switching
    it back and forth between interlaced and progressive, and whether
    anything can be done about it.<br>
    <br>
    Regarding the video buffers - I had to set that low value, otherwise
    playback would be terminated by android on the shield. Android has
    very restrictive memory usage rules, and does not hesitate to shut
    down any process that uses more than it thinks is reasonable. 8
    buffers seemed to be the best value that worked well. I do not think
    the video buffers are the cause of the jerkiness.<br>
    <br>
    Peter<br>
  </body>
</html>