mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Improve test coverage for config.
This commit is contained in:
parent
36236192fa
commit
a71d93188b
4 changed files with 428 additions and 32 deletions
|
@ -80,36 +80,6 @@ const char* _srs_version = "XCORE-" RTMP_SIG_SRS_SERVER;
|
|||
*/
|
||||
srs_error_t srs_config_dumps_engine(SrsConfDirective* dir, SrsJsonObject* engine);
|
||||
|
||||
/**
|
||||
* whether the two vector actual equals, for instance,
|
||||
* srs_vector_actual_equals([0, 1, 2], [0, 1, 2]) ==== true
|
||||
* srs_vector_actual_equals([0, 1, 2], [2, 1, 0]) ==== true
|
||||
* srs_vector_actual_equals([0, 1, 2], [0, 2, 1]) ==== true
|
||||
* srs_vector_actual_equals([0, 1, 2], [0, 1, 2, 3]) ==== false
|
||||
* srs_vector_actual_equals([1, 2, 3], [0, 1, 2]) ==== false
|
||||
*/
|
||||
template<typename T>
|
||||
bool srs_vector_actual_equals(const vector<T>& a, const vector<T>& b)
|
||||
{
|
||||
// all elements of a in b.
|
||||
for (int i = 0; i < (int)a.size(); i++) {
|
||||
const T& e = a.at(i);
|
||||
if (::find(b.begin(), b.end(), e) == b.end()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// all elements of b in a.
|
||||
for (int i = 0; i < (int)b.size(); i++) {
|
||||
const T& e = b.at(i);
|
||||
if (::find(a.begin(), a.end(), e) == a.end()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* whether the ch is common space.
|
||||
*/
|
||||
|
@ -132,7 +102,8 @@ namespace _srs_internal
|
|||
{
|
||||
srs_freepa(start);
|
||||
}
|
||||
|
||||
|
||||
// LCOV_EXCL_START
|
||||
srs_error_t SrsConfigBuffer::fullfill(const char* filename)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
@ -160,6 +131,7 @@ namespace _srs_internal
|
|||
|
||||
return err;
|
||||
}
|
||||
// LCOV_EXCL_STOP
|
||||
|
||||
bool SrsConfigBuffer::empty()
|
||||
{
|
||||
|
@ -413,7 +385,7 @@ srs_error_t srs_config_transform_vhost(SrsConfDirective* root)
|
|||
if (enabled) {
|
||||
SrsConfDirective* mr = publish->get_or_create("mr");
|
||||
mr->args = enabled->args;
|
||||
srs_warn("transform: vhost.mr.enabled to vhost.publish.mr.enabled for %s", dir->name.c_str());
|
||||
srs_warn("transform: vhost.mr.enabled to vhost.publish.mr for %s", dir->name.c_str());
|
||||
}
|
||||
|
||||
SrsConfDirective* latency = conf->get("latency");
|
||||
|
@ -525,6 +497,7 @@ srs_error_t srs_config_transform_vhost(SrsConfDirective* root)
|
|||
return err;
|
||||
}
|
||||
|
||||
// LCOV_EXCL_START
|
||||
srs_error_t srs_config_dumps_engine(SrsConfDirective* dir, SrsJsonObject* engine)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
@ -626,6 +599,7 @@ srs_error_t srs_config_dumps_engine(SrsConfDirective* dir, SrsJsonObject* engine
|
|||
|
||||
return err;
|
||||
}
|
||||
// LCOV_EXCL_STOP
|
||||
|
||||
SrsConfDirective::SrsConfDirective()
|
||||
{
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <string>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
|
||||
#include <srs_app_reload.hpp>
|
||||
#include <srs_app_async_call.hpp>
|
||||
|
@ -46,6 +47,35 @@ class SrsRequest;
|
|||
class SrsJsonArray;
|
||||
class SrsConfDirective;
|
||||
|
||||
/**
|
||||
* whether the two vector actual equals, for instance,
|
||||
* srs_vector_actual_equals([0, 1, 2], [0, 1, 2]) ==== true
|
||||
* srs_vector_actual_equals([0, 1, 2], [2, 1, 0]) ==== true
|
||||
* srs_vector_actual_equals([0, 1, 2], [0, 2, 1]) ==== true
|
||||
* srs_vector_actual_equals([0, 1, 2], [0, 1, 2, 3]) ==== false
|
||||
* srs_vector_actual_equals([1, 2, 3], [0, 1, 2]) ==== false
|
||||
*/
|
||||
template<typename T>
|
||||
bool srs_vector_actual_equals(const std::vector<T>& a, const std::vector<T>& b)
|
||||
{
|
||||
// all elements of a in b.
|
||||
for (int i = 0; i < (int)a.size(); i++) {
|
||||
const T& e = a.at(i);
|
||||
if (std::find(b.begin(), b.end(), e) == b.end()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// all elements of b in a.
|
||||
for (int i = 0; i < (int)b.size(); i++) {
|
||||
const T& e = b.at(i);
|
||||
if (std::find(a.begin(), a.end(), e) == a.end()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace _srs_internal
|
||||
{
|
||||
|
|
|
@ -31,6 +31,7 @@ using namespace std;
|
|||
#include <srs_core_performance.hpp>
|
||||
#include <srs_kernel_utility.hpp>
|
||||
#include <srs_service_st.hpp>
|
||||
#include <srs_rtmp_stack.hpp>
|
||||
|
||||
MockSrsConfigBuffer::MockSrsConfigBuffer(string buf)
|
||||
{
|
||||
|
@ -1927,3 +1928,356 @@ VOID TEST(ConfigUnitTest, CheckDefaultValuesGlobal)
|
|||
}
|
||||
}
|
||||
|
||||
VOID TEST(ConfigUnitTest, VectorEquals)
|
||||
{
|
||||
if (true) {
|
||||
vector<uint8_t> a, b;
|
||||
a.push_back(0); a.push_back(1); a.push_back(2);
|
||||
b.push_back(0); b.push_back(1); b.push_back(2);
|
||||
EXPECT_TRUE(srs_vector_actual_equals(a, b));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
vector<uint8_t> a, b;
|
||||
a.push_back(0); a.push_back(1); a.push_back(2);
|
||||
b.push_back(2); b.push_back(1); b.push_back(0);
|
||||
EXPECT_TRUE(srs_vector_actual_equals(a, b));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
vector<uint8_t> a, b;
|
||||
a.push_back(0); a.push_back(1); a.push_back(2);
|
||||
b.push_back(0); b.push_back(2); b.push_back(1);
|
||||
EXPECT_TRUE(srs_vector_actual_equals(a, b));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
vector<uint8_t> a, b;
|
||||
a.push_back(0); a.push_back(1); a.push_back(2);
|
||||
b.push_back(0); b.push_back(1); b.push_back(2); b.push_back(3);
|
||||
EXPECT_FALSE(srs_vector_actual_equals(a, b));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
vector<uint8_t> a, b;
|
||||
a.push_back(1); a.push_back(2); a.push_back(3);
|
||||
b.push_back(0); b.push_back(1); b.push_back(2);
|
||||
EXPECT_FALSE(srs_vector_actual_equals(a, b));
|
||||
}
|
||||
}
|
||||
|
||||
extern bool srs_directive_equals_self(SrsConfDirective* a, SrsConfDirective* b);
|
||||
extern bool srs_directive_equals(SrsConfDirective* a, SrsConfDirective* b);
|
||||
extern bool srs_directive_equals(SrsConfDirective* a, SrsConfDirective* b, string except);
|
||||
|
||||
VOID TEST(ConfigUnitTest, DirectiveEquals)
|
||||
{
|
||||
EXPECT_TRUE(srs_directive_equals_self(NULL, NULL));
|
||||
|
||||
if (true) {
|
||||
SrsConfDirective* a = new SrsConfDirective();
|
||||
EXPECT_FALSE(srs_directive_equals_self(a, NULL));
|
||||
EXPECT_FALSE(srs_directive_equals_self(NULL, a));
|
||||
srs_freep(a);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsConfDirective* a = new SrsConfDirective();
|
||||
SrsConfDirective* b = a;
|
||||
EXPECT_TRUE(srs_directive_equals_self(a, b));
|
||||
srs_freep(a);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsConfDirective* a = new SrsConfDirective();
|
||||
a->name = "hls";
|
||||
SrsConfDirective* b = new SrsConfDirective();
|
||||
b->name = "dvr";
|
||||
EXPECT_FALSE(srs_directive_equals_self(a, b));
|
||||
srs_freep(a); srs_freep(b);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsConfDirective* a = new SrsConfDirective();
|
||||
a->directives.push_back(new SrsConfDirective());
|
||||
SrsConfDirective* b = new SrsConfDirective();
|
||||
EXPECT_FALSE(srs_directive_equals_self(a, b));
|
||||
srs_freep(a); srs_freep(b);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsConfDirective* a = new SrsConfDirective();
|
||||
a->directives.push_back(new SrsConfDirective());
|
||||
a->at(0)->name = "hls";
|
||||
SrsConfDirective* b = new SrsConfDirective();
|
||||
b->directives.push_back(new SrsConfDirective());
|
||||
EXPECT_TRUE(srs_directive_equals(a, b, "hls"));
|
||||
srs_freep(a); srs_freep(b);
|
||||
}
|
||||
}
|
||||
|
||||
VOID TEST(ConfigUnitTest, OperatorEquals)
|
||||
{
|
||||
EXPECT_TRUE(srs_config_hls_is_on_error_ignore("ignore"));
|
||||
EXPECT_FALSE(srs_config_hls_is_on_error_ignore("xxx"));
|
||||
|
||||
EXPECT_TRUE(srs_config_hls_is_on_error_continue("continue"));
|
||||
EXPECT_FALSE(srs_config_hls_is_on_error_continue("xxx"));
|
||||
|
||||
EXPECT_TRUE(srs_config_ingest_is_file("file"));
|
||||
EXPECT_FALSE(srs_config_ingest_is_file("xxx"));
|
||||
|
||||
EXPECT_TRUE(srs_config_ingest_is_stream("stream"));
|
||||
EXPECT_FALSE(srs_config_ingest_is_stream("xxx"));
|
||||
|
||||
EXPECT_TRUE(srs_config_dvr_is_plan_segment("segment"));
|
||||
EXPECT_FALSE(srs_config_dvr_is_plan_segment("xxx"));
|
||||
|
||||
EXPECT_TRUE(srs_config_dvr_is_plan_session("session"));
|
||||
EXPECT_FALSE(srs_config_dvr_is_plan_session("xxx"));
|
||||
|
||||
EXPECT_TRUE(srs_stream_caster_is_udp("mpegts_over_udp"));
|
||||
EXPECT_FALSE(srs_stream_caster_is_udp("xxx"));
|
||||
|
||||
EXPECT_TRUE(srs_stream_caster_is_rtsp("rtsp"));
|
||||
EXPECT_FALSE(srs_stream_caster_is_rtsp("xxx"));
|
||||
|
||||
EXPECT_TRUE(srs_stream_caster_is_flv("flv"));
|
||||
EXPECT_FALSE(srs_stream_caster_is_flv("xxx"));
|
||||
|
||||
EXPECT_STREQ("on", srs_config_bool2switch("true").c_str());
|
||||
EXPECT_STREQ("off", srs_config_bool2switch("false").c_str());
|
||||
EXPECT_STREQ("off", srs_config_bool2switch("xxx").c_str());
|
||||
}
|
||||
|
||||
VOID TEST(ConfigUnitTest, ApplyFilter)
|
||||
{
|
||||
EXPECT_TRUE(srs_config_apply_filter(NULL, NULL));
|
||||
|
||||
if (true) {
|
||||
SrsConfDirective d;
|
||||
EXPECT_TRUE(srs_config_apply_filter(&d, NULL));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsConfDirective d;
|
||||
d.args.push_back("all");
|
||||
EXPECT_TRUE(srs_config_apply_filter(&d, NULL));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsConfDirective d;
|
||||
SrsRequest r;
|
||||
r.app = "live"; r.stream = "stream";
|
||||
d.args.push_back("live/stream");
|
||||
EXPECT_TRUE(srs_config_apply_filter(&d, &r));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsConfDirective d;
|
||||
d.args.push_back("live/stream");
|
||||
SrsRequest r;
|
||||
EXPECT_FALSE(srs_config_apply_filter(&d, &r));
|
||||
}
|
||||
}
|
||||
|
||||
VOID TEST(ConfigUnitTest, TransformForVhost)
|
||||
{
|
||||
srs_error_t err;
|
||||
|
||||
if (true) {
|
||||
SrsConfDirective root;
|
||||
root.get_or_create("http_stream");
|
||||
|
||||
HELPER_ASSERT_SUCCESS(srs_config_transform_vhost(&root));
|
||||
|
||||
SrsConfDirective* p = root.get("http_server");
|
||||
ASSERT_TRUE(p != NULL);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsConfDirective root;
|
||||
SrsConfDirective* vhost = root.get_or_create("vhost");
|
||||
if (true) {
|
||||
vhost->get_or_create("http");
|
||||
}
|
||||
|
||||
HELPER_ASSERT_SUCCESS(srs_config_transform_vhost(&root));
|
||||
|
||||
SrsConfDirective* p = vhost->get("http_static");
|
||||
ASSERT_TRUE(p != NULL);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsConfDirective root;
|
||||
SrsConfDirective* vhost = root.get_or_create("vhost");
|
||||
if (true) {
|
||||
SrsConfDirective* p = vhost->get_or_create("http_remux");
|
||||
p->get_or_create("hstrs", "on");
|
||||
}
|
||||
|
||||
HELPER_ASSERT_SUCCESS(srs_config_transform_vhost(&root));
|
||||
|
||||
SrsConfDirective* p = vhost->get("http_remux");
|
||||
ASSERT_TRUE(p != NULL);
|
||||
ASSERT_TRUE(p->get("hstrs") == NULL);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsConfDirective root;
|
||||
SrsConfDirective* vhost = root.get_or_create("vhost");
|
||||
if (true) {
|
||||
vhost->get_or_create("refer", "refer-v");
|
||||
vhost->get_or_create("refer_play", "refer-play-v");
|
||||
vhost->get_or_create("refer_publish", "refer-publish-v");
|
||||
}
|
||||
|
||||
HELPER_ASSERT_SUCCESS(srs_config_transform_vhost(&root));
|
||||
|
||||
SrsConfDirective* p = vhost->get("refer");
|
||||
ASSERT_TRUE(p != NULL);
|
||||
|
||||
ASSERT_TRUE(p->get("enabled") != NULL);
|
||||
EXPECT_STREQ("on", p->get("enabled")->arg0().c_str());
|
||||
|
||||
ASSERT_TRUE(p->get("all") != NULL);
|
||||
EXPECT_STREQ("refer-v", p->get("all")->arg0().c_str());
|
||||
|
||||
ASSERT_TRUE(p->get("play") != NULL);
|
||||
EXPECT_STREQ("refer-play-v", p->get("play")->arg0().c_str());
|
||||
|
||||
ASSERT_TRUE(p->get("publish") != NULL);
|
||||
EXPECT_STREQ("refer-publish-v", p->get("publish")->arg0().c_str());
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsConfDirective root;
|
||||
SrsConfDirective* vhost = root.get_or_create("vhost");
|
||||
if (true) {
|
||||
SrsConfDirective* mr = vhost->get_or_create("mr");
|
||||
mr->get_or_create("enabled", "on");
|
||||
mr->get_or_create("latency", "100");
|
||||
}
|
||||
|
||||
HELPER_ASSERT_SUCCESS(srs_config_transform_vhost(&root));
|
||||
|
||||
SrsConfDirective* publish = vhost->get("publish");
|
||||
ASSERT_TRUE(publish != NULL);
|
||||
|
||||
SrsConfDirective* p = publish->get("mr");
|
||||
ASSERT_TRUE(p != NULL);
|
||||
EXPECT_STREQ("on", p->arg0().c_str());
|
||||
|
||||
p = publish->get("mr_latency");
|
||||
ASSERT_TRUE(p != NULL);
|
||||
EXPECT_STREQ("100", p->arg0().c_str());
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsConfDirective root;
|
||||
SrsConfDirective* vhost = root.get_or_create("vhost");
|
||||
if (true) {
|
||||
vhost->get_or_create("publish_1stpkt_timeout", "100");
|
||||
}
|
||||
|
||||
HELPER_ASSERT_SUCCESS(srs_config_transform_vhost(&root));
|
||||
|
||||
SrsConfDirective* publish = vhost->get("publish");
|
||||
ASSERT_TRUE(publish != NULL);
|
||||
|
||||
SrsConfDirective* p = publish->get("firstpkt_timeout");
|
||||
ASSERT_TRUE(p != NULL);
|
||||
EXPECT_STREQ("100", p->arg0().c_str());
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsConfDirective root;
|
||||
SrsConfDirective* vhost = root.get_or_create("vhost");
|
||||
if (true) {
|
||||
vhost->get_or_create("publish_normal_timeout", "100");
|
||||
}
|
||||
|
||||
HELPER_ASSERT_SUCCESS(srs_config_transform_vhost(&root));
|
||||
|
||||
SrsConfDirective* publish = vhost->get("publish");
|
||||
ASSERT_TRUE(publish != NULL);
|
||||
|
||||
SrsConfDirective* p = publish->get("normal_timeout");
|
||||
ASSERT_TRUE(p != NULL);
|
||||
EXPECT_STREQ("100", p->arg0().c_str());
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsConfDirective root;
|
||||
SrsConfDirective* vhost = root.get_or_create("vhost");
|
||||
if (true) {
|
||||
vhost->get_or_create("time_jitter", "on");
|
||||
vhost->get_or_create("mix_correct", "on");
|
||||
vhost->get_or_create("atc", "on");
|
||||
vhost->get_or_create("atc_auto", "on");
|
||||
vhost->get_or_create("mw_latency", "on");
|
||||
vhost->get_or_create("gop_cache", "on");
|
||||
vhost->get_or_create("queue_length", "on");
|
||||
vhost->get_or_create("send_min_interval", "on");
|
||||
vhost->get_or_create("reduce_sequence_header", "on");
|
||||
}
|
||||
|
||||
HELPER_ASSERT_SUCCESS(srs_config_transform_vhost(&root));
|
||||
|
||||
SrsConfDirective* p = vhost->get("play");
|
||||
ASSERT_TRUE(p != NULL);
|
||||
|
||||
ASSERT_TRUE(p->get("time_jitter") != NULL);
|
||||
ASSERT_TRUE(p->get("mix_correct") != NULL);
|
||||
ASSERT_TRUE(p->get("atc") != NULL);
|
||||
ASSERT_TRUE(p->get("atc_auto") != NULL);
|
||||
ASSERT_TRUE(p->get("mw_latency") != NULL);
|
||||
ASSERT_TRUE(p->get("gop_cache") != NULL);
|
||||
ASSERT_TRUE(p->get("queue_length") != NULL);
|
||||
ASSERT_TRUE(p->get("send_min_interval") != NULL);
|
||||
ASSERT_TRUE(p->get("reduce_sequence_header") != NULL);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsConfDirective root;
|
||||
SrsConfDirective* vhost = root.get_or_create("vhost");
|
||||
if (true) {
|
||||
vhost->get_or_create("forward", "forward-v");
|
||||
}
|
||||
|
||||
HELPER_ASSERT_SUCCESS(srs_config_transform_vhost(&root));
|
||||
|
||||
SrsConfDirective* p = vhost->get("forward");
|
||||
ASSERT_TRUE(p != NULL);
|
||||
|
||||
ASSERT_TRUE(p->get("enabled") != NULL);
|
||||
EXPECT_STREQ("on", p->get("enabled")->arg0().c_str());
|
||||
|
||||
ASSERT_TRUE(p->get("destination") != NULL);
|
||||
EXPECT_STREQ("forward-v", p->get("destination")->arg0().c_str());
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsConfDirective root;
|
||||
SrsConfDirective* vhost = root.get_or_create("vhost");
|
||||
if (true) {
|
||||
vhost->get_or_create("mode", "on");
|
||||
vhost->get_or_create("origin", "on");
|
||||
vhost->get_or_create("token_traverse", "on");
|
||||
vhost->get_or_create("vhost", "on");
|
||||
vhost->get_or_create("debug_srs_upnode", "on");
|
||||
}
|
||||
|
||||
HELPER_ASSERT_SUCCESS(srs_config_transform_vhost(&root));
|
||||
|
||||
SrsConfDirective* p = vhost->get("cluster");
|
||||
ASSERT_TRUE(p != NULL);
|
||||
|
||||
ASSERT_TRUE(p->get("mode") != NULL);
|
||||
ASSERT_TRUE(p->get("origin") != NULL);
|
||||
ASSERT_TRUE(p->get("token_traverse") != NULL);
|
||||
ASSERT_TRUE(p->get("vhost") != NULL);
|
||||
ASSERT_TRUE(p->get("debug_srs_upnode") != NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5093,6 +5093,44 @@ VOID TEST(KernelMP4Test, CoverMP4MultipleAVs)
|
|||
}
|
||||
}
|
||||
|
||||
VOID TEST(KernelMP4Test, CoverMP4CodecErrorNoFrames)
|
||||
{
|
||||
srs_error_t err;
|
||||
|
||||
MockSrsFileWriter f;
|
||||
|
||||
// MP4 encoder.
|
||||
if (true) {
|
||||
SrsMp4Encoder enc; SrsFormat fmt;
|
||||
HELPER_EXPECT_SUCCESS(enc.initialize(&f));
|
||||
HELPER_EXPECT_SUCCESS(fmt.initialize());
|
||||
|
||||
if (true) {
|
||||
uint8_t raw[] = {
|
||||
0x17, 0x00, 0x00, 0x00, 0x00, 0x01, 0x64, 0x00, 0x20, 0xff, 0xe1, 0x00, 0x19, 0x67, 0x64, 0x00, 0x20, 0xac, 0xd9, 0x40, 0xc0, 0x29, 0xb0, 0x11, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x03, 0x00, 0x32, 0x0f, 0x18, 0x31, 0x96, 0x01, 0x00, 0x05, 0x68, 0xeb, 0xec, 0xb2, 0x2c
|
||||
};
|
||||
HELPER_EXPECT_SUCCESS(fmt.on_video(0, (char*)raw, sizeof(raw)));
|
||||
HELPER_EXPECT_SUCCESS(enc.write_sample(
|
||||
&fmt, SrsMp4HandlerTypeVIDE, fmt.video->frame_type, fmt.video->avc_packet_type, 0, 0, (uint8_t*)fmt.raw, fmt.nb_raw
|
||||
));
|
||||
EXPECT_EQ(768, enc.width); EXPECT_EQ(320, enc.height);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
uint8_t raw[] = {
|
||||
0xaf, 0x00, 0x12, 0x10
|
||||
};
|
||||
HELPER_EXPECT_SUCCESS(fmt.on_audio(0, (char*)raw, sizeof(raw)));
|
||||
HELPER_EXPECT_SUCCESS(enc.write_sample(
|
||||
&fmt, SrsMp4HandlerTypeSOUN, 0x00, fmt.audio->aac_packet_type, 0, 0, (uint8_t*)fmt.raw, fmt.nb_raw
|
||||
));
|
||||
}
|
||||
|
||||
HELPER_ASSERT_FAILED(enc.flush());
|
||||
//mock_print_mp4(string(f.data(), f.filesize()));
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t* mock_copy_bytes(char* data, int size)
|
||||
{
|
||||
uint8_t* cp = new uint8_t[size];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue