Commit graph

4074 commits

Author SHA1 Message Date
Nicolas Dufresne
4ee6167616 h264dec: Fix POC calculation for type 0
This is mostly for future use as it only fixes the caclulation for interlaced
cases, the case of frame seemed correct already.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1812>
2020-11-17 19:00:39 +09:00
Seungha Yang
11509fded1 codecs: h264decoder: Don't try to construct RefPicList0 and RefPicList1 if not required
We were trying to construct reference picture list even for
I slice before this commit. Reference list is required only for
P, SP and B slices. Also, if all existing reference pictures
are gap pictures, we don't need to construct lists.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1812>
2020-11-17 18:29:54 +09:00
Seungha Yang
fec686145e codecs: h264decoder: Fix MMCO type 1 for interlaced stream
If field_pic_flag of current picture is equal to zero,
both field of reference field pair should be marked as
"unused for reference"

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1810>
2020-11-16 14:25:36 +00:00
Seungha Yang
b83d452cc2 codecs: h264decoder: Fix MMCO type 3 for interlaced stream
Depending on short-ref picture corresponding to picNumX value,
there's a condition that only one field should be updated to
be non-reference picture.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1810>
2020-11-16 14:25:36 +00:00
Seungha Yang
caa5eb65d1 codecs: h264decoder: Split frame picture into field pictures if needed
In case of interlaced stream, frame pictures need to be splitted
into field for reference marking process.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1810>
2020-11-16 14:25:36 +00:00
Seungha Yang
7b42b1f9fb codecs: h264decoder: Add util macro for frame/field picture identification
Add a macro to check whether given GstH264Picture is for frame or field
decoding.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1810>
2020-11-16 14:25:36 +00:00
Seungha Yang
f9af93d841 codecs: h264decoder: Don't give up to decode due to missing reference picture
Missing reference picture is very common thing for broken/malformed stream.
Decoder should be able to keep decoding if it's not a very critical error.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1809>
2020-11-14 16:17:18 +00:00
Seungha Yang
0b9f975b36 codecs: h264decoder: Add support for interlaced stream
Initial support for interlaced stream. Subclass should implement
new_field_picture() vfunc. Otherwise, baseclass will assume that
subclass doesn't support interlaced stream.

Restrictions:
* Reference picture modification process for interlaced stream
  is not implemented yet
* PAFF (Picture Adaptive Frame Field) is not properly implemented.
* Field display ordering (e.g., top-field-first) decision should
  be enhanced via picture timing SEI parsing
* Gap in field picture should be handled

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1534>
2020-11-13 15:25:43 +00:00
Seungha Yang
52a8864076 codecs: h264decoder: Rename DPB methods
Clarify wheter it's for picture(field) or frame in order to
support interlaced stream, because DPB size is frame unit, not picture
in case of interlaced stream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1534>
2020-11-13 15:25:42 +00:00
Seungha Yang
9bd6b5f0b4 codecs: h264decoder: Remove interlaced stream related constraints
... and add new_field_picture() vfunc so that ensure interlaced
decoding support by subclass.
The method will be used later with interlaced stream support.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1534>
2020-11-13 15:25:42 +00:00
Seungha Yang
5585314b56 codecs: h264decoder: Move to inline GstH264DecoderClass documentation
Don't duplicate documentation for class vfunc. Hotdoc doesn't seem
to be happy with duplicated documentation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1534>
2020-11-13 15:25:42 +00:00
Seungha Yang
7a53d7a4aa codecs: h264decoder: Store reference picture type using enum value
Managing reference picture type by using two variables
(ref and long_term) seems to be redundant and that can be
represented by using a single enum value.

This is to sync this implementation with gstreamer-vaapi so that
make comparison between this and gstreamer-vaapi easier and also
in order to minimize the change required for subclass to be able
to support interlaced.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1534>
2020-11-13 15:25:42 +00:00
Seungha Yang
157210eb19 codecs: h264decoder: Minor documentation fix
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1534>
2020-11-13 15:25:42 +00:00
Seungha Yang
227456d240 codecs: h264decoder: Remove DPB size related spammy debug message
It's not informative at all if SPS wasn't updated. Also we are printing
DPB size related debug message in another place already.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1806>
2020-11-13 14:50:09 +00:00
Seungha Yang
6a6f8c967c codecs: h264decoder: Don't fill gap picture if it's not allowed
We should fill gap picture only if sps->gaps_in_frame_num_value_allowed_flag
is set.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1801>
2020-11-12 14:38:56 +00:00
Edward Hervey
7b2368b6df adaptivedemux: Don't calculate bitrate for header/index fragments
They are generally substantially smaller than regular fragments, and therefore
we end up pushing totally wrong bitrates downstream.

Fixes erratic buffering issues with DASH introduced by
66f5e87435

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1021>
2020-11-11 20:18:11 +00:00
Edward Hervey
dd425fe0fd adaptivedemux: Store QoS values on the element
Storing it per-stream requires taking the manifest lock which can apparenly be
hold for aeons. And since the QoS event comes from the video rendering thread
we *really* do not want to do that.

Storing it as-is in the element is fine, the important part is knowing the
earliest time downstream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1021>
2020-11-11 20:18:11 +00:00
Edward Hervey
e700a21993 adaptivedemux: Don't calculate bitrate for header/index fragments
They are generally substantially smaller than regular fragments, and therefore
we end up pushing totally wrong bitrates downstream.

Fixes erratic buffering issues with DASH introduced by
66f5e87435

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1786>
2020-11-11 19:46:16 +00:00
He Junyan
04472c5adb codecs: vp8decoder: Fix two typo of struct name.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1797>
2020-11-11 18:52:37 +00:00
Seungha Yang
5342b05390 codecs: h264decoder: Fix missing drain handling in bumping
Should've included in the commit 5527cc4a2e

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1783>
2020-11-09 14:40:06 +00:00
Seungha Yang
64c1218948 codecs: h264decoder: Try reference picture marking process in any case
... even if there is some invalid conditions
(because of broken stream, our implementation fault or so).
Otherwise baseclass will keep such reference pictures and
it would result to DPB full.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1783>
2020-11-09 14:40:06 +00:00
Seungha Yang
81151145b2 codecs: h264decoder: Reset frame number per MMCO type 5
It should be cleared so that avoid wrong frame gap detection
for following pictures.

Passing 4 more conformance bitstream tests
* MR2_TANDBERG_E
* MR3_TANDBERG_B
* MR4_TANDBERG_C
* MR5_TANDBERG_C

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1768>
2020-11-05 14:56:28 +00:00
Seungha Yang
e78dc91f9e codecs: h264decoder: Fix for MMCO type 2
As per 8.2.5.4.2, we should mark a picture which has
LongTermPicNum == long_term_pic_num as "unused for reference",
not pic_num.

Passing conformance bitstream test with MR2_MW_A

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1768>
2020-11-05 14:56:28 +00:00
Seungha Yang
0e53668a9b codecs: h264picture: Add more trace log
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1768>
2020-11-05 14:56:28 +00:00
Rafostar
5c31aeaaa4 doc: player: mention that get_pipeline method needs unref
All other methods in docs clearly mention that an unref is needed, so should `get_pipeline()`. #1450

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1764>
2020-11-05 08:57:51 +00:00
Rafostar
40f1a34d10 player: call ref_sink on pipeline
Otherwise `gst_player_get_pipeline()` will return a floating reference which may confuse bindings and lead to crash.

Fixes #1450

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1763>
2020-11-05 08:36:10 +00:00
Nicolas Dufresne
6f556518c8 h265parser: Fix wrong warning message
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1714>
2020-11-04 17:53:23 +00:00
Nicolas Dufresne
c1502a2bdf h265decoder: Remove unsued WpOffsetHalfRangeC
This is only needed for VA implementation of weight tables and isn't used
within the base class.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1714>
2020-11-04 17:53:23 +00:00
Seungha Yang
5527cc4a2e codecs: h264decoder: Rework for DPB management
Sync with recent h265decoder DPB implementation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1761>
2020-11-05 02:26:47 +09:00
Seungha Yang
b70ceb4235 codecs: h264decoder: Remove unused pts variable
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1761>
2020-11-05 00:33:34 +09:00
Seungha Yang
d1f397e754 codecs: h265picture: Minor update for coding style
It's GstH265Dpb, not GstH265Decoder

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1755>
2020-11-02 20:20:56 +00:00
Seungha Yang
db10288382 codecs: h265decoder: Make GstVideoCodecFrame hold the last reference of the buffer
The functionality of passing the last reference of GstH265Picture
was silently dropped by the commit eeffd91109
This commit will make it work again.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1755>
2020-11-02 20:20:56 +00:00
Seungha Yang
b69840711e codecs: h265decoder: Clear GstVideoCodecFrame on DPB clear if needed
h265decoder might need to clear DPB depending on context even if
it's not flushing case. So associated GstVideoCodecFrame needs to be
released in case non-flushing case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1755>
2020-11-02 20:20:56 +00:00
Seungha Yang
16b4fe3d0b codecs: h265decoder: Don't drain DPB on EOB/EOS/IDR nalu
DPB bumping decision per end-of-bitstream, end-of-sequence or IDR nal
should done by spec. In short, draining on EOB/EOS/IDR is undefined
behavior as per spec.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1755>
2020-11-02 20:20:56 +00:00
Nicolas Dufresne
849b7a315c h265decoder: Complete dependent slice header
This will save the last independent slice and fill in the missing
information for dependent slices. This was left over during the porting
from gstreamer-vaapi. The private variable prev_independent_slice was
already there.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1750>
2020-11-02 18:20:32 +00:00
Nicolas Dufresne
e3fb5f894f h265decoder: Prevent possible infinite loop
Theoretically, one could produce a broken stream that would lead to
infinite in the specified algorithm to calculate l0/l1 reference lists.
This patch will pearly exit if this condition is met.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1750>
2020-11-02 18:20:32 +00:00
Nicolas Dufresne
2e2e93c303 h265parse: Add missing const qualifier
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1750>
2020-11-02 18:20:32 +00:00
Seungha Yang
eeffd91109 codecs: h265decocer: Rework for DPB management
* Move all DPB bumping process into GstH265Dpb internal
* Handle DPB add process in GstH265Dpb struct
* Make implementation to be 1:1 mappable with hevc specification
* Fix wrong DPB bumping implementation especially when no_output_of_prior_pics_flag
  was specified.

With fixes from Nicolas Dufresne <nicolas.dufresne@collabora.com>

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1748>
2020-11-01 21:46:12 +09:00
Olivier Crête
cca313ecd8 rtpsender: Add API to set the priority
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1707>
2020-10-30 16:24:40 -04:00
Olivier Crête
7be09a5f22 webrtc: Save the media kind in the transceiver
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1707>
2020-10-30 16:23:10 -04:00
Olivier Crête
78c687da3e webrtc: Document more objects
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1707>
2020-10-30 16:23:10 -04:00
Thibault Saunier
a5fd2a4bc3 uritranscodebin: Move to using a urisourcebin for our source.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1151>
2020-10-29 13:30:07 +00:00
Thibault Saunier
7d1f5e951f transcoder: Base sync transcoding variant on a GMainLoop
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1151>
2020-10-29 13:30:07 +00:00
He Junyan
002cddf131 codecs: h265decoder: Fix picture leaks because of reference set.
The last frame's reference set has no one to cleanup. We need to
clean all pictures in the stop() func.
We also add a helper function to cleanup all the pictures in the
reference picture set.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1717>
2020-10-23 16:21:15 +00:00
He Junyan
4d296a07e4 codecs: h265decoder: Fix 3 ref array leaks in finalize.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1717>
2020-10-23 16:21:15 +00:00
Xavier Claessens
2efb4a7adb Meson: Use pkg-config generator 2020-10-23 11:14:18 -04:00
Nicolas Dufresne
f22fc190e7 h265decoder: Add support for l0/l1
Add support for reference list needed for VA-API and some V4L2 decoders.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1713>
2020-10-21 09:05:57 -04:00
Nicolas Dufresne
f330b5ae62 h265decoder: Sync with the H264 implementation
This ensures that we get the last reference to picture being outputed,
avoiding GstBuffer structure copies and simplifying the buffer management.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1713>
2020-10-21 09:05:57 -04:00
Víctor Manuel Jáquez Leal
113867766e codecs: vp9decoder: Add segmentation to picture.
VA-API needs AC and DC quant scales for both luma and chroma, and the loop
filter level for current frame, but these values are not available outside
the private GstVp9Parser structure. And these values may change from frame
to frame, so they are picture specific.

This patch add GstVp9Segmentation structure array to GstVp9Picture to expose
it to derived classes. This approach is safer than passing the parser at
picture handling flow.

Also, this patch, in order to solve Documentation CI, mark as private the
GstVp9Picture structure.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1700>
2020-10-16 17:50:42 +00:00
Víctor Manuel Jáquez Leal
5e3c7f2092 codecs: vp9decoder: Pass parser as new_sequence() parameter.
In order to know the chroma format, besides profile, subsampling_x and
subsampling_y are needed (Spec 7.2.2 Color config semantics). These values are
in GstVp9Parser but not in  GstVp9Framehdr.

Also, bit_depth is available in parser but not frame header. Evenmore, those
values are copied to picture structure later.

In case of VA-API, to configure the pipeline, it is require to know the chroma
format and depth.

It is possible to know chroma and depth through caps coming from vp9parser, but
it requires string parsing. It would be less error prone to get these values
through the parser structure at new_sequence() virtual method.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1700>
2020-10-16 17:50:42 +00:00