Skip to content

Commit

Permalink
For #307, #1070, define FLV CodecID for AV1 and Opus. 3.0.101
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Jan 19, 2020
1 parent bdd0b1f commit 3900179
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 4 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ For previous versions, please read:

## V3 changes

* v3.0, 2020-01-19, For [#1070][bug #1070], define FLV CodecID for [AV1][bug #1070] and [opus][bug #307]. 3.0.101
* v3.0, 2020-01-16, For [#1575][bug #1575], correct RTMP redirect as tcUrl, add redirect2 as RTMP URL. 3.0.100
* v3.0, 2020-01-15, For [#1509][bug #1509], decrease the fast vector init size from 64KB to 64B. 3.0.99
* v3.0, 2020-01-15, For [#1509][bug #1509], release coroutine when source is idle. 3.0.98
Expand Down Expand Up @@ -1597,6 +1598,8 @@ Winlin
[bug #1543]: https://github.com/ossrs/srs/issues/1543
[bug #1509]: https://github.com/ossrs/srs/issues/1509
[bug #1575]: https://github.com/ossrs/srs/issues/1575
[bug #307]: https://github.com/ossrs/srs/issues/307
[bug #1070]: https://github.com/ossrs/srs/issues/1070
[bug #xxxxxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxxxxx

[exo #828]: https://github.com/google/ExoPlayer/pull/828
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
// The version config.
#define VERSION_MAJOR 3
#define VERSION_MINOR 0
#define VERSION_REVISION 100
#define VERSION_REVISION 101

// The macros generated by configure script.
#include <srs_auto_headers.hpp>
Expand Down
7 changes: 6 additions & 1 deletion trunk/src/kernel/srs_kernel_codec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ string srs_video_codec_id2str(SrsVideoCodecId codec)
return "VP6";
case SrsVideoCodecIdHEVC:
return "HEVC";
case SrsVideoCodecIdAV1:
return "AV1";
case SrsVideoCodecIdReserved:
case SrsVideoCodecIdReserved1:
case SrsVideoCodecIdReserved2:
Expand Down Expand Up @@ -650,7 +652,10 @@ bool SrsFormat::is_aac_sequence_header()

bool SrsFormat::is_avc_sequence_header()
{
return vcodec && (vcodec->id == SrsVideoCodecIdAVC || vcodec->id == SrsVideoCodecIdHEVC)
bool h264 = vcodec->id == SrsVideoCodecIdAVC;
bool h265 = vcodec->id == SrsVideoCodecIdHEVC;
bool av1 = vcodec->id == SrsVideoCodecIdAV1;
return vcodec && (h264 || h265 || av1)
&& video && video->avc_packet_type == SrsVideoAvcFrameTraitSequenceHeader;
}

Expand Down
2 changes: 2 additions & 0 deletions trunk/src/kernel/srs_kernel_codec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ enum SrsVideoCodecId
SrsVideoCodecIdAVC = 7,
// See page 79 at @doc https://github.com/CDN-Union/H265/blob/master/Document/video_file_format_spec_v10_1_ksyun_20170615.doc
SrsVideoCodecIdHEVC = 12,
// https://mp.weixin.qq.com/s/H3qI7zsON5sdf4oDJ9qlkg
SrsVideoCodecIdAV1 = 13,
};
std::string srs_video_codec_id2str(SrsVideoCodecId codec);

Expand Down
1 change: 1 addition & 0 deletions trunk/src/kernel/srs_kernel_ts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ srs_error_t SrsTsContext::encode(ISrsStreamWriter* writer, SrsTsMessage* msg, Sr
case SrsVideoCodecIdOn2VP6WithAlphaChannel:
case SrsVideoCodecIdScreenVideoVersion2:
case SrsVideoCodecIdHEVC:
case SrsVideoCodecIdAV1:
vs = SrsTsStreamReserved;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/libs/srs_librtmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1666,7 +1666,7 @@ int srs_mp4_to_flv_tag(srs_mp4_t mp4, srs_mp4_sample_t* s, char* type, uint32_t*

// E.4.3.1 VIDEODATA, flv_v10_1.pdf, page 5
p.write_1bytes(uint8_t(s->frame_type<<4) | uint8_t(s->codec));
if (s->codec == SrsVideoCodecIdAVC || s->codec == SrsVideoCodecIdHEVC) {
if (s->codec == SrsVideoCodecIdAVC || s->codec == SrsVideoCodecIdHEVC || s->codec == SrsVideoCodecIdAV1) {
*type = SRS_RTMP_TYPE_VIDEO;

p.write_1bytes(uint8_t(s->frame_trait == (uint16_t)SrsVideoAvcFrameTraitSequenceHeader? 0:1));
Expand Down
9 changes: 8 additions & 1 deletion trunk/src/utest/srs_utest_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3028,6 +3028,7 @@ VOID TEST(KernelCodecTest, CoverAll)
EXPECT_TRUE("H264" == srs_video_codec_id2str(SrsVideoCodecIdAVC));
EXPECT_TRUE("VP6" == srs_video_codec_id2str(SrsVideoCodecIdOn2VP6));
EXPECT_TRUE("HEVC" == srs_video_codec_id2str(SrsVideoCodecIdHEVC));
EXPECT_TRUE("AV1" == srs_video_codec_id2str(SrsVideoCodecIdAV1));
EXPECT_TRUE("Other" == srs_video_codec_id2str(SrsVideoCodecIdScreenVideo));
}

Expand Down Expand Up @@ -3293,6 +3294,9 @@ VOID TEST(KernelCodecTest, IsSequenceHeaderSpecial)
f.vcodec->id = SrsVideoCodecIdHEVC;
EXPECT_FALSE(f.is_avc_sequence_header());

f.vcodec->id = SrsVideoCodecIdAV1;
EXPECT_FALSE(f.is_avc_sequence_header());

f.video->avc_packet_type = SrsVideoAvcFrameTraitSequenceHeader;
EXPECT_TRUE(f.is_avc_sequence_header());
}
Expand Down Expand Up @@ -4647,7 +4651,10 @@ VOID TEST(KernelTSTest, CoverContextEncode)

err = ctx.encode(&f, &m, SrsVideoCodecIdHEVC, SrsAudioCodecIdOpus);
HELPER_EXPECT_FAILED(err);


err = ctx.encode(&f, &m, SrsVideoCodecIdAV1, SrsAudioCodecIdOpus);
HELPER_EXPECT_FAILED(err);

err = ctx.encode_pat_pmt(&f, 0, SrsTsStreamReserved, 0, SrsTsStreamReserved);
HELPER_EXPECT_FAILED(err);
}
Expand Down

0 comments on commit 3900179

Please sign in to comment.