summaryrefslogtreecommitdiff
path: root/libavcodec/mediacodecdec_common.c
Commit message (Collapse)AuthorAge
* avutil/frame: Remove deprecated AVFrame.pkt_pts fieldAndreas Rheinhardt2021-04-27
| | | | | | | Deprecated in 32c8359093d1ff4f45ed19518b449b3ac3769d27. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/mediacodec_wrapper: use MediaFormat to probe frame color characteristicsMatthieu Bouron2020-05-25
|
* avcodec/mediacodecdec_common: log codec name during configure/start failuresAman Gupta2019-09-09
| | | | | Signed-off-by: Aman Gupta <aman@tmm1.net> Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
* avcodec/mediacodecdec_common: ensure current input buffer is always used ↵Aman Gupta2019-09-09
| | | | | | | | | | correctly The loop may mutate the input buffer, so re-fetch it to ensure the current one is always used. Signed-off-by: Aman Gupta <aman@tmm1.net> Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
* avcodec/mediacodecdec_common: improve trace logging for end-of-streamAman Gupta2019-09-09
| | | | | Signed-off-by: Aman Gupta <aman@tmm1.net> Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
* avcodec/mediacodecdec_common: warn when PTS is missingAman Gupta2019-09-09
| | | | | | | MediaCodec decoders require PTS for proper operation. Signed-off-by: Aman Gupta <aman@tmm1.net> Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
* avcodec/mediacodecdec: re-indent after previous commitMatthieu Bouron2019-06-13
|
* avcodec/mediacodecdec: remove unneeded else block in ff_mediacodec_dec_send()Matthieu Bouron2019-06-13
|
* avcodec/mediacodecdec: try to receive a frame after signaling EOF to the codecMatthieu Bouron2019-06-13
| | | | | | | | | Avoids returning EAGAIN after signaling EOF to the codec in ff_mediacodec_dec_send() so we can try to receive a frame before returning in mediacodec_receive_frame(). This helps avoiding an extra round-trip between avcodec_send_frame() and avcodec_receive_frame() while draining the remaining frames.
* avcodec/mediacodecdec: fix spurious newline in trace loggingAman Gupta2018-08-05
| | | | Signed-off-by: Aman Gupta <aman@tmm1.net>
* avcodec/mediacodecdec: fix SEGV on modern nvidia decodersAman Gupta2018-08-03
| | | | | | | | | | | | | | | | | | | | This code came originally from gstreamer, where it was added in [1] as a work-around for the Tegra 3. (The alignment was changed in [2] as a response to [3], from 32-bit to 16-bit). gstreamer only used this workaround in the case where the decoder didn't return a slice-height property, but when the code was copied into avcodec the conditional got lost. This commit restores the guard and prefers the slice-height from the decoder when it is available. This fixes segfaults decoding 1920x1080 h264 and mpeg2 videos on the NVidia SHIELD after upgrading to Android Oreo. [1] https://github.com/GStreamer/gst-plugins-bad/commit/a870e6a5c30dd85240fe75c7409cc1cf1b86541d [2] https://github.com/GStreamer/gst-plugins-bad/commit/21ff3ae0b0127bd82951d278ca24f2d54133b7cd [3] https://bugzilla.gnome.org/show_bug.cgi?id=748867 Signed-off-by: Aman Gupta <aman@tmm1.net>
* Revert "avcodec/mediacodecdec: wait on first frame after input buffers are full"Aman Gupta2018-06-18
| | | | | | | | | | | @xyz reported a regression on his Sony Xperia Z3 Tablet Compact where playback would intermittently fail to start, essentially deadlocking in the decoder. Bisecting narrowed down the issue to this commit, which was meant as an optimization but is not necessary. This reverts commit a75bb5496ac6e7e194f1c6fd3b87f02a52e74adb. Signed-off-by: Aman Gupta <aman@tmm1.net>
* avcodec/mediacodecdec: wait on first frame after input buffers are fullAman Gupta2018-05-04
| | | | | | | | | | | The output_buffer_count==0 special case is no longer required, and can cause spurious EAGAIN to surface to the user when input buffers are filled up. Since the caller now knows if the decoder is accepting new input (via current_input_buffer>=0), let the wait parameter control whether we block or not. Signed-off-by: Aman Gupta <aman@tmm1.net> Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
* avcodec/mediacodecdec: restructure mediacodec_receive_frameAman Gupta2018-05-04
| | | | | | | | | | | | | The new logic follows a recommendation by @rcombs to use dequeueInputBuffer with a timeout of 0 as a way to detect whether the codec wants more data. The dequeued buffer index is kept in MediaCodecDecContext until it can be used next. A similar technique is also used by the Google's official media player Exoplayer: see MediaCodecRenderer.feedInputBuffer(). Signed-off-by: Aman Gupta <aman@tmm1.net> Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
* avcodec/mediacodecdec: refactor pts handlingAman Gupta2018-04-25
| | | | | | | | Also fixes a bug where EOS buffer was sent with incorrect pts when not using surface generation. Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com> Signed-off-by: Aman Gupta <aman@tmm1.net>
* avcodec/mediacodecdec: use AV_TIME_BASE_QAman Gupta2018-04-25
| | | | | | Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com> Signed-off-by: Jan Ekström <jeebjp@gmail.com> Signed-off-by: Aman Gupta <aman@tmm1.net>
* avcodec/mediacodecdec: clarify delay_flush specific codeAman Gupta2018-04-25
| | | | | | | | | As of 2a0eb8685, ff_mediacodec_dec_is_flushing() only returns true in delay_flush mode. Make this more obvious by adding delay_flush to the if statement. Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com> Signed-off-by: Aman Gupta <aman@tmm1.net>
* avcodec/mediacodecdec_common: make stride and slice-height non-mandatory fieldsMatthieu Bouron2018-04-19
| | | | | Fixes decoding on the Samsung Chromebook Pro which do not set the codec output format stride and slice-height fields.
* avcodec/mediacodecdec: propagate SAR to h/w framesAman Gupta2018-03-20
| | | | | | | | | Allows consumers who are converting hardware buffers to OpenGL textures to render the frames at the intended display resolution. Signed-off-by: Aman Gupta <aman@tmm1.net> Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* avcodec/mediacodecdec_common: make INFO_TRY_AGAIN trace messages more consistentMatthieu Bouron2018-03-12
| | | | | Signed-off-by: Aman Gupta <aman@tmm1.net> Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
* avcodec/mediacodecdec: add debug logging around hw buffer lifecycleAman Gupta2018-03-12
| | | | | | | | | | | | | Some Android devices are very finicky about how quicky output buffers are returned back to the decoder, especially when they are associated with a Surface. This commit adds a new counter that keeps track of exactly how many hw output buffers are being retained by the user, along with DEBUG level logging that makes it easy to track the lifecycle of these buffers. Signed-off-by: Aman Gupta <aman@tmm1.net> Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
* avcodec/mediacodecdec: add more trace logging of input/output buffersAman Gupta2018-03-07
| | | | | Signed-off-by: Aman Gupta <aman@tmm1.net> Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
* avcodec/mediacodecdec: add delay_flush optionAman Gupta2018-03-07
| | | | | | | | | | | | | | | | | | | | | | | | The default behavior of the mediacodec decoder before this commit was to delay flushes until all pending hardware frames were returned to the decoder. This was useful for certain types of applications, but was unexpected behavior for others. The new default behavior with this commit is now to execute flushes immediately to invalidate all pending frames. The old behavior can be enabled by setting delay_flush=1. With the new behavior, video players implementing seek can simply call flush on the decoder without having to worry about whether they have one or more mediacodec frames still buffered in their rendering pipeline. Previously, all these frames had to be explictly freed (or rendered) before the seek/flush would execute. The new behavior matches the behavior of all other lavc decoders, reducing the amount of special casing required when using the mediacodec decoder. Signed-off-by: Aman Gupta <aman@tmm1.net> Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
* avcodec/mediacodec: reduce loglevel for per-frame loggingAman Gupta2018-03-06
| | | | | Signed-off-by: Aman Gupta <aman@tmm1.net> Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
* avcodec/mediacodecdec_common: remove unused field from MediaCodecDecContextMatthieu Bouron2018-03-03
|
* avcodec/mediacodecdec_common: remove spurious spaceMatthieu Bouron2018-03-03
|
* avcodec/mediacodecdec_common: refactor mediacodec_dec_parse_format()Matthieu Bouron2018-03-03
|
* avcodec/mediacodecdec: refactor to take advantage of new decoding apiAman Gupta2018-02-19
| | | | | | | | | | | | | | | | | | | | This refactor splits up the main mediacodec decode loop into two send/receive helpers, which are then used to rewrite the receive_frame callback and take full advantage of the new decoding api. Since we can now request packets on demand with ff_decode_get_packet(), the fifo buffer is no longer necessary and has been removed. This change was motivated by behavior observed on certain Android TV devices, featuring hardware mpeg2/h264 decoders which also deinterlace content (to produce multiple frames per field). Previously, this code caused buffering issues because queueInputBuffer() was always invoked before each dequeueOutputBuffer(), even though twice as many output buffers were being generated. With this patch, the decoder will always attempt to drain new frames first before sending more data into the underlying codec. Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
* lavc/mediacodec: use AVMediaCodecDeviceContext hw_device_ctx if setAman Gupta2017-12-16
| | | | Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
* lavc: Delete all fake hwaccelsMark Thompson2017-11-26
| | | | They are now unused.
* lavc/mediacodec: rescale pts before decoding for both hw and sw buffersAman Gupta2017-07-03
| | | | | | | | | | | | Replicates the logic used in the wrap_hw_buffer path to wrap_sw_buffer as well. Fixes decoding issues observed on AMLogic devices with OMX.amlogic.mpeg2.decoder.awesome, where the decoder would spit out a constant stream of "mPtsRecoveryCount" errors and decoded frames were returned in the incorrect order. Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
* lavc/mediacodec: add missing newline on warningAman Gupta2017-07-03
| | | | Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
* lavc: add mpeg2 mediacodec decoderAman Gupta2017-06-08
| | | | | | | Android TV and FireOS hardware supports mpeg2 hardware decoding via MediaCodec. Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
* avcodec/mediacodec: convert to stdatomicJames Almer2017-03-23
| | | | | Reviewed-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* lavc/mediacodec: use more meaningful filenamesMatthieu Bouron2016-10-19
Adds the following changes: * mediacodecdec.{c,h} -> mediacodecdec_common.{c,h} * mediacodecdec_h2645.c -> mediacodecdec.c