[mythtv] Android mediacodec woes
David Engel
david at istwok.net
Wed Jun 27 02:18:09 UTC 2018
On Wed, Jun 27, 2018 at 09:15:04AM +1000, Mark Spieth wrote:
>
> On 27/06/18 09:01, Peter Bennett wrote:
> >
> >
> > On 06/26/2018 04:19 PM, Aman Gupta wrote:
> > > If you really want 30fps deinterlaced output, you can use the
> > > following patch. However this is a private/undocumented
> > > SHIELD-specific option and will not work on other devices.
> > >
> > > @@ -383,6 +382,7 @@ static av_cold int
> > > mediacodec_decode_init(AVCodecContext *avctx)
> > > ff_AMediaFormat_setString(format, "mime", codec_mime);
> > > ff_AMediaFormat_setInt32(format, "width", avctx->width);
> > > ff_AMediaFormat_setInt32(format, "height", avctx->height);
> > > + ff_AMediaFormat_setInt32(format, "deinterlace-method", 1);
> > >
> > > s->ctx = av_mallocz(sizeof(*s->ctx));
> > > if (!s->ctx) {
> >
> > Thanks for the suggestion. I will keep it in mind, but I would rather
> > stay away from making more ffmpeg changes and preferably work towards
> > getting rid of the ones we have. Also, we are not developing for Shield
> > exclusively.
> >
> Is there any way to know that media codec deinterlacer is doubling the frame
> rate?
> You have probably thought of this already but you could collect 2 frames in
> this case from the decoder and pass them the same way as normal to the
> renderer/shower.
> AVSync however if you disable double framerate and let it think it is a un
> deinterlaced frame should handle things properly. That is where all the rate
> adapting occurs AFAIR. However I did play with it quite a while ago so I may
> be misremembering.
>
> The only other issue is the frame counter for current time in the video
> which would have to be adapted too, or take the framecount before the
> deinterlacer which in mediacodec case will probably be hidden.
> Alternatively change this to use timestamps as I think you suggested
> previously.
Here's another idea that occurred to me. We count "half frames"
played instead of full frames. When playing a frame, we increment
"half frames played" by 1 or 2 as appropriate. When using half frames
played in calculations, we divide by two and use as is or round up or
down as appropriate.
David
--
David Engel
david at istwok.net
More information about the mythtv-dev
mailing list