[vlc-commits] [Git][videolan/vlc][master] 2 commits: mediacodec: don't add a start code to VC-1 blocks that have one

Steve Lhomme (@robUx4) gitlab at videolan.org
Sun Oct 25 06:08:29 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
0d52a4ee by Pierre Bogdanovscky at 2026-10-25T05:36:38+00:00
mediacodec: don't add a start code to VC-1 blocks that have one

The VC-1 packetizer already emits frames with their start code,
preceded by the sequence header and entry point on keyframes.
Prepending another one corrupted the bitstream: a hardware decoder
would fail or show a green picture for non-keyframes.

Work item : #30204

- - - - -
5bb1b719 by Pierre Bogdanovscky at 2026-10-25T05:36:38+00:00
mediacodec: don't compare profiles for VC-1

Android defines no VC-1 profiles, so since a6afe160 every VC-1 decoder was
rejected and VC-1 always fell back to software decoding.

- - - - -


1 changed file:

- modules/codec/omxil/mediacodec.c


Changes:

=====================================
modules/codec/omxil/mediacodec.c
=====================================
@@ -1200,7 +1200,11 @@ static int OpenDecoder(vlc_object_t *p_this, pf_MediaCodecApi_init pf_init)
             mime = "video/mpeg2";
             break;
         case VLC_CODEC_WMV3: mime = "video/x-ms-wmv"; break;
-        case VLC_CODEC_VC1:  mime = "video/wvc1"; break;
+        case VLC_CODEC_VC1:
+            /* Android has no VC-1 profiles */
+            i_profile = -1;
+            mime = "video/wvc1";
+            break;
         case VLC_CODEC_VP8:
             if (es_format_HasVpxAlpha(p_dec->fmt_in)) // contains alpha extradata
                 return VLC_ENOTSUP;
@@ -2311,7 +2315,12 @@ static int VideoVC1_OnNewBlock(decoder_t *p_dec, block_t **pp_block)
 {
     block_t *p_block = *pp_block;
 
-    /* Adding frame start code */
+    /* Adding frame start code, unless the block already begins with one. */
+    static const uint8_t vc1_start_code_prefix[3] = {0x00, 0x00, 0x01};
+    if (p_block->i_buffer >= 4
+     && !memcmp(p_block->p_buffer, vc1_start_code_prefix, 3))
+        return Video_OnNewBlock(p_dec, pp_block);
+
     p_block = *pp_block = block_Realloc(p_block, 4, p_block->i_buffer);
     if (p_block == NULL)
         return VLC_ENOMEM;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d460ecd30f7eb4e2d866754a18f4c2eb3ded9aa3...5bb1b719ac540abb15a44c8016d7f13149a3f320

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d460ecd30f7eb4e2d866754a18f4c2eb3ded9aa3...5bb1b719ac540abb15a44c8016d7f13149a3f320
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list