@ -9,6 +9,7 @@
# include <srs_kernel_buffer.hpp>
# include <srs_kernel_error.hpp>
# include <srs_core_autofree.hpp>
# include <srs_kernel_utility.hpp>
VOID TEST ( SrsAVCTest , H264ParseAnnexb )
{
@ -599,3 +600,91 @@ VOID TEST(SrsAVCTest, AACMuxToFLV)
}
}
# ifdef SRS_H265
VOID TEST ( SrsAVCTest , HevcMultiPPS )
{
srs_error_t err ;
vector < uint8_t > vps = {
0x40 , 0x01 , 0x0c , 0x06 , 0x3f , 0x3f , 0x22 , 0x20 , 0x00 , 0x00 , 0x03 , 0x00 , 0x3f ,
0x00 , 0x00 , 0x03 , 0x00 , 0x00 , 0x03 , 0x00 , 0x3f , 0x00 , 0x00 , 0x18 , 0x3f , 0x24 ,
} ;
vector < uint8_t > sps = {
0x42 , 0x01 , 0x06 , 0x22 , 0x20 , 0x00 , 0x00 , 0x03 , 0x00 , 0x3f , 0x00 , 0x00 , 0x03 , 0x00 , 0x00 , 0x03 , 0x00 ,
0x3f , 0x00 , 0x00 , 0x3f , 0x01 , 0x3f , 0x20 , 0x02 , 0x1c , 0x4d , 0x3f , 0x3f , 0x3f , 0x42 , 0x3f , 0x53 , 0x3f ,
0x3f , 0x01 , 0x01 , 0x01 , 0x04 , 0x00 , 0x00 , 0x0f , 0x3f , 0x00 , 0x01 , 0x3f , 0x3f , 0x3f , 0x68 , 0x3f , 0x3f ,
0x00 , 0x1f , 0x3a , 0x00 , 0x0f , 0x3f , 0x04 , 0x00 , 0x3e , 0x74 , 0x00 , 0x1f , 0x3a , 0x08 , 0x00 , 0x7c , 0x3f ,
0x00 , 0x3e , 0x74 , 0x10 , 0x00 , 0x3f , 0x3f , 0x00 , 0x7c , 0x3f , 0x5c , 0x20 , 0x10 , 0x40
} ;
vector < uint8_t > pps_1 = {
0x44 , 0x01 , 0x74 , 0x18 , 0xc2 , 0xb8 , 0x33 , 0x3f , 0x7d , 0x75 , 0x3f , 0x42 , 0x28 , 0x3f , 0x6b , 0x3f , 0x3f ,
0x11 , 0x47 , 0x7d , 0x72 , 0x79 , 0x3e , 0x4f , 0x3f , 0x3f , 0x51 , 0x3f , 0x3f , 0x20 , 0x3f , 0x3f , 0x3f , 0x10 ,
0x63 , 0x3f , 0x0a , 0x0e , 0x3f , 0x04 , 0x42 , 0x3f , 0x3f , 0x3f , 0x34 , 0x22 , 0x3f , 0x3f , 0x3f , 0x3f , 0x7d ,
0x7e , 0x4f , 0x3f , 0x3f , 0x7c , 0x57 , 0x3f , 0x3f , 0x3f , 0x10 , 0x41 , 0x21 , 0x14 , 0x41 , 0x3f , 0x3f , 0x3c ,
0x3f , 0x5f , 0x3f , 0x3f , 0x28 , 0x3f , 0x73 , 0x10 , 0x44 , 0x49 , 0x47 , 0x08 , 0x31 , 0xc4 , 0x85 , 0x06 , 0x46 ,
0x3f , 0x21 , 0x02 , 0x41 , 0x54 , 0x1a , 0x11 , 0x45 , 0x13 , 0x3f , 0x3f , 0x3f , 0x3f , 0x3f , 0x3f , 0x3f , 0x11 ,
0x3f , 0x5e , 0x3b , 0x3f , 0x30 , 0x41 , 0x04 , 0x3f , 0x51 , 0x06 , 0x3f , 0x3f , 0x3f , 0x7d , 0x7e , 0x4f , 0x3f ,
0x3f , 0x1d , 0x3f , 0x41 , 0x11 , 0x25 , 0x1c , 0x20 , 0x3f , 0x12 , 0x14 , 0x19 , 0x1a , 0x08 , 0x3f , 0x09 , 0x05 ,
0x50 , 0x69 , 0x14 , 0x4f , 0x3f , 0x4f , 0x27 , 0x3f , 0x3f , 0x3f , 0x28 , 0x3f , 0x73 , 0x10 , 0xd3 , 0x94 , 0x71 ,
0x3f , 0x73 , 0x3f , 0x05 , 0x45 , 0x3f , 0x01 , 0x02 , 0x41 , 0x54 , 0x18 , 0x24
} ;
vector < uint8_t > pps_2 = {
0x44 , 0x01 , 0x25 , 0x06 , 0x30 , 0x3f , 0x0c , 0x3f , 0x4a , 0x3f , 0x3f , 0x49 , 0x08 , 0x3f , 0x15 , 0x6b , 0x3f ,
0x3f , 0x11 , 0x4c , 0x3f , 0x3f , 0x3f , 0x3f , 0x3f , 0x3f , 0x3f , 0x3f , 0x46 , 0x3b , 0x3f , 0x3f , 0x22 , 0x4a ,
0x30 , 0x51 , 0x3f , 0x2c , 0x2c , 0x32 , 0x34 , 0x11 , 0x08 , 0x12 , 0x0a , 0x3f , 0xd0 , 0x8a , 0x29 , 0x56 , 0x3f ,
0x3c , 0x3f , 0x5f , 0x3f , 0x3f , 0x3f , 0x1f , 0x15 , 0x3f , 0x3f , 0x63 , 0x04 , 0x10 , 0x4c , 0x45 , 0x35 , 0x49 ,
0x3f , 0x3f , 0x3f , 0x3f , 0x3f , 0x3f , 0x3f , 0x3f , 0x77 , 0x31 , 0x04 , 0x44 , 0x3f , 0x60 , 0x3f , 0x1c , 0x58 ,
0x58 , 0x64 , 0x68 , 0x22 , 0x10 , 0x24 , 0x15 , 0x41 , 0x3f , 0x14 , 0x42 , 0x55 , 0x3f , 0x4f , 0x27 , 0x3f , 0x3f ,
0x3f , 0x3f , 0x47 , 0x3f , 0x78 , 0x3f , 0x18 , 0x3f , 0x04 , 0x13 , 0x11 , 0x4d , 0x52 , 0x64 , 0x3f , 0x3f , 0x3f ,
0x7e , 0x4f , 0x3f , 0x3f , 0x1d , 0x3f , 0x41 , 0x11 , 0x25 , 0x18 , 0x28 , 0x3f , 0x16 , 0x16 , 0x19 , 0x1a , 0x08 ,
0x3f , 0x09 , 0x05 , 0x50 , 0x69 , 0x10 , 0x3f , 0x6b , 0x3f , 0x3f , 0x3f , 0x3f , 0x3f , 0x3f , 0x11 , 0x3f , 0x5e ,
0x3b , 0x3f , 0x30 , 0x41 , 0x04 , 0x3f
} ;
vector < uint8_t > start_code = { 0x00 , 0x00 , 0x00 , 0x01 } ;
string hevc_sh ;
hevc_sh . append ( ( const char * ) start_code . data ( ) , start_code . size ( ) ) ;
hevc_sh . append ( ( const char * ) vps . data ( ) , vps . size ( ) ) ;
hevc_sh . append ( ( const char * ) start_code . data ( ) , start_code . size ( ) ) ;
hevc_sh . append ( ( const char * ) sps . data ( ) , sps . size ( ) ) ;
hevc_sh . append ( ( const char * ) start_code . data ( ) , start_code . size ( ) ) ;
hevc_sh . append ( ( const char * ) pps_1 . data ( ) , pps_1 . size ( ) ) ;
hevc_sh . append ( ( const char * ) start_code . data ( ) , start_code . size ( ) ) ;
hevc_sh . append ( ( const char * ) pps_2 . data ( ) , pps_2 . size ( ) ) ;
SrsBuffer stream ( ( char * ) hevc_sh . data ( ) , hevc_sh . size ( ) ) ;
SrsRawHEVCStream hs ;
char * frame = NULL ;
int frame_size = 0 ;
HELPER_ASSERT_SUCCESS ( hs . annexb_demux ( & stream , & frame , & frame_size ) ) ;
EXPECT_TRUE ( hs . is_vps ( frame , frame_size ) ) ;
EXPECT_EQ ( frame_size , vps . size ( ) ) ;
EXPECT_TRUE ( srs_bytes_equals ( frame , vps . data ( ) , frame_size ) ) ;
HELPER_ASSERT_SUCCESS ( hs . annexb_demux ( & stream , & frame , & frame_size ) ) ;
EXPECT_TRUE ( hs . is_sps ( frame , frame_size ) ) ;
EXPECT_EQ ( frame_size , sps . size ( ) ) ;
EXPECT_TRUE ( srs_bytes_equals ( frame , sps . data ( ) , frame_size ) ) ;
HELPER_ASSERT_SUCCESS ( hs . annexb_demux ( & stream , & frame , & frame_size ) ) ;
EXPECT_TRUE ( hs . is_pps ( frame , frame_size ) ) ;
EXPECT_EQ ( frame_size , pps_1 . size ( ) ) ;
EXPECT_TRUE ( srs_bytes_equals ( frame , pps_1 . data ( ) , frame_size ) ) ;
HELPER_ASSERT_SUCCESS ( hs . annexb_demux ( & stream , & frame , & frame_size ) ) ;
EXPECT_TRUE ( hs . is_pps ( frame , frame_size ) ) ;
EXPECT_EQ ( frame_size , pps_2 . size ( ) ) ;
EXPECT_TRUE ( srs_bytes_equals ( frame , pps_2 . data ( ) , frame_size ) ) ;
EXPECT_TRUE ( stream . empty ( ) ) ;
}
# endif