1. 23 Jul, 2021 6 commits
    • He Junyan's avatar
      codecs: h264decoder: let print_ref_pic_list_b print the correct list name. · f9d7b708
      He Junyan authored
      The print_ref_pic_list_b now not only needs to trace the ref_pic_list_b0/1,
      but also need to trace the ref_frame_list_0_short_term. We need to pass the
      name directly to it rather than an index to refer to ref_pic_list_b0/1.
      
      Part-of: <!2425>
      f9d7b708
    • He Junyan's avatar
      codecs: h264dec: Fix a typo in construct_ref_field_pic_lists_b. · eef90676
      He Junyan authored
      The array sort of ref_frame_list_0_short_term has some typo. The
      typo makes this list not in the POC ascend order and generate wrong
      decoding result for interlaced streams.
      
      Part-of: <!2425>
      eef90676
    • Devarsh Thakkar's avatar
      kmssink: Fix fallback path for driver not able to scale scenario · d2a7b763
      Devarsh Thakkar authored
      When driver return error on update plane request, kmssink
      disables the scaling and retries plane update.
      While doing so kmssink was matching the source rectangle dimensions
      to the target rectangle dimensions which were calculated
      as per scaling but this is incorrect, instead what we want here is
      that target rectangle dimensions should match the source rectangle
      dimensions as scaling is disabled now and so we match result
      rectangle dimensions with source rectangle dimensions.
      
      While at it, also match the result rectangle coordinates for
      horizontal and vertical offsets with source rectange coordinates,
      as since there is no scaling being done so no recentering is
      required.
      
      Part-of: <!2415>
      d2a7b763
    • He Junyan's avatar
      videoparsers: vp9: Need to process the first frame even not key. · e9d0d19f
      He Junyan authored
      Some cut VP9 streams begin with a non key frame. The current code
      just bail out the parse_process_frame() if not a key frame. Because
      of this, we do not set the valid caps before we push the data of the
      first frame(even this first frame will be discarded by the downstream
      decoder because it is not a key frame).
      
      The pipeline such as:
      gst-launch-1.0 filesrc location=some.ivf ! ivfparse ! vp9parse !
        vavp9dec ! fakesink
      will get a negotiation error and the pipeline can not continue. The
      correct behaviour should be: the decoder discard the first frame and
      continue to decode later frames successfully.
      
      So, when the parse does not have valid stream info(should be the first
      frame case), we should continue and report caps.
      
      Part-of: <!2427>
      e9d0d19f
    • Nirbheek Chauhan's avatar
      audiolatency: Handle audio buffers with invalid duration · 0bde6bf7
      Nirbheek Chauhan authored
      pipewiresrc outputs audio buffers without a valid duration, so we need
      to calculate it manually in that case.
      
      Upstream issue: pipewire/pipewire#1438
      
      Part-of: <!2419>
      0bde6bf7
    • He Junyan's avatar
      va: h265dec: Do not assign the frame->output_buffer until output_picture. · 99636cd1
      He Junyan authored
      We may need to drop the slices such as RASL pictures with the NoRaslOutputFlag, so
      the current picture of h265decoder may be freed. We should not assign the frame->
      output_buffer too early until we really output it. Or, the later coming slices will
      allocate another picture and trigger the assert of:
        gst_video_decoder_allocate_output_frame_with_params:
        assertion 'frame->output_buffer == NULL' failed
      
      Part-of: <!2421>
      99636cd1
  2. 22 Jul, 2021 2 commits
    • Edward Hervey's avatar
      tsdemux: Handle PCR-less streams · a79a756b
      Edward Hervey authored
      Some programs specify a PCR PID but don't actually store any PCR values, or are
      way too far apart.
      
      In order to gracefully handle those situations, we will queue up to a certain
      amount of pending buffers before deciding to give up on that PCR PID and not use
      any (i.e. using DTS/PTS values as-is)
      
      Fixes #1629
      
      Part-of: <!2422>
      a79a756b
    • He Junyan's avatar
      va: H265: Add odd bit depth and chroma depth in get_rtformat. · 0c8d41b8
      He Junyan authored
      In H265, the stream may have odd bit depth such as 9 or 11. And
      the bit depth of luma and chroma may differ. For example, the
      stream with luma depth of 8 and chroma depth of 9 should use the
      10 bit rtformat as the decoded picture format.
      
      Part-of: <!2420>
      0c8d41b8
  3. 21 Jul, 2021 19 commits
    • He Junyan's avatar
      codecs: h264dec: Improve the algorithm for low latency mode. · 13020562
      He Junyan authored
      In low_latency mode, try to bump the picture as soon as possible
      without the frames disorder:
      1. We can directly output the continuous non-reference frame.
      2. Consider max_num_reorder_frames, which is special useful for
         I-P mode.
      3. Consider the leading pictures with negative POC.
      4  Output small POC pictures when non-reference frame comes.
      4. Output the POC increment<=2 pictures. This is not 100% safe,
         but in practice this condition can be used.
      
      Part-of: <!2373>
      13020562
    • He Junyan's avatar
      codecs: h264dec: Add help function of dpb_set_max_num_reorder_frames. · 573d3f5b
      He Junyan authored
      The max_num_reorder_frames can be useful for bump check. We store it
      in the DPB and no need for the decoder now.
      
      Part-of: <!2373>
      573d3f5b
    • He Junyan's avatar
      codecs: h264dec: Add a flag to record whether picture is reference. · be223ad3
      He Junyan authored
      The picture->ref field will change from time to time according to decoder's
      state and reference sliding window. We need another flag to record whether
      the picture is a reference picture when it is created, and this can help
      the bumping check.
      
      Part-of: <!2373>
      be223ad3
    • He Junyan's avatar
      codecs: h264dec: Change the order of dpb_add and dpb_bump. · b4e38874
      He Junyan authored
      The current behavior is different from the SPEC. We should check
      and bump the DPB or drain the DPB before we insert the current
      picture into it. This may cause the output picture disorder.
      
      Part-of: <!2373>
      b4e38874
    • He Junyan's avatar
      codecs: h264dec: Modify the DPB need bump check. · f1df1207
      He Junyan authored
      Accord to spec, we should not add the current picture into the DPB
      when we check whether it needs to bump, so the checks of the IDR and
      the "memory_management_control_operation equal to 5" are no needed.
      
      And the spec also says that the DPB only needs to bump when there is
      no empty frame buffer left(We handle the IDR cases in other places).
      We need to follow that and the max_num_reorder_frames is useless.
      
      We also minus 1 in has_empty_frame_buffer because the current frame
      has not been added yet.
      
      Part-of: <!2373>
      f1df1207
    • He Junyan's avatar
      4411a4e0
    • He Junyan's avatar
      codecs: h264dec: Set picture to a small poc when mem_mgmt_5. · 23b15aa5
      He Junyan authored
      When current frame memory_management_control_operation equal to 5, that
      means we need to drain the dpb and the current picture act as an IDR frame.
      So it should have smaller poc than the later pictures to ensure the output
      order.
      
      Part-of: <!2373>
      23b15aa5
    • Edward Hervey's avatar
      mxfdemux: Make gst-indent on the CI happy · 7a6bc987
      Edward Hervey authored
      grmbl
      
      Part-of: <!2371>
      7a6bc987
    • Edward Hervey's avatar
      mxfdemux: Handle non-frame wrapping · 726ea62d
      Edward Hervey authored
      * If we have an index table for non-framed essence, we can handle it
      
      * The demuxer has a state which indicates whether it will next fetch a KLV or
      data contained *within* a KLV.
      
      * The position on Essence Tracks always correspond to the next entry to fetch,
      demuxer offset will be skipped accordingly whenever we switch between
      partitions (in case of resyncs). A copy of the main clip/custom KLV for that
      partition is kept to track the position within the essence of that partition.
      
      * For clip/custom-wrapped raw audio, if the edit rate is too small (and would
      cause plenty of tiny buffers to be outputted), specify a minimum number of edit
      units per buffer.
      
      Part-of: <!2371>
      726ea62d
    • Edward Hervey's avatar
      mxfdemux: Use KLV for position/content tracking · 38ec61c5
      Edward Hervey authored
      * For pull-based, this avoids pulling content if it's not needed (ex: skipping filler
      packet, not downloading the content if we only need to know if/where an essence
      packet is, etc...). Allows reducing i/o usage to the minimum.
      
      * This also allows doing sub-klv position tracking, and opens the way for
      non-frame-wrapping handling
      
      Part-of: <!2371>
      38ec61c5
    • Edward Hervey's avatar
      mxfdemux: Output the topology of the file in debug logs · 40d36900
      Edward Hervey authored
      This provides a summary of the number/type of tracks in the Material and File
      Packages
      
      Part-of: <!2371>
      40d36900
    • Edward Hervey's avatar
      mxfdemux: Refactor pull seek · 3303e0eb
      Edward Hervey authored
      In order to figure out the exact start position (backed by a keyframe) accross
      all tracks, we first figure out the backing keyframe position, and *then* seek
      to that position.
      
      Avoids ending up in situations where we would properly seek to the backing
      keyframe on video ... but not on the audio streams (they would have been set to
      the original non-keyframe position). Fixes key-unit seeking.
      
      Part-of: <!2371>
      3303e0eb
    • Edward Hervey's avatar
      mxfaes-bwf: Handle new custom-constant-sized variant · 8817b08d
      Edward Hervey authored
      Defined by Amendment 2:2013 to SMPTE ST 382:2007
      
      Also define a new "UNKNOWN" wrapping type to make the difference with known
      wrapping types
      
      Part-of: <gstreamer/gst-plugins-bad!2371>
      8817b08d
    • Edward Hervey's avatar
      mxfmpeg: Fix essence coding detection · f502ef90
      Edward Hervey authored
      The picture essence coding matching was wrong. Use the proper "base" MXFUL for
      video mpeg compression for matching.
      
      Also handle the case where some old files would put the essence container label
      in the essence coding field
      
      Part-of: <gstreamer/gst-plugins-bad!2371>
      f502ef90
    • Edward Hervey's avatar
      mxfdemux: Refactor index table and offset handling · ac483b23
      Edward Hervey authored
      * Streamline offset <=> entry handling. Historically the demuxer didn't support
      information from index tables and stored the discovered information in an array
      per track. When index table support was added, a parallel system was setup for
      that relationship. This commit unifies this into one system with the
      `find_edit_entry()` and `find_entry_for_offset()` functions.
      
      * By extension, per-track offset entry tables are only created/used if no index
      table is present for those tracks.
      
      * Use index table information as-is. The index table system from MXF is quite
      complex and there are various ways to use the information contained
      within. Instead of converting that information we store the data from the tables
      as-is and extract the needed information when needed.
      
      * Handle index tables without entries (i.e. all content package units are of the
      same size).
      
      * Allow collecting index table segments as we go instead of only once if a
      random-index-pack is present. This also improves support of some files in
      push-mode.
      
      * When searching for keyframe entries, use the keyframe_offset if
      present (speeds up searching).
      
      * For interleaved content (i.e. several tracks in the sample essence container),
      we use a system to be able to identify the position of each track in the delta
      entries of index tables.
      
      * Handle temporal offset only on tracks which *do* need it (as specified in the
      delta entries of the index tables). If present, those offsets are stored in a
      pre-processed table which allows computing PTS from DTS with a simple offset.
      
      * Add a quirk for files which are known to be have wrongly stored temporal
      offsets.
      
      * Overall opens the way to handle more types of MXF files, especially those with
      non-frame-wrapping.
      
      Part-of: <gstreamer/gst-plugins-bad!2371>
      ac483b23
    • Edward Hervey's avatar
      c24d4876
    • Edward Hervey's avatar
      mxf: Improve index entry debug log · a68198c4
      Edward Hervey authored
      By printing out the various known flag values
      
      Part-of: <gstreamer/gst-plugins-bad!2371>
      a68198c4
    • Edward Hervey's avatar
      mxf: Demote error message when resolving valid empty reference · 11d9abd2
      Edward Hervey authored
      A Source Clip can have zero'd SourcePackageID and SourceTrackID, this indicates
      it terminates the source reference chain
      
      Part-of: <gstreamer/gst-plugins-bad!2371>
      11d9abd2
    • Edward Hervey's avatar
      mxfdemux: Handle temporal reordering shift · dfee771a
      Edward Hervey authored
      This is similar to how the same issue was handled in qtdemux.
      
      In order for the "DTS <= PTS" constraint to be respected, we calculate the
      maximum temporal reordering that can happen (via index tables).
      
      If there is a non-0 temporal reordering, we:
      * Shift all outgoing PTS by that amount
      * Shift segment for that stream by that amount
      * Don't modify DTS (i.e. they might end up having negative running-time, before
      the start of the segment)
      
      Also ensure all entries have a valid PTS set, previously this wouldn't be set
      for entries with a temporal offset of 0.
      
      Fixes gstreamer/gst-plugins-bad#584
      
      (and maybe a lot of other issues)
      
      Part-of: <gstreamer/gst-plugins-bad!2371>
      dfee771a
  4. 17 Jul, 2021 5 commits
  5. 16 Jul, 2021 2 commits
  6. 15 Jul, 2021 6 commits
    • Seungha Yang's avatar
      tests: Enable closedcaption test on Windows · 26fe5527
      Seungha Yang authored
      ... if closedcaption plugin is available
      
      Part-of: <!2411>
      26fe5527
    • Seungha Yang's avatar
      mfvideoenc: Disable RGB format support · 9becc1fe
      Seungha Yang authored
      Some GPUs support BGRA format and it will be converted to subsampled
      YUV format by GPU internally. Disable this implicit conversion
      since the conversion parameters such as input/output colorimetry
      are not exposed nor it's written in bitstream (e.g., VUI).
      We prefer explicit conversion via our conversion elements.
      
      Part-of: <gstreamer/gst-plugins-bad!2410>
      9becc1fe
    • He Junyan's avatar
      va: h265dec: Fix a temp var overflow bug when write pred weight table. · 67d482f8
      He Junyan authored
      The temp guint8 var of delta_chroma_offset_l0 and delta_chroma_offset_l1
      can not cover the full range of delta_chroma_weight_l0/1 in the slice
      header. When overflow happens, the decoder result is wrong.
      
      Part-of: <gstreamer/gst-plugins-bad!2412>
      67d482f8
    • Philippe Normand's avatar
      dash: Store entire ContentProtection node in protection event data · bc09d8cc
      Philippe Normand authored
      Some manifests use the ContentProtection node to store additional information
      such as the license server url. Our MPD parser used to process the
      ContentProtection node, extracting Playready PSSH boxes. However for other DRM
      systems, only the `value` attribute was passed down to the protection event, so
      for example, Widevine data was not parsed at all and "Widevine" was passed to
      the event, which is not very useful for decryptors that require a PSSH init
      data.
      
      Parsing should now be done by decryptors which will receive the entire
      ContentProtection XML node as a string. This gives more "freedom" to the
      decryptor which can then detect and parse custom nodes as well.
      
      Part-of: <!2400>
      bc09d8cc
    • He Junyan's avatar
      va: vp9dec: We need to check the resolution changes for every frame. · ff0e42eb
      He Junyan authored
      The VP9 streams have the ability to change the resolution dynamically
      at any time point. It does not send ad KEY frame before change the
      resolution, even the INTER frame can change the resolution immediately.
      So we need to check the resolution change for each frame and do the
      re-negiotiation if needed.
      
      Some insaned stream may play in resolution A first and then dynamically
      changes to B, and after 1 or 2 frames, it use a show_existing_frame to
      repeat the old frame of resolution A before. So, not only new_picture(),
      but also duplicate_picture() need to check this.
      
      Part-of: <gstreamer/gst-plugins-bad!2407>
      ff0e42eb
    • He Junyan's avatar
      va: vp9dec: Do not re-create context for dynamical resolution change. · 458ac4a6
      He Junyan authored
      The driver for VP9 should have the ability to handle the dynamical resolution
      changes. So if only the resolution changes, we should not re-create the config
      and context in negotiation.
      
      Part-of: <gstreamer/gst-plugins-bad!2407>
      458ac4a6