MCPcopy Create free account
hub / github.com/cisco/openh264 / DecodeCrashTestAPI

Class DecodeCrashTestAPI

test/api/decode_api_test.cpp:545–577  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

543
544
545class DecodeCrashTestAPI : public ::testing::TestWithParam<EncodeDecodeFileParamBase>, public EncodeDecodeTestBase {
546 public:
547 void SetUp() {
548 EncodeDecodeTestBase::SetUp();
549 ucBuf_ = NULL;
550 ucBuf_ = new unsigned char [1000000];
551 ASSERT_TRUE (ucBuf_ != NULL);
552 }
553
554 void TearDown() {
555 EncodeDecodeTestBase::TearDown();
556 if (NULL != ucBuf_) {
557 delete[] ucBuf_;
558 ucBuf_ = NULL;
559 }
560 ASSERT_TRUE (ucBuf_ == NULL);
561 }
562
563 void prepareParam (int iLayerNum, int iSliceNum, int width, int height, float framerate, SEncParamExt* pParam) {
564 memset (pParam, 0, sizeof (SEncParamExt));
565 EncodeDecodeTestBase::prepareParam (iLayerNum, iSliceNum, width, height, framerate, pParam);
566 }
567
568 void EncodeOneFrame() {
569 int frameSize = EncPic.iPicWidth * EncPic.iPicHeight * 3 / 2;
570 memset (buf_.data(), iRandValue, (frameSize >> 2));
571 memset (buf_.data() + (frameSize >> 2), rand() % 256, (frameSize - (frameSize >> 2)));
572 int rv = encoder_->EncodeFrame (&EncPic, &info);
573 ASSERT_TRUE (rv == cmResultSuccess || rv == cmUnknownReason);
574 }
575 protected:
576 unsigned char* ucBuf_;
577};
578
579struct EncodeDecodeParamBase {
580 int width;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected