mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
* MP3: Fix bug for TS or HLS with mp3 codec. v4.0.269 (#296) 1. Refresh HLS audio codec if changed in stream. 2. Refresh TS audio codec if changed in stream. 3. Fix mp3 demux bug in SrsFormat::audio_mp3_demux. 4. Use 3(MPEG1) not 4(MPEG2) as PMT stream type, follow FFmpeg. 5. MP3: Update utest for mp3 sample parsing. 6. MP3: Ignore empty frame sample. 7. UTest: Fix utest failed, do not copy files.
This commit is contained in:
parent
2573a25101
commit
577cd299e1
10 changed files with 109 additions and 38 deletions
|
@ -3391,11 +3391,23 @@ VOID TEST(KernelCodecTest, AVFrame)
|
|||
EXPECT_TRUE(20 == f.samples[1].size);
|
||||
EXPECT_TRUE(2 == f.nb_samples);
|
||||
}
|
||||
|
||||
|
||||
if (true) {
|
||||
SrsAudioFrame f;
|
||||
EXPECT_TRUE(0 == f.nb_samples);
|
||||
|
||||
HELPER_EXPECT_SUCCESS(f.add_sample((char*)1, 0));
|
||||
EXPECT_TRUE(0 == f.nb_samples);
|
||||
|
||||
HELPER_EXPECT_SUCCESS(f.add_sample(NULL, 1));
|
||||
EXPECT_TRUE(0 == f.nb_samples);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsAudioFrame f;
|
||||
for (int i = 0; i < SrsMaxNbSamples; i++) {
|
||||
HELPER_EXPECT_SUCCESS(f.add_sample((char*)(int64_t)i, i*10));
|
||||
HELPER_EXPECT_SUCCESS(f.add_sample((char*)(int64_t)(i + 1), i*10 + 1));
|
||||
}
|
||||
|
||||
srs_error_t err = f.add_sample((char*)1, 1);
|
||||
|
@ -3502,18 +3514,39 @@ VOID TEST(KernelCodecTest, AudioFormat)
|
|||
HELPER_EXPECT_SUCCESS(f.on_audio(0, (char*)"\x00", 0));
|
||||
HELPER_EXPECT_SUCCESS(f.on_audio(0, (char*)"\x00", 1));
|
||||
}
|
||||
|
||||
|
||||
// For MP3
|
||||
if (true) {
|
||||
SrsFormat f;
|
||||
HELPER_EXPECT_SUCCESS(f.initialize());
|
||||
HELPER_EXPECT_SUCCESS(f.on_audio(0, (char*)"\x20", 1));
|
||||
EXPECT_TRUE(0 == f.nb_raw);
|
||||
EXPECT_TRUE(0 == f.audio->nb_samples);
|
||||
|
||||
HELPER_EXPECT_SUCCESS(f.on_audio(0, (char*)"\x20\x00", 2));
|
||||
EXPECT_TRUE(1 == f.nb_raw);
|
||||
EXPECT_TRUE(0 == f.audio->nb_samples);
|
||||
EXPECT_TRUE(1 == f.audio->nb_samples);
|
||||
|
||||
HELPER_EXPECT_SUCCESS(f.on_audio(0, (char*)"\x20\x00\x00", 3));
|
||||
EXPECT_TRUE(2 == f.nb_raw);
|
||||
EXPECT_TRUE(1 == f.audio->nb_samples);
|
||||
}
|
||||
|
||||
// For AAC
|
||||
if (true) {
|
||||
SrsFormat f;
|
||||
HELPER_EXPECT_SUCCESS(f.initialize());
|
||||
HELPER_EXPECT_FAILED(f.on_audio(0, (char*)"\xa0", 1));
|
||||
|
||||
HELPER_EXPECT_SUCCESS(f.on_audio(0, (char*)"\xaf\x00\x12\x10", 4));
|
||||
HELPER_EXPECT_SUCCESS(f.on_audio(0, (char*)"\xa0\x01", 2));
|
||||
EXPECT_TRUE(0 == f.nb_raw);
|
||||
EXPECT_TRUE(0 == f.audio->nb_samples);
|
||||
|
||||
HELPER_EXPECT_SUCCESS(f.on_audio(0, (char*)"\xa0\x01\x00", 3));
|
||||
EXPECT_TRUE(1 == f.nb_raw);
|
||||
EXPECT_TRUE(1 == f.audio->nb_samples);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsFormat f;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue