[vlc-devel] [PATCH 1/1] mediacodec: handle hevc without a valid video size
Francois Cartegnie
fcvlcdev at free.fr
Mon May 30 11:56:19 CEST 2016
Le 30/05/2016 à 10:44, kaspter at ucheer.org a écrit :
> + decoder_sys_t *p_sys = p_dec->p_sys;
> + uint8_t *p_sps_buf = NULL, *p_pps_buf = NULL;
> + size_t i_sps_size = 0, i_pps_size = 0;
> +
> + /* Get NALU type */
> + uint8_t i_nal_type = hevc_getNALType(&p_buf[4]);
> +
> + if (i_nal_type == HEVC_NAL_SPS) {
> +
> + uint8_t i_id;
> + if (hevc_get_xps_id(p_buf, i_size, &i_id)) {/* also checks id range */
> +
> + if (hxxx_strip_AnnexB_startcode( &p_buf, &i_size) ) {
> + /* Create decoded entries */
> + if(i_nal_type == HEVC_NAL_SPS) {
> +
> + hevc_sequence_parameter_set_t *p_sps;
> + p_sps = hevc_decode_sps(p_buf, i_size, true);
> + if(!p_sps) {
> + msg_Err(p_dec, "Failed decoding SPS id %d", i_id);
> + return VLC_EGENERIC;
> + }
> +
> + unsigned vsize[4];
> + (void) hevc_get_picture_size( p_sps, &vsize[0], &vsize[1], &vsize[2], &vsize[3] );
> +
> + if (p_size_changed)
> + *p_size_changed = (vsize[0] != p_sys->u.video.i_width
> + || vsize[1] != p_sys->u.video.i_height);
> +
> + p_sys->u.video.i_width = vsize[0];
> + p_sys->u.video.i_height = vsize[1];
> +
> + hevc_rbsp_release_sps( p_sps );
> +
> + return VLC_SUCCESS;
> + }
> + }
> + }
> + }
Obviously untested, broken, and non working copy/paste from the H264 one.
> + } else if (HEVCSizeChanged(p_dec, p_block->p_buffer, p_block->i_buffer,
> + &b_size_changed) == VLC_SUCCESS) {
> +
> + if (b_size_changed)
> + {
> + msg_Dbg(p_dec, "Video size changed, new (%ux%u)",
> + p_sys->u.video.i_width,
> + p_sys->u.video.i_height);
> + *p_flags |= NEWBLOCK_FLAG_RESTART;
> + }
And useless function return status.
Francois
More information about the vlc-devel
mailing list