[vlc-devel] [RFC PATCH 0/7] Handle MediaCodec SPS/PPS changes

Thomas Guillem thomas at gllm.fr
Thu Apr 23 19:30:48 CEST 2015


The goal of this set of patches is to fix crashes when playing HLS or other
live streaming via MediaCodec. For that, I must reopen mediacodec if sps/pps
change.

In order to accomplish this, I did:

1/ Move modules/codec/h264_nal.* to modules/packetizer
This can be discussed but I think this code belongs to packetizer.

2/ Expose more sps/pps parsing and fetching functions that are used by
packetizer/h264.c and codec/omxil/android_mediacodec.c

3/ Search for SPS/PPS while decoding in MediaCodec. If a SPS is found and is
different than the last one: reopen MediaCodec with a new extra buffer and a
video size updated. For HLS, there is no last SPS, so MediaCodec will be opened
once we find a SPS. This last patch is still WIP. Also, I'm wondering about the
performances if I try to parse a SPS/PPS for all input buffers.

Thomas Guillem (7):
  move h264/hevc nal helper code to packetizer
  packetizer: h264: expose nal type in h264_nal.h
  h264_nal: add h264_get_spspps
  packetizer h264: refactor and expose sps/pps parsing
  mediacodec: abort if there is no valid video size
  mediacodec: allow to open with a custom extra buffer
  mediacodec: WIP reopen MediaCodec if sps changes

 modules/codec/Makefile.am                |  11 +-
 modules/codec/crystalhd.c                |   2 +-
 modules/codec/h264_nal.c                 | 169 ----------
 modules/codec/h264_nal.h                 |  66 ----
 modules/codec/hevc_nal.c                 | 107 -------
 modules/codec/hevc_nal.h                 |  38 ---
 modules/codec/mft.c                      |   2 +-
 modules/codec/omxil/android_mediacodec.c |  84 ++++-
 modules/codec/omxil/omxil.c              |   4 +-
 modules/codec/omxil/utils.c              |   2 +-
 modules/packetizer/Makefile.am           |   2 +-
 modules/packetizer/h264.c                | 331 +++-----------------
 modules/packetizer/h264_nal.c            | 518 +++++++++++++++++++++++++++++++
 modules/packetizer/h264_nal.h            | 153 +++++++++
 modules/packetizer/hevc_nal.c            | 107 +++++++
 modules/packetizer/hevc_nal.h            |  38 +++
 16 files changed, 938 insertions(+), 696 deletions(-)
 delete mode 100644 modules/codec/h264_nal.c
 delete mode 100644 modules/codec/h264_nal.h
 delete mode 100644 modules/codec/hevc_nal.c
 delete mode 100644 modules/codec/hevc_nal.h
 create mode 100644 modules/packetizer/h264_nal.c
 create mode 100644 modules/packetizer/h264_nal.h
 create mode 100644 modules/packetizer/hevc_nal.c
 create mode 100644 modules/packetizer/hevc_nal.h

-- 
2.1.3




More information about the vlc-devel mailing list