dholroyd / h264-reader

Rust reader for H264 bitsream syntax
Apache License 2.0
73 stars 25 forks source link

Parse SeqParameterSet fail with RbspReaderError(RemainingData) #53

Closed simon-fu closed 1 year ago

simon-fu commented 1 year ago

The SPS data is extract from a real h264 file.

    #[test]
    fn test_parse_sps() {

        let raw_sps = vec![
            // 0x67_u8, 
            0x64, 0x00, 0x1e, 0xac, 0xd9, 0x40, 0xa0, 0x2f, 
            0xf9, 0x70, 0x11, 0x00, 0x00, 0x03, 0x00, 0x01,
            0x00, 0x00, 0x03, 0x00, 0x32, 0x0f, 0x16, 0x2d, 
            0x96,
        ];

        let breader: rbsp::BitReader<&[u8]> = rbsp::BitReader::new(&raw_sps[..]);
        SeqParameterSet::from_bits(breader).unwrap();
    }
simon-fu commented 1 year ago
fn test_parse_sps() {
        use h264_reader::nal::sps::SeqParameterSet;
        let raw_sps = vec![
            0x67_u8, 
            0x64, 0x00, 0x1e, 0xac, 0xd9, 0x40, 0xa0, 0x2f, 
            0xf9, 0x70, 0x11, 0x00, 0x00, 0x03, 0x00, 0x01,
            0x00, 0x00, 0x03, 0x00, 0x32, 0x0f, 0x16, 0x2d, 
            0x96,
        ];

        let sps = RefNal::new(&raw_sps[..], &[], true);

        SeqParameterSet::from_bits(sps.rbsp_bits()).unwrap();
    }