Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • gstreamer/gst-plugins-bad
  • thiblahute/gst-plugins-bad
  • slomo/gst-plugins-bad
  • sree/gst-plugins-bad
  • seungha.yang/gst-plugins-bad
  • xclaesse/gst-plugins-bad
  • haihao/gst-plugins-bad
  • Russel/gst-plugins-bad
  • heftig/gst-plugins-bad
  • joshuadoe/gst-plugins-bad
  • bilboed/gst-plugins-bad
  • ndufresne/gst-plugins-bad
  • ystreet/gst-plugins-bad
  • hgr/gst-plugins-bad
  • nielsdg/gst-plugins-bad
  • Brad/gst-plugins-bad
  • alatiera/gst-plugins-bad
  • SiewHoon/gst-plugins-bad
  • joykim/gst-plugins-bad
  • edholland/gst-plugins-bad
  • jh-hsd/gst-plugins-bad
  • lpendresen/gst-plugins-bad
  • daniels/gst-plugins-bad
  • nirbheek/gst-plugins-bad
  • tchakabam/gst-plugins-bad
  • wangfei/gst-plugins-bad
  • mangix/gst-plugins-bad
  • gdesmott/gst-plugins-bad
  • jonakn/gst-plugins-bad
  • Yeongjin-Jeong/gst-plugins-bad
  • harshadkhedkar/gst-plugins-bad
  • vjaquez/gst-plugins-bad
  • tpm/gst-plugins-bad
  • drakkan/gst-plugins-bad
  • milloni-ct/gst-plugins-bad
  • wonchul/gst-plugins-bad
  • philn/gst-plugins-bad
  • patricia/gst-plugins-bad
  • alexashley/gst-plugins-bad
  • gkiagia/gst-plugins-bad
  • dong9/gst-plugins-bad
  • michaelgruner/gst-plugins-bad
  • ikreymer/gst-plugins-bad
  • donghyeok/gst-plugins-bad
  • ullysses.a.eoff/gst-plugins-bad
  • CarlFK/gst-plugins-bad
  • ding/gst-plugins-bad
  • meh/gst-plugins-bad
  • victortoso/gst-plugins-bad
  • valbok/gst-plugins-bad
  • joel-holdsworth/gst-plugins-bad
  • jdm/gst-plugins-bad
  • thaytan/gst-plugins-bad
  • yangcha/gst-plugins-bad
  • ThomasSchlien/gst-plugins-bad
  • boxerab/gst-plugins-bad
  • den_erpel/gst-plugins-bad
  • alyyousuf7/gst-plugins-bad
  • andrey-konovalov/gst-plugins-bad
  • mvlad/gst-plugins-bad
  • JimmyOhn/gst-plugins-bad
  • chturne/gst-plugins-bad
  • yskkmi/gst-plugins-bad
  • vivia/gst-plugins-bad
  • billylindeman/gst-plugins-bad
  • nacho.garglez/gst-plugins-bad
  • MaZderMind/gst-plugins-bad
  • david.lee/gst-plugins-bad
  • JaredHu/gst-plugins-bad
  • ulfo/gst-plugins-bad
  • fuweitax/gst-plugins-bad
  • calvaris/gst-plugins-bad
  • codinho/gst-plugins-bad
  • lord.jacold/gst-plugins-bad
  • adn770/gst-plugins-bad
  • ayaka/gst-plugins-bad
  • kevinbing.song/gst-plugins-bad
  • billconan/gst-plugins-bad
  • psreport/gst-plugins-bad
  • welaq/gst-plugins-bad
  • dank/gst-plugins-bad
  • raytiley/gst-plugins-bad
  • myungjoo/gst-plugins-bad
  • fabio-d/gst-plugins-bad
  • marcosk/gst-plugins-bad
  • nh2/gst-plugins-bad
  • creiter/gst-plugins-bad
  • mnauw/gst-plugins-bad
  • dv1/gst-plugins-bad
  • santoscadenas/gst-plugins-bad
  • dabrain34/gst-plugins-bad
  • taylor.patton/gst-plugins-bad
  • edersondisouza/gst-plugins-bad
  • GNUDimarik/gst-plugins-bad
  • Aduskett/gst-plugins-bad
  • aleksandrm8/gst-plugins-bad
  • OleksandrKvl/gst-plugins-bad
  • autintim/gst-plugins-bad
  • charles/gst-plugins-bad
  • floobleflam/gst-plugins-bad
  • lantw/gst-plugins-bad
  • bellet/gst-plugins-bad
  • marxin.liska/gst-plugins-bad
  • therimar/gst-plugins-bad
  • xhaakon/gst-plugins-bad
  • zeidbekli48/gst-plugins-bad
  • okajun/gst-plugins-bad
  • szve/gst-plugins-bad
  • dougnazar/gst-plugins-bad
  • nacho.resa/gst-plugins-bad
  • pfy/gst-plugins-bad
  • coldtom/gst-plugins-bad
  • ankurdeepjaiswal/gst-plugins-bad
  • fdavulcu/gst-plugins-bad
  • lemenkov/gst-plugins-bad
  • Pyrrhvs/gst-plugins-bad
  • wangyan42164/gst-plugins-bad
  • tezcatli/gst-plugins-bad
  • ssaito/gst-plugins-bad
  • slabajo/gst-plugins-bad
  • hq/gst-plugins-bad
  • peat-psuwit/gst-plugins-bad
  • mol/gst-plugins-bad
  • luisbg/gst-plugins-bad
  • zubzub/gst-plugins-bad
  • fabiangreffrath/gst-plugins-bad
  • davidph/gst-plugins-bad
  • pH5/gst-plugins-bad
  • jmaibaum/gst-plugins-bad
  • aleb/gst-plugins-bad
  • jcelaya/gst-plugins-bad
  • StefanBruens/gst-plugins-bad
  • abranson/gst-plugins-bad
  • cap/gst-plugins-bad
  • ihalip/gst-plugins-bad
  • vedangpatel1/gst-plugins-bad
  • ali1234/gst-plugins-bad
  • jgilje/gst-plugins-bad
  • He_Junyan/gst-plugins-bad
  • aguedes/gst-plugins-bad
  • francisv/gst-plugins-bad
  • t/gst-plugins-bad
  • hwilkes/gst-plugins-bad
  • thiagossantos/gst-plugins-bad
  • linussn/gst-plugins-bad
  • Hosang/gst-plugins-bad
  • rob_gries/gst-plugins-bad
  • o0Ignition0o/gst-plugins-bad
  • ntrrgc/gst-plugins-bad
  • neithanmo/gst-plugins-bad
  • andrew.voznytsa/gst-plugins-bad
  • sf2020/gst-plugins-bad
  • danisla/gst-plugins-bad
  • juzza_uk/gst-plugins-bad
  • fraxinas/gst-plugins-bad
  • Arhno/gst-plugins-bad
  • leio/gst-plugins-bad
  • guillerodriguez/gst-plugins-bad
  • krivoguzovVlad/gst-plugins-bad
  • ludvigr/gst-plugins-bad
  • nazar-pc/gst-plugins-bad
  • Buora/gst-plugins-bad
  • heinrich.kruger/gst-plugins-bad
  • motownread/gst-plugins-bad
  • jwestman/gst-plugins-bad
  • paulyc/gst-plugins-bad
  • balte/gst-plugins-bad
  • jurijs.satcs/gst-plugins-bad
  • rgonzalez/gst-plugins-bad
  • antonovitch/gst-plugins-bad
  • jan.vermaete/gst-plugins-bad
  • XuGuangxin/gst-plugins-bad
  • 123vivekr/gst-plugins-bad
  • decembersoul/gst-plugins-bad
  • mparisdiaz/gst-plugins-bad
  • worldofpeace/gst-plugins-bad
  • achris/gst-plugins-bad
  • nanonyme/gst-plugins-bad
  • arun/gst-plugins-bad
  • DuBistKomisch/gst-plugins-bad
  • lblasc/gst-plugins-bad
  • ahoenig/gst-plugins-bad
  • Mats/gst-plugins-bad
  • Andruxin52rus/gst-plugins-bad
  • cketti/gst-plugins-bad
  • MM_Star/gst-plugins-bad
  • Chikushu/gst-plugins-bad
  • daniel.qtec/gst-plugins-bad
  • 4kevinking/gst-plugins-bad
  • fritzprix/gst-plugins-bad
  • dhobsong/gst-plugins-bad
  • rambden/gst-plugins-bad
  • razvanphp/gst-plugins-bad
  • foreverneilyoung/gst-plugins-bad
  • wtaymans/gst-plugins-bad
  • ezequielgarcia/gst-plugins-bad
  • trollkarlen/gst-plugins-bad
  • jedevc/gst-plugins-bad
  • jusizela/gst-plugins-bad
  • karim.davoodi/gst-plugins-bad
  • quaresma.jose/gst-plugins-bad
  • felixonmars/gst-plugins-bad
  • louisharris/gst-plugins-bad
  • lmurillo/gst-plugins-bad
  • trilene/gst-plugins-bad
  • jlaheurte/gst-plugins-bad
  • jmatthew/gst-plugins-bad
  • wilkinsw/gst-plugins-bad
  • yychao/gst-plugins-bad
  • eckhart.koppen/gst-plugins-bad
  • AdamW/gst-plugins-bad
  • SanchayanMaity/gst-plugins-bad
  • twischer/gst-plugins-bad
  • marian/gst-plugins-bad
  • linkmauve/gst-plugins-bad
  • gvanmeter/gst-plugins-bad
  • julian/gst-plugins-bad
  • raghu447/gst-plugins-bad
  • TobiasR/gst-plugins-bad
  • MoizAhmedd/gst-plugins-bad
  • gstreamer-release-bot/gst-plugins-bad
  • artectrex/gst-plugins-bad
  • Rafostar/gst-plugins-bad
  • mindriot88/gst-plugins-bad
  • mexxik/gst-plugins-bad
  • robin.carlisle/gst-plugins-bad
  • MarijnS95/gst-plugins-bad
  • igor.v.kovalenko/gst-plugins-bad
  • chriswiggins/gst-plugins-bad
  • johast/gst-plugins-bad
  • fauxsoup1/gst-plugins-bad
  • ekwange/gst-plugins-bad
  • raju.babannavar/gst-plugins-bad
  • eater/gst-plugins-bad
  • ds/gst-plugins-bad
  • avantgardnerio/gst-plugins-bad
  • marsupial/gst-plugins-bad
  • ignacy.ruksza/gst-plugins-bad
  • t-8ch/gst-plugins-bad
  • trey.hutcheson/gst-plugins-bad
  • ssanders1449/gst-plugins-bad
  • stazio/gst-plugins-bad
  • obbardc/gst-plugins-bad
  • dwlsalmeida/gst-plugins-bad
  • benjamin.gaignard1/gst-plugins-bad
  • AntoninRousset/gst-plugins-bad
  • AdhBash816/gst-plugins-bad
  • jjanku/gst-plugins-bad
  • liuyinhangx/gst-plugins-bad
  • AdvanceSoftware/gst-plugins-bad
  • jn/gst-plugins-bad
  • wantlamy/gst-plugins-bad
  • hjanuschka/gst-plugins-bad
  • Nei/gst-plugins-bad
  • arojas/gst-plugins-bad
  • zhao-gang/gst-plugins-bad
  • sid.sethupathi/gst-plugins-bad
  • mkba/gst-plugins-bad
  • YakoYakoYokuYoku/gst-plugins-bad
  • CartoonFan/gst-plugins-bad
  • rsiv/gst-plugins-bad
  • martinetd/gst-plugins-bad
  • reynaldo/gst-plugins-bad
  • kay0u1/gst-plugins-bad
  • thongthai/gst-plugins-bad
  • spartazhc/gst-plugins-bad
  • leeys888/gst-plugins-bad
  • ferruck/gst-plugins-bad
  • benjamin545/gst-plugins-bad
  • budziq/gst-plugins-bad
  • madsbuvi/gst-plugins-bad
  • agx/gst-plugins-bad
  • amotzte/gst-plugins-bad
  • devarsht/gst-plugins-bad
  • kimtinh/gst-plugins-bad
  • lshuying/gst-plugins-bad
  • rsnk96/gst-plugins-bad
  • mortimergoro/gst-plugins-bad
  • cfoch/gst-plugins-bad
  • jfelder/gst-plugins-bad
  • kathirvel621/gst-plugins-bad
  • bradh/gst-plugins-bad
  • middelschultele/gst-plugins-bad
  • pocock/gst-plugins-bad
  • marex/gst-plugins-bad
  • vivienne/gst-plugins-bad
  • pldin601/gst-plugins-bad
  • heirecka/gst-plugins-bad
  • Casey-Bateman/gst-plugins-bad
  • adrianf0/gst-plugins-bad
  • ovchinnikov.dmitrii/gst-plugins-bad
  • DimStar77/gst-plugins-bad
  • intelfx/gst-plugins-bad
  • derschueddi/gst-plugins-bad
  • driss.el.bouhali/gst-plugins-bad
  • jinsl00000/gst-plugins-bad
  • Wenlin/gst-plugins-bad
  • carra8674/gst-plugins-bad
  • ssdeng6812/gst-plugins-bad
  • glepag1/gst-plugins-bad
  • cnhzcy14/gst-plugins-bad
  • HuQian/gst-plugins-bad
  • Zhipeng/gst-plugins-bad
  • Harikrishnan/gst-plugins-bad
  • benjaminGraef/gst-plugins-bad
  • vnguyentrong/gst-plugins-bad
306 results
Show changes
Commits on Source (4)
......@@ -192,6 +192,12 @@ gst_webrtc_ice_stream_gather_candidates (GstWebRTCICEStream * stream)
return FALSE;
}
for (l = stream->priv->transports; l; l = l->next) {
GstWebRTCNiceTransport *trans = l->data;
gst_webrtc_nice_transport_update_buffer_size (trans);
}
g_object_unref (agent);
return TRUE;
}
......
......@@ -24,6 +24,8 @@
#include "nicetransport.h"
#include "icestream.h"
#include <gio/gnetworking.h>
#define GST_CAT_DEFAULT gst_webrtc_nice_transport_debug
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
......@@ -37,6 +39,8 @@ enum
{
PROP_0,
PROP_STREAM,
PROP_SEND_BUFFER_SIZE,
PROP_RECEIVE_BUFFER_SIZE
};
//static guint gst_webrtc_nice_transport_signals[LAST_SIGNAL] = { 0 };
......@@ -44,6 +48,9 @@ enum
struct _GstWebRTCNiceTransportPrivate
{
gboolean running;
gint send_buffer_size;
gint receive_buffer_size;
};
#define gst_webrtc_nice_transport_parent_class parent_class
......@@ -115,6 +122,14 @@ gst_webrtc_nice_transport_set_property (GObject * object, guint prop_id,
gst_object_unref (nice->stream);
nice->stream = g_value_dup_object (value);
break;
case PROP_SEND_BUFFER_SIZE:
nice->priv->send_buffer_size = g_value_get_int (value);
gst_webrtc_nice_transport_update_buffer_size (nice);
break;
case PROP_RECEIVE_BUFFER_SIZE:
nice->priv->receive_buffer_size = g_value_get_int (value);
gst_webrtc_nice_transport_update_buffer_size (nice);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -131,6 +146,12 @@ gst_webrtc_nice_transport_get_property (GObject * object, guint prop_id,
case PROP_STREAM:
g_value_set_object (value, nice->stream);
break;
case PROP_SEND_BUFFER_SIZE:
g_value_set_int (value, nice->priv->send_buffer_size);
break;
case PROP_RECEIVE_BUFFER_SIZE:
g_value_set_int (value, nice->priv->receive_buffer_size);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -147,6 +168,51 @@ gst_webrtc_nice_transport_finalize (GObject * object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
void
gst_webrtc_nice_transport_update_buffer_size (GstWebRTCNiceTransport * nice)
{
GstWebRTCICETransport *ice = GST_WEBRTC_ICE_TRANSPORT (nice);
NiceAgent *agent = NULL;
GPtrArray *sockets;
guint i;
g_object_get (nice->stream->ice, "agent", &agent, NULL);
g_assert (agent != NULL);
sockets = nice_agent_get_sockets (agent, nice->stream->stream_id,
ice->component + 1);
if (sockets == NULL) {
g_object_unref (agent);
return;
}
for (i = 0; i < sockets->len; i++) {
GSocket *gsocket = g_ptr_array_index (sockets, i);
#ifdef SO_SNDBUF
if (nice->priv->send_buffer_size != 0) {
GError *gerror = NULL;
if (!g_socket_set_option (gsocket, SOL_SOCKET, SO_SNDBUF,
nice->priv->send_buffer_size, &gerror))
GST_WARNING_OBJECT (nice, "Could not set send buffer size : %s",
gerror->message);
g_clear_error (&gerror);
}
#endif
#ifdef SO_RCVBUF
if (nice->priv->receive_buffer_size != 0) {
GError *gerror = NULL;
if (!g_socket_set_option (gsocket, SOL_SOCKET, SO_RCVBUF,
nice->priv->receive_buffer_size, &gerror))
GST_WARNING_OBJECT (nice, "Could not set send receive size : %s",
gerror->message);
g_clear_error (&gerror);
}
#endif
}
g_ptr_array_unref (sockets);
}
static void
_on_new_selected_pair (NiceAgent * agent, guint stream_id,
NiceComponentType component, NiceCandidate * lcandidate,
......@@ -245,6 +311,34 @@ gst_webrtc_nice_transport_class_init (GstWebRTCNiceTransportClass * klass)
"WebRTC ICE Stream", "ICE stream associated with this transport",
GST_TYPE_WEBRTC_ICE_STREAM,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
/**
* GstWebRTCNiceTransport:send-buffer-size:
*
* Size of the kernel send buffer in bytes, 0=default
*
* Since: 1.20
*/
g_object_class_install_property (G_OBJECT_CLASS (klass),
PROP_SEND_BUFFER_SIZE, g_param_spec_int ("send-buffer-size",
"Send Buffer Size",
"Size of the kernel send buffer in bytes, 0=default", 0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GstWebRTCNiceTransport:receive-buffer-size:
*
* Size of the kernel receive buffer in bytes, 0=default
*
* Since: 1.20
*/
g_object_class_install_property (G_OBJECT_CLASS (klass),
PROP_RECEIVE_BUFFER_SIZE, g_param_spec_int ("receive-buffer-size",
"Receive Buffer Size",
"Size of the kernel receive buffer in bytes, 0=default", 0, G_MAXINT,
0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
static void
......
......@@ -50,8 +50,11 @@ struct _GstWebRTCNiceTransportClass
GstWebRTCICETransportClass parent_class;
};
GstWebRTCNiceTransport * gst_webrtc_nice_transport_new (GstWebRTCICEStream * stream,
GstWebRTCICEComponent component);
GstWebRTCNiceTransport * gst_webrtc_nice_transport_new (GstWebRTCICEStream * stream,
GstWebRTCICEComponent component);
void gst_webrtc_nice_transport_update_buffer_size (GstWebRTCNiceTransport * nice);
G_END_DECLS
......
This diff is collapsed.
......@@ -22,6 +22,7 @@
#endif
#include "gsth264picture.h"
#include <stdlib.h>
GST_DEBUG_CATEGORY_EXTERN (gst_h264_decoder_debug);
#define GST_CAT_DEFAULT gst_h264_decoder_debug
......@@ -51,7 +52,6 @@ gst_h264_picture_new (void)
pic = g_new0 (GstH264Picture, 1);
pic->pts = GST_CLOCK_TIME_NONE;
pic->top_field_order_cnt = G_MAXINT32;
pic->bottom_field_order_cnt = G_MAXINT32;
pic->field = GST_H264_PICTURE_FIELD_FRAME;
......@@ -107,8 +107,17 @@ struct _GstH264Dpb
{
GArray *pic_list;
gint max_num_pics;
gint num_output_needed;
gint32 last_output_poc;
};
static void
gst_h264_dpb_init (GstH264Dpb * dpb)
{
dpb->num_output_needed = 0;
dpb->last_output_poc = G_MININT32;
}
/**
* gst_h264_dpb_new: (skip)
*
......@@ -122,6 +131,7 @@ gst_h264_dpb_new (void)
GstH264Dpb *dpb;
dpb = g_new0 (GstH264Dpb, 1);
gst_h264_dpb_init (dpb);
dpb->pic_list =
g_array_sized_new (FALSE, TRUE, sizeof (GstH264Picture *),
......@@ -189,6 +199,7 @@ gst_h264_dpb_clear (GstH264Dpb * dpb)
g_return_if_fail (dpb != NULL);
g_array_set_size (dpb->pic_list, 0);
gst_h264_dpb_init (dpb);
}
/**
......@@ -204,6 +215,17 @@ gst_h264_dpb_add (GstH264Dpb * dpb, GstH264Picture * picture)
g_return_if_fail (dpb != NULL);
g_return_if_fail (GST_IS_H264_PICTURE (picture));
/* C.4.2 Decoding of gaps in frame_num and storage of "non-existing" pictures
*
* The "non-existing" frame is stored in an empty frame buffer and is marked
* as "not needed for output", and the DPB fullness is incremented by one */
if (!picture->nonexisting) {
picture->needed_for_output = TRUE;
dpb->num_output_needed++;
} else {
picture->needed_for_output = FALSE;
}
g_array_append_val (dpb->pic_list, picture);
}
......@@ -224,73 +246,17 @@ gst_h264_dpb_delete_unused (GstH264Dpb * dpb)
GstH264Picture *picture =
g_array_index (dpb->pic_list, GstH264Picture *, i);
if (picture->outputted && !picture->ref) {
/* NOTE: don't use g_array_remove_index_fast here since the last picture
* need to be referenced for bumping decision */
if (!picture->needed_for_output && !picture->ref) {
GST_TRACE ("remove picture %p (frame num %d) from dpb",
picture, picture->frame_num);
g_array_remove_index_fast (dpb->pic_list, i);
g_array_remove_index (dpb->pic_list, i);
i--;
}
}
}
/**
* gst_h264_dpb_delete_outputted:
* @dpb: a #GstH264Dpb
*
* Delete already outputted picture, even if they are referenced.
*
* Since: 1.18
*/
void
gst_h264_dpb_delete_outputted (GstH264Dpb * dpb)
{
gint i;
g_return_if_fail (dpb != NULL);
for (i = 0; i < dpb->pic_list->len; i++) {
GstH264Picture *picture =
g_array_index (dpb->pic_list, GstH264Picture *, i);
if (picture->outputted) {
GST_TRACE ("remove picture %p (frame num %d) from dpb",
picture, picture->frame_num);
g_array_remove_index_fast (dpb->pic_list, i);
i--;
}
}
}
/**
* gst_h264_dpb_delete_by_poc:
* @dpb: a #GstH264Dpb
* @poc: a poc of #GstH264Picture to remove
*
* Delete a #GstH264Dpb by @poc
*/
void
gst_h264_dpb_delete_by_poc (GstH264Dpb * dpb, gint poc)
{
gint i;
g_return_if_fail (dpb != NULL);
for (i = 0; i < dpb->pic_list->len; i++) {
GstH264Picture *picture =
g_array_index (dpb->pic_list, GstH264Picture *, i);
if (picture->pic_order_cnt == poc) {
GST_TRACE ("remove picture %p for poc %d (frame num %d) from dpb",
picture, poc, picture->frame_num);
g_array_remove_index_fast (dpb->pic_list, i);
return;
}
}
GST_WARNING ("Couldn't find picture with poc %d", poc);
}
/**
* gst_h264_dpb_num_ref_pictures:
* @dpb: a #GstH264Dpb
......@@ -426,33 +392,6 @@ gst_h264_dpb_get_lowest_frame_num_short_ref (GstH264Dpb * dpb)
return ret;
}
/**
* gst_h264_dpb_get_pictures_not_outputted:
* @dpb: a #GstH264Dpb
* @out: (out) (element-type GstH264Picture) (transfer full): an array
* of #GstH264Picture pointer
*
* Retrieve all not-outputted pictures from @dpb
*/
void
gst_h264_dpb_get_pictures_not_outputted (GstH264Dpb * dpb, GArray * out)
{
gint i;
g_return_if_fail (dpb != NULL);
g_return_if_fail (out != NULL);
for (i = 0; i < dpb->pic_list->len; i++) {
GstH264Picture *picture =
g_array_index (dpb->pic_list, GstH264Picture *, i);
if (!picture->outputted) {
gst_h264_picture_ref (picture);
g_array_append_val (out, picture);
}
}
}
/**
* gst_h264_dpb_get_pictures_short_term_ref:
* @dpb: a #GstH264Dpb
......@@ -538,20 +477,6 @@ gst_h264_dpb_get_size (GstH264Dpb * dpb)
return dpb->pic_list->len;
}
/**
* gst_h264_dpb_is_full:
* @dpb: a #GstH264Dpb
*
* Return: %TRUE if @dpb is full
*/
gboolean
gst_h264_dpb_is_full (GstH264Dpb * dpb)
{
g_return_val_if_fail (dpb != NULL, -1);
return dpb->pic_list->len >= dpb->max_num_pics;
}
/**
* gst_h264_dpb_get_picture:
* @dpb: a #GstH264Dpb
......@@ -582,3 +507,324 @@ gst_h264_dpb_get_picture (GstH264Dpb * dpb, guint32 system_frame_number)
return NULL;
}
static gboolean
gst_h264_dpb_has_empty_frame_buffer (GstH264Dpb * dpb)
{
if (dpb->pic_list->len <= dpb->max_num_pics)
return TRUE;
return FALSE;
}
static gint
gst_h264_dpb_get_lowest_output_needed_picture (GstH264Dpb * dpb,
GstH264Picture ** picture)
{
gint i;
GstH264Picture *lowest = NULL;
gint index = -1;
*picture = NULL;
for (i = 0; i < dpb->pic_list->len; i++) {
GstH264Picture *picture =
g_array_index (dpb->pic_list, GstH264Picture *, i);
if (!picture->needed_for_output)
continue;
if (!lowest) {
lowest = picture;
index = i;
continue;
}
if (picture->pic_order_cnt < lowest->pic_order_cnt) {
lowest = picture;
index = i;
}
}
if (lowest)
*picture = gst_h264_picture_ref (lowest);
return index;
}
/**
* gst_h264_dpb_needs_bump:
* @dpb: a #GstH264Dpb
* @current_picture: a #GstH264Picture currently decoded but not added to dpb
* @low_latency: %TRUE if low-latency bumping is required
*
* Returns: %TRUE if bumping is required
*
* Since: 1.20
*/
gboolean
gst_h264_dpb_needs_bump (GstH264Dpb * dpb, guint32 max_num_reorder_frames,
gboolean low_latency)
{
GstH264Picture *current_picture;
g_return_val_if_fail (dpb != NULL, FALSE);
g_assert (dpb->num_output_needed >= 0);
/* Empty so nothing to bump */
if (dpb->pic_list->len == 0 || dpb->num_output_needed == 0)
return FALSE;
/* FIXME: Need to revisit for intelaced decoding */
/* Case 1)
* C.4.2 Decoding of gaps in frame_num and storage of "non-existing" pictures
* C.4.5.1 Storage and marking of a reference decoded picture into the DPB
* C.4.5.2 Storage and marking of a non-reference decoded picture into the DPB
*
* In summary, if DPB is full and there is no empty space to store current
* picture, need bumping.
* NOTE: current picture was added already by our decoding flow, So we need to
* do bumping until dpb->pic_list->len == dpb->max_num_pic
*/
if (!gst_h264_dpb_has_empty_frame_buffer (dpb)) {
GST_TRACE ("No empty frame buffer, need bumping");
return TRUE;
}
if (dpb->num_output_needed > max_num_reorder_frames) {
GST_TRACE
("not outputted frames (%d) > max_num_reorder_frames (%d), need bumping",
dpb->num_output_needed, max_num_reorder_frames);
return TRUE;
}
current_picture =
g_array_index (dpb->pic_list, GstH264Picture *, dpb->pic_list->len - 1);
if (current_picture->needed_for_output && current_picture->idr &&
!current_picture->dec_ref_pic_marking.no_output_of_prior_pics_flag) {
GST_TRACE ("IDR with no_output_of_prior_pics_flag == 0, need bumping");
return TRUE;
}
if (current_picture->needed_for_output && current_picture->mem_mgmt_5) {
GST_TRACE ("Memory management type 5, need bumping");
return TRUE;
}
/* HACK: Not all streams have PicOrderCnt increment by 2, but in practice this
* condition can be used */
if (low_latency && dpb->last_output_poc != G_MININT32) {
GstH264Picture *picture = NULL;
gint32 lowest_poc = G_MININT32;
gst_h264_dpb_get_lowest_output_needed_picture (dpb, &picture);
if (picture) {
lowest_poc = picture->pic_order_cnt;
gst_h264_picture_unref (picture);
}
if (lowest_poc != G_MININT32 && lowest_poc > dpb->last_output_poc
&& abs (lowest_poc - dpb->last_output_poc) <= 2) {
GST_TRACE ("bumping for low-latency, lowest-poc: %d, last-output-poc: %d",
lowest_poc, dpb->last_output_poc);
return TRUE;
}
}
return FALSE;
}
/**
* gst_h264_dpb_bump:
* @dpb: a #GstH265Dpb
* @drain: whether draining or not
*
* Perform bumping process as defined in C.4.5.3 "Bumping" process.
* If @drain is %TRUE, @dpb will remove a #GstH264Picture from internal array
* so that returned #GstH264Picture could hold the last reference of it
*
* Returns: (nullable) (transfer full): a #GstH264Picture which is needed to be
* outputted
*
* Since: 1.20
*/
GstH264Picture *
gst_h264_dpb_bump (GstH264Dpb * dpb, gboolean drain)
{
GstH264Picture *picture;
gint index;
g_return_val_if_fail (dpb != NULL, NULL);
index = gst_h264_dpb_get_lowest_output_needed_picture (dpb, &picture);
if (!picture || index < 0)
return NULL;
picture->needed_for_output = FALSE;
dpb->num_output_needed--;
g_assert (dpb->num_output_needed >= 0);
/* NOTE: don't use g_array_remove_index_fast here since the last picture
* need to be referenced for bumping decision */
if (!picture->ref)
g_array_remove_index (dpb->pic_list, index);
dpb->last_output_poc = picture->pic_order_cnt;
return picture;
}
static gint
get_picNumX (GstH264Picture * picture, GstH264RefPicMarking * ref_pic_marking)
{
/* FIXME: support interlaced */
return picture->pic_num -
(ref_pic_marking->difference_of_pic_nums_minus1 + 1);
}
/**
* gst_h264_dpb_perform_memory_management_control_operation:
* @dpb: a #GstH265Dpb
* @ref_pic_marking: a #GstH264RefPicMarking
* @picture: a #GstH264Picture
*
* Perform "8.2.5.4 Adaptive memory control decoded reference picture marking process"
*
* Returns: %TRUE if successful
*
* Since: 1.20
*/
gboolean
gst_h264_dpb_perform_memory_management_control_operation (GstH264Dpb * dpb,
GstH264RefPicMarking * ref_pic_marking, GstH264Picture * picture)
{
guint8 type;
gint pic_num_x;
gint max_long_term_frame_idx;
GstH264Picture *other;
gint i;
g_return_val_if_fail (dpb != NULL, FALSE);
g_return_val_if_fail (ref_pic_marking != NULL, FALSE);
g_return_val_if_fail (picture != NULL, FALSE);
type = ref_pic_marking->memory_management_control_operation;
switch (type) {
case 0:
/* Normal end of operations' specification */
break;
case 1:
/* 8.2.5.4.1 Mark a short term reference picture as unused so it can be
* removed if outputted */
pic_num_x = get_picNumX (picture, ref_pic_marking);
other = gst_h264_dpb_get_short_ref_by_pic_num (dpb, pic_num_x);
if (other) {
other->ref = FALSE;
} else {
GST_WARNING ("Invalid picNumX %d for operation type 1", pic_num_x);
return FALSE;
}
break;
case 2:
/* 8.2.5.4.2 Mark a long term reference picture as unused so it can be
* removed if outputted */
other = gst_h264_dpb_get_long_ref_by_pic_num (dpb,
ref_pic_marking->long_term_pic_num);
if (other) {
other->ref = FALSE;
} else {
GST_WARNING ("Invalid LongTermPicNum %d for operation type 2",
ref_pic_marking->long_term_pic_num);
return FALSE;
}
break;
case 3:
/* 8.2.5.4.3 Mark a short term reference picture as long term reference */
/* If we have long-term ref picture for LongTermFrameIdx,
* mark the picture as non-reference */
for (i = 0; i < dpb->pic_list->len; i++) {
other = g_array_index (dpb->pic_list, GstH264Picture *, i);
if (other->ref && other->long_term && other->long_term_frame_idx ==
ref_pic_marking->long_term_frame_idx) {
GST_LOG ("Unmark old long-term ref pic %p (poc %d)",
other, other->pic_order_cnt);
other->ref = FALSE;
other->long_term = FALSE;
break;
}
}
pic_num_x = get_picNumX (picture, ref_pic_marking);
other = gst_h264_dpb_get_short_ref_by_pic_num (dpb, pic_num_x);
if (other) {
other->long_term = TRUE;;
other->long_term_frame_idx = ref_pic_marking->long_term_frame_idx;
} else {
GST_WARNING ("Invalid picNumX %d for operation type 3", pic_num_x);
return FALSE;
}
break;
case 4:
/* 8.2.5.4.4 All pictures for which LongTermFrameIdx is greater than
* max_long_term_frame_idx_plus1 − 1 and that are marked as
* "used for long-term reference" are marked as "unused for reference */
max_long_term_frame_idx =
ref_pic_marking->max_long_term_frame_idx_plus1 - 1;
for (i = 0; i < dpb->pic_list->len; i++) {
other = g_array_index (dpb->pic_list, GstH264Picture *, i);
if (other->ref && other->long_term &&
other->long_term_frame_idx > max_long_term_frame_idx) {
other->ref = FALSE;
other->long_term = FALSE;
}
}
break;
case 5:
/* 8.2.5.4.5 Unmark all reference pictures */
for (i = 0; i < dpb->pic_list->len; i++) {
other = g_array_index (dpb->pic_list, GstH264Picture *, i);
other->ref = FALSE;
other->long_term = FALSE;
}
picture->mem_mgmt_5 = TRUE;
break;
case 6:
/* 8.2.5.4.6 Replace long term reference pictures with current picture.
* First unmark if any existing with this long_term_frame_idx */
/* If we have long-term ref picture for LongTermFrameIdx,
* mark the picture as non-reference */
for (i = 0; i < dpb->pic_list->len; i++) {
other = g_array_index (dpb->pic_list, GstH264Picture *, i);
if (other->ref && other->long_term && other->long_term_frame_idx ==
ref_pic_marking->long_term_frame_idx) {
GST_LOG ("Unmark old long-term ref pic %p (poc %d)",
other, other->pic_order_cnt);
other->ref = FALSE;
other->long_term = FALSE;
break;
}
}
picture->ref = TRUE;
picture->long_term = TRUE;
picture->long_term_frame_idx = ref_pic_marking->long_term_frame_idx;
break;
default:
g_assert_not_reached ();
return FALSE;
}
return TRUE;
}
......@@ -54,11 +54,11 @@ typedef enum
struct _GstH264Picture
{
/*< private >*/
GstMiniObject parent;
GstH264SliceType type;
GstClockTime pts;
/* From GstVideoCodecFrame */
guint32 system_frame_number;
......@@ -85,7 +85,7 @@ struct _GstH264Picture
gint idr_pic_id;
gboolean ref;
gboolean long_term;
gboolean outputted;
gboolean needed_for_output;
gboolean mem_mgmt_5;
gboolean nonexisting;
......@@ -169,13 +169,6 @@ void gst_h264_dpb_add (GstH264Dpb * dpb,
GST_CODECS_API
void gst_h264_dpb_delete_unused (GstH264Dpb * dpb);
GST_CODECS_API
void gst_h264_dpb_delete_outputted (GstH264Dpb * dpb);
GST_CODECS_API
void gst_h264_dpb_delete_by_poc (GstH264Dpb * dpb,
gint poc);
GST_CODECS_API
gint gst_h264_dpb_num_ref_pictures (GstH264Dpb * dpb);
......@@ -193,10 +186,6 @@ GstH264Picture * gst_h264_dpb_get_long_ref_by_pic_num (GstH264Dpb * dpb,
GST_CODECS_API
GstH264Picture * gst_h264_dpb_get_lowest_frame_num_short_ref (GstH264Dpb * dpb);
GST_CODECS_API
void gst_h264_dpb_get_pictures_not_outputted (GstH264Dpb * dpb,
GArray * out);
GST_CODECS_API
void gst_h264_dpb_get_pictures_short_term_ref (GstH264Dpb * dpb,
GArray * out);
......@@ -216,7 +205,18 @@ GST_CODECS_API
gint gst_h264_dpb_get_size (GstH264Dpb * dpb);
GST_CODECS_API
gboolean gst_h264_dpb_is_full (GstH264Dpb * dpb);
gboolean gst_h264_dpb_needs_bump (GstH264Dpb * dpb,
guint32 max_num_reorder_frames,
gboolean low_latency);
GST_CODECS_API
GstH264Picture * gst_h264_dpb_bump (GstH264Dpb * dpb,
gboolean drain);
GST_CODECS_API
gboolean gst_h264_dpb_perform_memory_management_control_operation (GstH264Dpb * dpb,
GstH264RefPicMarking *ref_pic_marking,
GstH264Picture * picture);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstH264Picture, gst_h264_picture_unref)
......
......@@ -824,7 +824,7 @@ gst_aiff_parse_create_caps (GstAiffParse * aiff)
{
GstCaps *caps = NULL;
const gchar *format = NULL;
guint64 channel_mask;
guint64 channel_mask = 0;
if (aiff->floating_point) {
if (aiff->endianness == G_BIG_ENDIAN) {
......@@ -862,42 +862,37 @@ gst_aiff_parse_create_caps (GstAiffParse * aiff)
"rate", G_TYPE_INT, aiff->rate, NULL);
}
if (aiff->channels > 2) {
GST_FIXME_OBJECT (aiff, "using fallback channel layout for %d channels",
aiff->channels);
/* based on AIFF-1.3.pdf */
switch (aiff->channels) {
case 1:
channel_mask = 0;
break;
case 2:
channel_mask = _P (FRONT_LEFT) | _P (FRONT_RIGHT);
break;
case 3:
channel_mask = _P (FRONT_LEFT) | _P (FRONT_RIGHT) | _P (FRONT_CENTER);
break;
case 4:
/* lists both this and 'quad' but doesn't say how to distinguish the two */
channel_mask =
_P (FRONT_LEFT) | _P (FRONT_RIGHT) | _P (REAR_LEFT) |
_P (REAR_RIGHT);
break;
case 6:
channel_mask =
_P (FRONT_LEFT) | _P (FRONT_LEFT_OF_CENTER) | _P (FRONT_CENTER) |
_P (FRONT_RIGHT) | _P (FRONT_RIGHT_OF_CENTER) | _P (LFE1);
break;
default:
channel_mask = gst_audio_channel_get_fallback_mask (aiff->channels);
break;
}
/* based on AIFF-1.3.pdf */
switch (aiff->channels) {
case 1:
channel_mask = 0;
break;
case 2:
channel_mask = _P (FRONT_LEFT) | _P (FRONT_RIGHT);
break;
case 3:
channel_mask = _P (FRONT_LEFT) | _P (FRONT_RIGHT) | _P (FRONT_CENTER);
break;
case 4:
/* lists both this and 'quad' but doesn't say how to distinguish the two */
channel_mask =
_P (FRONT_LEFT) | _P (FRONT_RIGHT) | _P (REAR_LEFT) | _P (REAR_RIGHT);
break;
case 6:
channel_mask =
_P (FRONT_LEFT) | _P (FRONT_LEFT_OF_CENTER) | _P (FRONT_CENTER) |
_P (FRONT_RIGHT) | _P (FRONT_RIGHT_OF_CENTER) | _P (LFE1);
break;
default:
GST_FIXME_OBJECT (aiff, "using fallback channel layout for %d channels",
aiff->channels);
channel_mask = gst_audio_channel_get_fallback_mask (aiff->channels);
break;
}
if (channel_mask != 0) {
gst_caps_set_simple (caps, "channel-mask", GST_TYPE_BITMASK, channel_mask,
NULL);
}
if (channel_mask != 0) {
gst_caps_set_simple (caps, "channel-mask", GST_TYPE_BITMASK, channel_mask,
NULL);
}
GST_DEBUG_OBJECT (aiff, "Created caps: %" GST_PTR_FORMAT, caps);
......