AI: Fix naming problem in kernel module. v7.0.82 (#4479)
Co-authored-by: OSSRS-AI <winlinam@gmail.com>
This commit is contained in:
parent
7c1e87ef5c
commit
8f87d4092b
|
|
@ -164,7 +164,7 @@ code_patterns:
|
|||
|
||||
naming_conventions:
|
||||
- pattern: "field_naming"
|
||||
description: "MANDATORY - All class and struct fields must end with underscore (_)"
|
||||
description: "MANDATORY - All class and struct fields (member variables) must end with underscore (_), but NOT functions/methods"
|
||||
usage: |
|
||||
WRONG: Fields without underscore
|
||||
class SrsBuffer {
|
||||
|
|
@ -175,17 +175,19 @@ code_patterns:
|
|||
bool enabled;
|
||||
};
|
||||
|
||||
CORRECT: Fields with underscore
|
||||
CORRECT: Fields with underscore, functions without underscore
|
||||
class SrsBuffer {
|
||||
private:
|
||||
char *p_;
|
||||
int size_;
|
||||
public:
|
||||
bool enabled_;
|
||||
public:
|
||||
srs_error_t initialize();
|
||||
};
|
||||
scope: "Applies to ALL fields (private, protected, public) in both classes and structs"
|
||||
scope: "Applies ONLY to fields (member variables) in classes and structs - NOT to functions, methods, or parameters"
|
||||
exceptions: "Only applies to SRS-defined classes/structs - do NOT change 3rd party code like llhttp"
|
||||
rationale: "Consistent naming convention across SRS codebase for better code readability and maintenance"
|
||||
rationale: "Consistent naming convention across SRS codebase for better code readability and maintenance - underscore distinguishes member variables from local variables and parameters"
|
||||
|
||||
commenting_style:
|
||||
- pattern: "C++ style comments"
|
||||
|
|
|
|||
2
trunk/configure
vendored
2
trunk/configure
vendored
|
|
@ -378,7 +378,7 @@ if [[ $SRS_UTEST == YES ]]; then
|
|||
"srs_utest_mp4" "srs_utest_service" "srs_utest_app" "srs_utest_rtc" "srs_utest_config2"
|
||||
"srs_utest_protocol" "srs_utest_protocol2" "srs_utest_kernel2" "srs_utest_protocol3"
|
||||
"srs_utest_st" "srs_utest_rtc2" "srs_utest_rtc3" "srs_utest_fmp4" "srs_utest_source_lock"
|
||||
"srs_utest_stream_token" "srs_utest_rtc_recv_track" "srs_utest_st2")
|
||||
"srs_utest_stream_token" "srs_utest_rtc_recv_track" "srs_utest_st2" "srs_utest_hevc_structs")
|
||||
# Always include SRT utest
|
||||
MODULE_FILES+=("srs_utest_srt")
|
||||
if [[ $SRS_GB28181 == YES ]]; then
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ The changelog for SRS.
|
|||
<a name="v7-changes"></a>
|
||||
|
||||
## SRS 7.0 Changelog
|
||||
* v7.0, 2025-09-07, Merge [#4479](https://github.com/ossrs/srs/pull/4479): AI: Fix naming problem in kernel module. v7.0.82 (#4479)
|
||||
* v7.0, 2025-09-06, Merge [#4478](https://github.com/ossrs/srs/pull/4478): AI: Add more utests for kernel module. v7.0.81 (#4478)
|
||||
* v7.0, 2025-09-06, Merge [#4475](https://github.com/ossrs/srs/pull/4475): AI: Support anonymous coroutine with code block. v7.0.80 (#4475)
|
||||
* v7.0, 2025-09-05, Merge [#4474](https://github.com/ossrs/srs/pull/4474): WebRTC: Fix race condition in RTC nack timer callbacks. v7.0.79 (#4474)
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ ISrsResource *SrsResourceManager::at(int index)
|
|||
|
||||
ISrsResource *SrsResourceManager::find_by_id(std::string id)
|
||||
{
|
||||
++_srs_pps_ids->sugar;
|
||||
++_srs_pps_ids->sugar_;
|
||||
map<string, ISrsResource *>::iterator it = conns_id_.find(id);
|
||||
return (it != conns_id_.end()) ? it->second : NULL;
|
||||
}
|
||||
|
|
@ -188,18 +188,18 @@ ISrsResource *SrsResourceManager::find_by_fast_id(uint64_t id)
|
|||
{
|
||||
SrsResourceFastIdItem *item = &conns_level0_cache_[(id | id >> 32) % nn_level0_cache_];
|
||||
if (item->available && item->fast_id == id) {
|
||||
++_srs_pps_fids_level0->sugar;
|
||||
++_srs_pps_fids_level0->sugar_;
|
||||
return item->impl;
|
||||
}
|
||||
|
||||
++_srs_pps_fids->sugar;
|
||||
++_srs_pps_fids->sugar_;
|
||||
map<uint64_t, ISrsResource *>::iterator it = conns_fast_id_.find(id);
|
||||
return (it != conns_fast_id_.end()) ? it->second : NULL;
|
||||
}
|
||||
|
||||
ISrsResource *SrsResourceManager::find_by_name(std::string name)
|
||||
{
|
||||
++_srs_pps_ids->sugar;
|
||||
++_srs_pps_ids->sugar_;
|
||||
map<string, ISrsResource *>::iterator it = conns_name_.find(name);
|
||||
return (it != conns_name_.end()) ? it->second : NULL;
|
||||
}
|
||||
|
|
@ -334,7 +334,7 @@ void SrsResourceManager::do_clear()
|
|||
i, conn->desc().c_str(), conn, (int)conns_.size(), (int)copy.size(), (int)zombies_.size());
|
||||
}
|
||||
|
||||
++_srs_pps_dispose->sugar;
|
||||
++_srs_pps_dispose->sugar_;
|
||||
|
||||
dispose(conn);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,26 +117,26 @@ srs_error_t SrsFragmentedMp4::write(SrsMediaPacket *shared_msg, SrsFormat *forma
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
if (shared_msg->is_audio()) {
|
||||
uint8_t *sample = (uint8_t *)format->raw;
|
||||
uint32_t nb_sample = (uint32_t)format->nb_raw;
|
||||
uint8_t *sample = (uint8_t *)format->raw_;
|
||||
uint32_t nb_sample = (uint32_t)format->nb_raw_;
|
||||
|
||||
uint32_t dts = (uint32_t)shared_msg->timestamp;
|
||||
uint32_t dts = (uint32_t)shared_msg->timestamp_;
|
||||
err = enc->write_sample(SrsMp4HandlerTypeSOUN, 0x00, dts, dts, sample, nb_sample);
|
||||
} else if (shared_msg->is_video()) {
|
||||
SrsVideoAvcFrameType frame_type = format->video->frame_type;
|
||||
uint32_t cts = (uint32_t)format->video->cts;
|
||||
SrsVideoAvcFrameType frame_type = format->video_->frame_type_;
|
||||
uint32_t cts = (uint32_t)format->video_->cts_;
|
||||
|
||||
uint32_t dts = (uint32_t)shared_msg->timestamp;
|
||||
uint32_t dts = (uint32_t)shared_msg->timestamp_;
|
||||
uint32_t pts = dts + cts;
|
||||
|
||||
uint8_t *sample = (uint8_t *)format->raw;
|
||||
uint32_t nb_sample = (uint32_t)format->nb_raw;
|
||||
uint8_t *sample = (uint8_t *)format->raw_;
|
||||
uint32_t nb_sample = (uint32_t)format->nb_raw_;
|
||||
err = enc->write_sample(SrsMp4HandlerTypeVIDE, frame_type, dts, pts, sample, nb_sample);
|
||||
} else {
|
||||
return err;
|
||||
}
|
||||
|
||||
append(shared_msg->timestamp);
|
||||
append(shared_msg->timestamp_);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
@ -258,7 +258,7 @@ srs_error_t SrsMpdWriter::write(SrsFormat *format, SrsFragmentWindow *afragments
|
|||
|
||||
ss << " <Period start=\"PT0S\">" << endl;
|
||||
|
||||
if (format->acodec && !afragments->empty()) {
|
||||
if (format->acodec_ && !afragments->empty()) {
|
||||
int start_index = srs_max(0, afragments->size() - window_size_);
|
||||
ss << " <AdaptationSet mimeType=\"audio/mp4\" segmentAlignment=\"true\" startWithSAP=\"1\">" << endl;
|
||||
ss << " <Representation id=\"audio\" bandwidth=\"48000\" codecs=\"mp4a.40.2\">" << endl;
|
||||
|
|
@ -277,10 +277,10 @@ srs_error_t SrsMpdWriter::write(SrsFormat *format, SrsFragmentWindow *afragments
|
|||
ss << " </AdaptationSet>" << endl;
|
||||
}
|
||||
|
||||
if (format->vcodec && !vfragments->empty()) {
|
||||
if (format->vcodec_ && !vfragments->empty()) {
|
||||
int start_index = srs_max(0, vfragments->size() - window_size_);
|
||||
int w = format->vcodec->width;
|
||||
int h = format->vcodec->height;
|
||||
int w = format->vcodec_->width_;
|
||||
int h = format->vcodec_->height_;
|
||||
ss << " <AdaptationSet mimeType=\"video/mp4\" segmentAlignment=\"true\" startWithSAP=\"1\">" << endl;
|
||||
ss << " <Representation id=\"video\" bandwidth=\"800000\" codecs=\"avc1.64001e\" " << "width=\"" << w << "\" height=\"" << h << "\">" << endl;
|
||||
ss << " <SegmentTemplate initialization=\"$RepresentationID$-init.mp4\" "
|
||||
|
|
@ -490,7 +490,7 @@ srs_error_t SrsDashController::on_audio(SrsMediaPacket *shared_audio, SrsFormat
|
|||
return refresh_init_mp4(shared_audio, format);
|
||||
}
|
||||
|
||||
audio_dts = shared_audio->timestamp;
|
||||
audio_dts = shared_audio->timestamp_;
|
||||
|
||||
if (!acurrent) {
|
||||
acurrent = new SrsFragmentedMp4();
|
||||
|
|
@ -510,7 +510,7 @@ srs_error_t SrsDashController::on_audio(SrsMediaPacket *shared_audio, SrsFormat
|
|||
// The video is reaped, audio must be reaped right now to align the timestamp of video.
|
||||
video_reaped_ = false;
|
||||
// Append current timestamp to calculate right duration.
|
||||
acurrent->append(shared_audio->timestamp);
|
||||
acurrent->append(shared_audio->timestamp_);
|
||||
if ((err = acurrent->reap(audio_dts)) != srs_success) {
|
||||
return srs_error_wrap(err, "reap current");
|
||||
}
|
||||
|
|
@ -562,7 +562,7 @@ srs_error_t SrsDashController::on_video(SrsMediaPacket *shared_video, SrsFormat
|
|||
return refresh_init_mp4(shared_video, format);
|
||||
}
|
||||
|
||||
video_dts = shared_video->timestamp;
|
||||
video_dts = shared_video->timestamp_;
|
||||
|
||||
if (!vcurrent) {
|
||||
vcurrent = new SrsFragmentedMp4();
|
||||
|
|
@ -577,10 +577,10 @@ srs_error_t SrsDashController::on_video(SrsMediaPacket *shared_video, SrsFormat
|
|||
mpd->set_availability_start_time(srs_time_now_cached() - first_dts_ * SRS_UTIME_MILLISECONDS);
|
||||
}
|
||||
|
||||
bool reopen = format->video->frame_type == SrsVideoAvcFrameTypeKeyFrame && vcurrent->duration() >= fragment;
|
||||
bool reopen = format->video_->frame_type_ == SrsVideoAvcFrameTypeKeyFrame && vcurrent->duration() >= fragment;
|
||||
if (reopen) {
|
||||
// Append current timestamp to calculate right duration.
|
||||
vcurrent->append(shared_video->timestamp);
|
||||
vcurrent->append(shared_video->timestamp_);
|
||||
if ((err = vcurrent->reap(video_dts)) != srs_success) {
|
||||
return srs_error_wrap(err, "reap current");
|
||||
}
|
||||
|
|
@ -630,7 +630,7 @@ srs_error_t SrsDashController::refresh_mpd(SrsFormat *format)
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
// TODO: FIXME: Support pure audio streaming.
|
||||
if (!format || !format->acodec || !format->vcodec) {
|
||||
if (!format || !format->acodec_ || !format->vcodec_) {
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -645,7 +645,7 @@ srs_error_t SrsDashController::refresh_init_mp4(SrsMediaPacket *msg, SrsFormat *
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
if (msg->size() <= 0 || (msg->is_video() && !format->vcodec->is_avc_codec_ok()) || (msg->is_audio() && !format->acodec->is_aac_codec_ok())) {
|
||||
if (msg->size() <= 0 || (msg->is_video() && !format->vcodec_->is_avc_codec_ok()) || (msg->is_audio() && !format->acodec_->is_aac_codec_ok())) {
|
||||
srs_warn("DASH: Ignore empty sequence header.");
|
||||
return err;
|
||||
}
|
||||
|
|
@ -804,7 +804,7 @@ srs_error_t SrsDash::on_audio(SrsMediaPacket *shared_audio, SrsFormat *format)
|
|||
return err;
|
||||
}
|
||||
|
||||
if (!format->acodec) {
|
||||
if (!format->acodec_) {
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -826,7 +826,7 @@ srs_error_t SrsDash::on_video(SrsMediaPacket *shared_video, SrsFormat *format)
|
|||
return err;
|
||||
}
|
||||
|
||||
if (!format->vcodec) {
|
||||
if (!format->vcodec_) {
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ string SrsDvrSegmenter::generate_path()
|
|||
|
||||
srs_error_t SrsDvrSegmenter::on_update_duration(SrsMediaPacket *msg)
|
||||
{
|
||||
fragment->append(msg->timestamp);
|
||||
fragment->append(msg->timestamp_);
|
||||
return srs_success;
|
||||
}
|
||||
|
||||
|
|
@ -372,7 +372,7 @@ srs_error_t SrsDvrFlvSegmenter::encode_audio(SrsMediaPacket *audio, SrsFormat *f
|
|||
|
||||
char *payload = audio->payload();
|
||||
int size = audio->size();
|
||||
if ((err = enc->write_audio(audio->timestamp, payload, size)) != srs_success) {
|
||||
if ((err = enc->write_audio(audio->timestamp_, payload, size)) != srs_success) {
|
||||
return srs_error_wrap(err, "write audio");
|
||||
}
|
||||
|
||||
|
|
@ -385,8 +385,8 @@ srs_error_t SrsDvrFlvSegmenter::encode_video(SrsMediaPacket *video, SrsFormat *f
|
|||
|
||||
char *payload = video->payload();
|
||||
int size = video->size();
|
||||
bool sh = (format->video->avc_packet_type == SrsVideoAvcFrameTraitSequenceHeader);
|
||||
bool keyframe = (!sh && format->video->frame_type == SrsVideoAvcFrameTypeKeyFrame);
|
||||
bool sh = (format->video_->avc_packet_type_ == SrsVideoAvcFrameTraitSequenceHeader);
|
||||
bool keyframe = (!sh && format->video_->frame_type_ == SrsVideoAvcFrameTypeKeyFrame);
|
||||
|
||||
if (keyframe) {
|
||||
has_keyframe = true;
|
||||
|
|
@ -398,7 +398,7 @@ srs_error_t SrsDvrFlvSegmenter::encode_video(SrsMediaPacket *video, SrsFormat *f
|
|||
return err;
|
||||
}
|
||||
|
||||
if ((err = enc->write_video(video->timestamp, payload, size)) != srs_success) {
|
||||
if ((err = enc->write_video(video->timestamp_, payload, size)) != srs_success) {
|
||||
return srs_error_wrap(err, "write video");
|
||||
}
|
||||
|
||||
|
|
@ -448,23 +448,23 @@ srs_error_t SrsDvrMp4Segmenter::encode_audio(SrsMediaPacket *audio, SrsFormat *f
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
SrsAudioCodecId sound_format = format->acodec->id;
|
||||
SrsAudioSampleRate sound_rate = format->acodec->sound_rate;
|
||||
SrsAudioSampleBits sound_size = format->acodec->sound_size;
|
||||
SrsAudioChannels channels = format->acodec->sound_type;
|
||||
SrsAudioCodecId sound_format = format->acodec_->id_;
|
||||
SrsAudioSampleRate sound_rate = format->acodec_->sound_rate_;
|
||||
SrsAudioSampleBits sound_size = format->acodec_->sound_size_;
|
||||
SrsAudioChannels channels = format->acodec_->sound_type_;
|
||||
|
||||
SrsAudioAacFrameTrait ct = format->audio->aac_packet_type;
|
||||
SrsAudioAacFrameTrait ct = format->audio_->aac_packet_type_;
|
||||
if (ct == SrsAudioAacFrameTraitSequenceHeader || ct == SrsAudioMp3FrameTraitSequenceHeader) {
|
||||
enc->acodec = sound_format;
|
||||
enc->sample_rate = sound_rate;
|
||||
enc->sound_bits = sound_size;
|
||||
enc->channels = channels;
|
||||
enc->acodec_ = sound_format;
|
||||
enc->sample_rate_ = sound_rate;
|
||||
enc->sound_bits_ = sound_size;
|
||||
enc->channels_ = channels;
|
||||
}
|
||||
|
||||
uint8_t *sample = (uint8_t *)format->raw;
|
||||
uint32_t nb_sample = (uint32_t)format->nb_raw;
|
||||
uint8_t *sample = (uint8_t *)format->raw_;
|
||||
uint32_t nb_sample = (uint32_t)format->nb_raw_;
|
||||
|
||||
uint32_t dts = (uint32_t)audio->timestamp;
|
||||
uint32_t dts = (uint32_t)audio->timestamp_;
|
||||
if ((err = enc->write_sample(format, SrsMp4HandlerTypeSOUN, 0x00, ct, dts, dts, sample, nb_sample)) != srs_success) {
|
||||
return srs_error_wrap(err, "write sample");
|
||||
}
|
||||
|
|
@ -476,21 +476,21 @@ srs_error_t SrsDvrMp4Segmenter::encode_video(SrsMediaPacket *video, SrsFormat *f
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
SrsVideoAvcFrameType frame_type = format->video->frame_type;
|
||||
SrsVideoCodecId codec_id = format->vcodec->id;
|
||||
SrsVideoAvcFrameType frame_type = format->video_->frame_type_;
|
||||
SrsVideoCodecId codec_id = format->vcodec_->id_;
|
||||
|
||||
SrsVideoAvcFrameTrait ct = format->video->avc_packet_type;
|
||||
uint32_t cts = (uint32_t)format->video->cts;
|
||||
SrsVideoAvcFrameTrait ct = format->video_->avc_packet_type_;
|
||||
uint32_t cts = (uint32_t)format->video_->cts_;
|
||||
|
||||
if (ct == SrsVideoAvcFrameTraitSequenceHeader) {
|
||||
enc->vcodec = codec_id;
|
||||
enc->vcodec_ = codec_id;
|
||||
}
|
||||
|
||||
uint32_t dts = (uint32_t)video->timestamp;
|
||||
uint32_t dts = (uint32_t)video->timestamp_;
|
||||
uint32_t pts = dts + cts;
|
||||
|
||||
uint8_t *sample = (uint8_t *)format->raw;
|
||||
uint32_t nb_sample = (uint32_t)format->nb_raw;
|
||||
uint8_t *sample = (uint8_t *)format->raw_;
|
||||
uint32_t nb_sample = (uint32_t)format->nb_raw_;
|
||||
if ((err = enc->write_sample(format, SrsMp4HandlerTypeVIDE, frame_type, ct, dts, pts, sample, nb_sample)) != srs_success) {
|
||||
return srs_error_wrap(err, "write sample");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ srs_error_t SrsEdgeFlvUpstream::decode_message(SrsRtmpCommonMessage *msg, SrsRtm
|
|||
|
||||
SrsRtmpCommand *packet = NULL;
|
||||
SrsBuffer stream(msg->payload(), msg->size());
|
||||
SrsMessageHeader &header = msg->header;
|
||||
SrsMessageHeader &header = msg->header_;
|
||||
|
||||
if (header.is_amf0_data() || header.is_amf3_data()) {
|
||||
std::string command;
|
||||
|
|
@ -619,21 +619,21 @@ srs_error_t SrsEdgeIngester::process_publish_message(SrsRtmpCommonMessage *msg,
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
// process audio packet
|
||||
if (msg->header.is_audio()) {
|
||||
if (msg->header_.is_audio()) {
|
||||
if ((err = source_->on_audio(msg)) != srs_success) {
|
||||
return srs_error_wrap(err, "source consume audio");
|
||||
}
|
||||
}
|
||||
|
||||
// process video packet
|
||||
if (msg->header.is_video()) {
|
||||
if (msg->header_.is_video()) {
|
||||
if ((err = source_->on_video(msg)) != srs_success) {
|
||||
return srs_error_wrap(err, "source consume video");
|
||||
}
|
||||
}
|
||||
|
||||
// process aggregate packet
|
||||
if (msg->header.is_aggregate()) {
|
||||
if (msg->header_.is_aggregate()) {
|
||||
if ((err = source_->on_aggregate(msg)) != srs_success) {
|
||||
return srs_error_wrap(err, "source consume aggregate");
|
||||
}
|
||||
|
|
@ -641,7 +641,7 @@ srs_error_t SrsEdgeIngester::process_publish_message(SrsRtmpCommonMessage *msg,
|
|||
}
|
||||
|
||||
// process onMetaData
|
||||
if (msg->header.is_amf0_data() || msg->header.is_amf3_data()) {
|
||||
if (msg->header_.is_amf0_data() || msg->header_.is_amf3_data()) {
|
||||
SrsRtmpCommand *pkt_raw = NULL;
|
||||
if ((err = upstream->decode_message(msg, &pkt_raw)) != srs_success) {
|
||||
return srs_error_wrap(err, "decode message");
|
||||
|
|
@ -660,7 +660,7 @@ srs_error_t SrsEdgeIngester::process_publish_message(SrsRtmpCommonMessage *msg,
|
|||
}
|
||||
|
||||
// call messages, for example, reject, redirect.
|
||||
if (msg->header.is_amf0_command() || msg->header.is_amf3_command()) {
|
||||
if (msg->header_.is_amf0_command() || msg->header_.is_amf3_command()) {
|
||||
SrsRtmpCommand *pkt_raw = NULL;
|
||||
if ((err = upstream->decode_message(msg, &pkt_raw)) != srs_success) {
|
||||
return srs_error_wrap(err, "decode message");
|
||||
|
|
@ -919,14 +919,14 @@ srs_error_t SrsEdgeForwarder::proxy(SrsRtmpCommonMessage *msg)
|
|||
|
||||
// the msg is auto free by source,
|
||||
// so we just ignore, or copy then send it.
|
||||
if (msg->size() <= 0 || msg->header.is_set_chunk_size() || msg->header.is_window_ackledgement_size() || msg->header.is_ackledgement()) {
|
||||
if (msg->size() <= 0 || msg->header_.is_set_chunk_size() || msg->header_.is_window_ackledgement_size() || msg->header_.is_ackledgement()) {
|
||||
return err;
|
||||
}
|
||||
|
||||
SrsMediaPacket copy;
|
||||
msg->to_msg(©);
|
||||
|
||||
copy.stream_id = sdk->sid();
|
||||
copy.stream_id_ = sdk->sid();
|
||||
if ((err = queue->enqueue(copy.copy())) != srs_success) {
|
||||
return srs_error_wrap(err, "enqueue message");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,12 +145,12 @@ void SrsGbSession::on_ps_pack(SrsPackContext *ctx, SrsPsPacket *ps, const std::v
|
|||
SrsTsMessage *msg = *it;
|
||||
|
||||
// Group all videos to one video.
|
||||
if (msg->sid == SrsTsPESStreamIdVideoCommon) {
|
||||
if (msg->sid_ == SrsTsPESStreamIdVideoCommon) {
|
||||
video->ps_helper_ = msg->ps_helper_;
|
||||
video->dts = msg->dts;
|
||||
video->pts = msg->pts;
|
||||
video->sid = msg->sid;
|
||||
video->payload->append(msg->payload);
|
||||
video->dts_ = msg->dts_;
|
||||
video->pts_ = msg->pts_;
|
||||
video->sid_ = msg->sid_;
|
||||
video->payload_->append(msg->payload_);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -163,7 +163,7 @@ void SrsGbSession::on_ps_pack(SrsPackContext *ctx, SrsPsPacket *ps, const std::v
|
|||
}
|
||||
|
||||
// Send the generated video message.
|
||||
if (video->payload->length() > 0) {
|
||||
if (video->payload_->length() > 0) {
|
||||
srs_error_t err = muxer_->on_ts_message(video.get());
|
||||
if (err != srs_success) {
|
||||
srs_warn("Muxer: Ignore video err %s", srs_error_desc(err).c_str());
|
||||
|
|
@ -672,15 +672,15 @@ srs_error_t SrsMpegpsQueue::push(SrsMediaPacket *msg)
|
|||
|
||||
// TODO: FIXME: use right way.
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (msgs.find(msg->timestamp) == msgs.end()) {
|
||||
if (msgs.find(msg->timestamp_) == msgs.end()) {
|
||||
break;
|
||||
}
|
||||
|
||||
// adjust the ts, add 1ms.
|
||||
msg->timestamp += 1;
|
||||
msg->timestamp_ += 1;
|
||||
|
||||
if (i >= 100) {
|
||||
srs_warn("Muxer: free the msg for dts exists, dts=%" PRId64, msg->timestamp);
|
||||
srs_warn("Muxer: free the msg for dts exists, dts=%" PRId64, msg->timestamp_);
|
||||
srs_freep(msg);
|
||||
return err;
|
||||
}
|
||||
|
|
@ -694,7 +694,7 @@ srs_error_t SrsMpegpsQueue::push(SrsMediaPacket *msg)
|
|||
nb_videos++;
|
||||
}
|
||||
|
||||
msgs[msg->timestamp] = msg;
|
||||
msgs[msg->timestamp_] = msg;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
@ -765,8 +765,8 @@ srs_error_t SrsGbMuxer::on_ts_message(SrsTsMessage *msg)
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
SrsBuffer avs(msg->payload->bytes(), msg->payload->length());
|
||||
if (msg->sid == SrsTsPESStreamIdVideoCommon) {
|
||||
SrsBuffer avs(msg->payload_->bytes(), msg->payload_->length());
|
||||
if (msg->sid_ == SrsTsPESStreamIdVideoCommon) {
|
||||
if ((err = on_ts_video(msg, &avs)) != srs_success) {
|
||||
return srs_error_wrap(err, "ts: consume video");
|
||||
}
|
||||
|
|
@ -811,8 +811,8 @@ srs_error_t SrsGbMuxer::mux_h264(SrsTsMessage *msg, SrsBuffer *avs)
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
// ts tbn to flv tbn.
|
||||
uint32_t dts = (uint32_t)(msg->dts / 90);
|
||||
uint32_t pts = (uint32_t)(msg->dts / 90);
|
||||
uint32_t dts = (uint32_t)(msg->dts_ / 90);
|
||||
uint32_t pts = (uint32_t)(msg->dts_ / 90);
|
||||
|
||||
// send each frame.
|
||||
while (!avs->empty()) {
|
||||
|
|
@ -972,8 +972,8 @@ srs_error_t SrsGbMuxer::mux_h265(SrsTsMessage *msg, SrsBuffer *avs)
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
// ts tbn to flv tbn.
|
||||
uint32_t dts = (uint32_t)(msg->dts / 90);
|
||||
uint32_t pts = (uint32_t)(msg->dts / 90);
|
||||
uint32_t dts = (uint32_t)(msg->dts_ / 90);
|
||||
uint32_t pts = (uint32_t)(msg->dts_ / 90);
|
||||
|
||||
// send each frame.
|
||||
while (!avs->empty()) {
|
||||
|
|
@ -1154,7 +1154,7 @@ srs_error_t SrsGbMuxer::on_ts_audio(SrsTsMessage *msg, SrsBuffer *avs)
|
|||
}
|
||||
|
||||
// ts tbn to flv tbn.
|
||||
uint32_t dts = (uint32_t)(msg->dts / 90);
|
||||
uint32_t dts = (uint32_t)(msg->dts_ / 90);
|
||||
|
||||
// send each frame.
|
||||
while (!avs->empty()) {
|
||||
|
|
@ -1242,7 +1242,7 @@ srs_error_t SrsGbMuxer::rtmp_write_packet(char type, uint32_t timestamp, char *d
|
|||
srs_trace("Muxer: send msg %s age=%d, dts=%" PRId64 ", size=%d",
|
||||
msg->is_audio() ? "A" : msg->is_video() ? "V"
|
||||
: "N",
|
||||
pprint_->age(), msg->timestamp, msg->size());
|
||||
pprint_->age(), msg->timestamp_, msg->size());
|
||||
}
|
||||
|
||||
// send out encoded msg.
|
||||
|
|
@ -1346,12 +1346,12 @@ srs_error_t SrsPackContext::on_ts_message(SrsTsMessage *msg)
|
|||
//}
|
||||
|
||||
// Correct DTS/PS to the last one.
|
||||
if (!msgs_.empty() && (!msg->dts || !msg->pts)) {
|
||||
if (!msgs_.empty() && (!msg->dts_ || !msg->pts_)) {
|
||||
SrsTsMessage *last = msgs_.back();
|
||||
if (!msg->dts)
|
||||
msg->dts = last->dts;
|
||||
if (!msg->pts)
|
||||
msg->pts = last->pts;
|
||||
if (!msg->dts_)
|
||||
msg->dts_ = last->dts_;
|
||||
if (!msg->pts_)
|
||||
msg->pts_ = last->pts_;
|
||||
}
|
||||
|
||||
// uint8_t* p = (uint8_t*)msg->payload->bytes();
|
||||
|
|
@ -1424,14 +1424,14 @@ srs_error_t SrsRecoverablePsContext::decode_rtp(SrsBuffer *stream, int reserved,
|
|||
memmove(dst, src, reserved);
|
||||
|
||||
// The payload also should skip back to the reserved bytes.
|
||||
rtp_raw->payload -= reserved;
|
||||
rtp_raw->nn_payload += reserved;
|
||||
rtp_raw->payload_ -= reserved;
|
||||
rtp_raw->nn_payload_ += reserved;
|
||||
|
||||
// The stream also skip back to the not parsed bytes.
|
||||
stream->skip(-1 * reserved);
|
||||
}
|
||||
|
||||
SrsBuffer b((char *)rtp_raw->payload, rtp_raw->nn_payload);
|
||||
SrsBuffer b((char *)rtp_raw->payload_, rtp_raw->nn_payload_);
|
||||
// srs_trace("GB: Got RTP length=%d, payload=%d, seq=%u, ts=%d", length, rtp_raw->nn_payload, rtp.header.get_sequence(), rtp.header.get_timestamp());
|
||||
|
||||
ctx_.helper_.rtp_seq_ = rtp.header.get_sequence();
|
||||
|
|
@ -1488,7 +1488,7 @@ srs_error_t SrsRecoverablePsContext::enter_recover_mode(SrsBuffer *stream, ISrsP
|
|||
uint16_t lsopm = h.pack_pre_msg_last_seq_;
|
||||
SrsTsMessage *last = ctx_.last();
|
||||
srs_warn("PS: Enter recover=%d, seq=%u, ts=%u, pt=%u, pack=%u, msgs=%u, lsopm=%u, last=%u/%u, bytes=[%s], pos=%d, left=%d for err %s",
|
||||
recover_, h.rtp_seq_, h.rtp_ts_, h.rtp_pt_, pack_seq, pack_msgs, lsopm, last->PES_packet_length, last->payload->length(),
|
||||
recover_, h.rtp_seq_, h.rtp_ts_, h.rtp_pt_, pack_seq, pack_msgs, lsopm, last->PES_packet_length_, last->payload_->length(),
|
||||
bytes.c_str(), npos, stream->left(), srs_error_desc(err).c_str());
|
||||
|
||||
// If RTP packet exceed SRS_GB_LARGE_PACKET, which is large packet, might be correct length and impossible to
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ string serialFlv(SrsMediaPacket *msg)
|
|||
SrsUniquePtr<SrsBuffer> stream(new SrsBuffer(byte, size));
|
||||
|
||||
// tag header
|
||||
long long dts = msg->timestamp;
|
||||
long long dts = msg->timestamp_;
|
||||
char type = msg->is_video() ? 0x09 : 0x08;
|
||||
|
||||
stream->write_1bytes(type);
|
||||
|
|
|
|||
|
|
@ -208,22 +208,22 @@ srs_error_t SrsHlsM4sSegment::write(SrsMediaPacket *shared_msg, SrsFormat *forma
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
if (shared_msg->is_audio()) {
|
||||
uint8_t *sample = (uint8_t *)format->raw;
|
||||
uint32_t nb_sample = (uint32_t)format->nb_raw;
|
||||
uint8_t *sample = (uint8_t *)format->raw_;
|
||||
uint32_t nb_sample = (uint32_t)format->nb_raw_;
|
||||
|
||||
uint32_t dts = (uint32_t)shared_msg->timestamp;
|
||||
uint32_t dts = (uint32_t)shared_msg->timestamp_;
|
||||
if ((err = enc_.write_sample(SrsMp4HandlerTypeSOUN, 0x00, dts, dts, sample, nb_sample)) != srs_success) {
|
||||
return srs_error_wrap(err, "m4s segment write audio sample");
|
||||
}
|
||||
} else if (shared_msg->is_video()) {
|
||||
SrsVideoAvcFrameType frame_type = format->video->frame_type;
|
||||
uint32_t cts = (uint32_t)format->video->cts;
|
||||
SrsVideoAvcFrameType frame_type = format->video_->frame_type_;
|
||||
uint32_t cts = (uint32_t)format->video_->cts_;
|
||||
|
||||
uint32_t dts = (uint32_t)shared_msg->timestamp;
|
||||
uint32_t dts = (uint32_t)shared_msg->timestamp_;
|
||||
uint32_t pts = dts + cts;
|
||||
|
||||
uint8_t *sample = (uint8_t *)format->raw;
|
||||
uint32_t nb_sample = (uint32_t)format->nb_raw;
|
||||
uint8_t *sample = (uint8_t *)format->raw_;
|
||||
uint32_t nb_sample = (uint32_t)format->nb_raw_;
|
||||
if ((err = enc_.write_sample(SrsMp4HandlerTypeVIDE, frame_type, dts, pts, sample, nb_sample)) != srs_success) {
|
||||
return srs_error_wrap(err, "m4s segment write video sample");
|
||||
}
|
||||
|
|
@ -232,7 +232,7 @@ srs_error_t SrsHlsM4sSegment::write(SrsMediaPacket *shared_msg, SrsFormat *forma
|
|||
return err;
|
||||
}
|
||||
|
||||
append(shared_msg->timestamp);
|
||||
append(shared_msg->timestamp_);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
@ -585,7 +585,7 @@ srs_error_t SrsHlsFmp4Muxer::write_audio(SrsMediaPacket *shared_audio, SrsFormat
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
if (!current_) {
|
||||
if ((err = segment_open(shared_audio->timestamp * SRS_UTIME_MILLISECONDS)) != srs_success) {
|
||||
if ((err = segment_open(shared_audio->timestamp_ * SRS_UTIME_MILLISECONDS)) != srs_success) {
|
||||
return srs_error_wrap(err, "open segment");
|
||||
}
|
||||
}
|
||||
|
|
@ -595,7 +595,7 @@ srs_error_t SrsHlsFmp4Muxer::write_audio(SrsMediaPacket *shared_audio, SrsFormat
|
|||
return srs_error_wrap(err, "segment close");
|
||||
}
|
||||
|
||||
if ((err = segment_open(shared_audio->timestamp * SRS_UTIME_MILLISECONDS)) != srs_success) {
|
||||
if ((err = segment_open(shared_audio->timestamp_ * SRS_UTIME_MILLISECONDS)) != srs_success) {
|
||||
return srs_error_wrap(err, "open segment");
|
||||
}
|
||||
}
|
||||
|
|
@ -608,10 +608,10 @@ srs_error_t SrsHlsFmp4Muxer::write_video(SrsMediaPacket *shared_video, SrsFormat
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
video_dts_ = shared_video->timestamp;
|
||||
video_dts_ = shared_video->timestamp_;
|
||||
|
||||
if (!current_) {
|
||||
if ((err = segment_open(shared_video->timestamp * SRS_UTIME_MILLISECONDS)) != srs_success) {
|
||||
if ((err = segment_open(shared_video->timestamp_ * SRS_UTIME_MILLISECONDS)) != srs_success) {
|
||||
return srs_error_wrap(err, "open segment");
|
||||
}
|
||||
}
|
||||
|
|
@ -622,7 +622,7 @@ srs_error_t SrsHlsFmp4Muxer::write_video(SrsMediaPacket *shared_video, SrsFormat
|
|||
return srs_error_wrap(err, "segment close");
|
||||
}
|
||||
|
||||
if ((err = segment_open(shared_video->timestamp * SRS_UTIME_MILLISECONDS)) != srs_success) {
|
||||
if ((err = segment_open(shared_video->timestamp_ * SRS_UTIME_MILLISECONDS)) != srs_success) {
|
||||
return srs_error_wrap(err, "open segment");
|
||||
}
|
||||
}
|
||||
|
|
@ -1593,19 +1593,19 @@ srs_error_t SrsHlsMuxer::flush_audio(SrsTsMessageCache *cache)
|
|||
return err;
|
||||
}
|
||||
|
||||
if (!cache->audio || cache->audio->payload->length() <= 0) {
|
||||
if (!cache->audio_ || cache->audio_->payload_->length() <= 0) {
|
||||
return err;
|
||||
}
|
||||
|
||||
// update the duration of segment.
|
||||
update_duration(cache->audio->dts);
|
||||
update_duration(cache->audio_->dts_);
|
||||
|
||||
if ((err = current->tscw->write_audio(cache->audio)) != srs_success) {
|
||||
if ((err = current->tscw->write_audio(cache->audio_)) != srs_success) {
|
||||
return srs_error_wrap(err, "hls: write audio");
|
||||
}
|
||||
|
||||
// write success, clear and free the msg
|
||||
srs_freep(cache->audio);
|
||||
srs_freep(cache->audio_);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
@ -1620,21 +1620,21 @@ srs_error_t SrsHlsMuxer::flush_video(SrsTsMessageCache *cache)
|
|||
return err;
|
||||
}
|
||||
|
||||
if (!cache->video || cache->video->payload->length() <= 0) {
|
||||
if (!cache->video_ || cache->video_->payload_->length() <= 0) {
|
||||
return err;
|
||||
}
|
||||
|
||||
srs_assert(current);
|
||||
|
||||
// update the duration of segment.
|
||||
update_duration(cache->video->dts);
|
||||
update_duration(cache->video_->dts_);
|
||||
|
||||
if ((err = current->tscw->write_video(cache->video)) != srs_success) {
|
||||
if ((err = current->tscw->write_video(cache->video_)) != srs_success) {
|
||||
return srs_error_wrap(err, "hls: write video");
|
||||
}
|
||||
|
||||
// write success, clear and free the msg
|
||||
srs_freep(cache->video);
|
||||
srs_freep(cache->video_);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
@ -2053,24 +2053,24 @@ srs_error_t SrsHlsController::on_sequence_header(SrsMediaPacket *msg, SrsFormat
|
|||
srs_error_t SrsHlsController::write_audio(SrsMediaPacket *shared_audio, SrsFormat *format)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
SrsParsedAudioPacket *frame = format->audio;
|
||||
SrsParsedAudioPacket *frame = format->audio_;
|
||||
|
||||
// Reset the aac samples counter when DTS jitter.
|
||||
if (previous_audio_dts > shared_audio->timestamp) {
|
||||
previous_audio_dts = shared_audio->timestamp;
|
||||
if (previous_audio_dts > shared_audio->timestamp_) {
|
||||
previous_audio_dts = shared_audio->timestamp_;
|
||||
aac_samples = 0;
|
||||
}
|
||||
|
||||
// The diff duration in ms between two FLV audio packets.
|
||||
int diff = ::abs((int)(shared_audio->timestamp - previous_audio_dts));
|
||||
previous_audio_dts = shared_audio->timestamp;
|
||||
int diff = ::abs((int)(shared_audio->timestamp_ - previous_audio_dts));
|
||||
previous_audio_dts = shared_audio->timestamp_;
|
||||
|
||||
// Guess the number of samples for each AAC frame.
|
||||
// If samples is 1024, the sample-rate is 8000HZ, the diff should be 1024/8000s=128ms.
|
||||
// If samples is 1024, the sample-rate is 44100HZ, the diff should be 1024/44100s=23ms.
|
||||
// If samples is 2048, the sample-rate is 44100HZ, the diff should be 2048/44100s=46ms.
|
||||
int nb_samples_per_frame = 0;
|
||||
int guessNumberOfSamples = diff * srs_flv_srates[format->acodec->sound_rate] / 1000;
|
||||
int guessNumberOfSamples = diff * srs_flv_srates[format->acodec_->sound_rate_] / 1000;
|
||||
if (guessNumberOfSamples > 0) {
|
||||
if (guessNumberOfSamples < 960) {
|
||||
nb_samples_per_frame = 960;
|
||||
|
|
@ -2085,19 +2085,19 @@ srs_error_t SrsHlsController::write_audio(SrsMediaPacket *shared_audio, SrsForma
|
|||
|
||||
// Recalc the DTS by the samples of AAC.
|
||||
aac_samples += nb_samples_per_frame;
|
||||
int64_t dts = 90000 * aac_samples / srs_flv_srates[format->acodec->sound_rate];
|
||||
int64_t dts = 90000 * aac_samples / srs_flv_srates[format->acodec_->sound_rate_];
|
||||
|
||||
// If directly turn FLV timestamp, overwrite the guessed DTS.
|
||||
// @doc https://github.com/ossrs/srs/issues/1506#issuecomment-562063095
|
||||
if (hls_dts_directly) {
|
||||
dts = shared_audio->timestamp * 90;
|
||||
dts = shared_audio->timestamp_ * 90;
|
||||
}
|
||||
|
||||
// Refresh the codec ASAP.
|
||||
if (muxer->latest_acodec() != frame->acodec()->id) {
|
||||
if (muxer->latest_acodec() != frame->acodec()->id_) {
|
||||
srs_trace("HLS: Switch audio codec %d(%s) to %d(%s)", muxer->latest_acodec(), srs_audio_codec_id2str(muxer->latest_acodec()).c_str(),
|
||||
frame->acodec()->id, srs_audio_codec_id2str(frame->acodec()->id).c_str());
|
||||
muxer->set_latest_acodec(frame->acodec()->id);
|
||||
frame->acodec()->id_, srs_audio_codec_id2str(frame->acodec()->id_).c_str());
|
||||
muxer->set_latest_acodec(frame->acodec()->id_);
|
||||
}
|
||||
|
||||
// write audio to cache.
|
||||
|
|
@ -2107,7 +2107,7 @@ srs_error_t SrsHlsController::write_audio(SrsMediaPacket *shared_audio, SrsForma
|
|||
|
||||
// First, update the duration of the segment, as we might reap the segment. The duration should
|
||||
// cover from the first frame to the last frame.
|
||||
muxer->update_duration(tsmc->audio->dts);
|
||||
muxer->update_duration(tsmc->audio_->dts_);
|
||||
|
||||
// reap when current source is pure audio.
|
||||
// it maybe changed when stream info changed,
|
||||
|
|
@ -2115,7 +2115,7 @@ srs_error_t SrsHlsController::write_audio(SrsMediaPacket *shared_audio, SrsForma
|
|||
// pure audio again for audio disabled.
|
||||
// so we reap event when the audio incoming when segment overflow.
|
||||
// we use absolutely overflow of segment to make jwplayer/ffplay happy
|
||||
if (tsmc->audio && muxer->is_segment_absolutely_overflow()) {
|
||||
if (tsmc->audio_ && muxer->is_segment_absolutely_overflow()) {
|
||||
if ((err = reap_segment()) != srs_success) {
|
||||
return srs_error_wrap(err, "hls: reap segment");
|
||||
}
|
||||
|
|
@ -2123,8 +2123,8 @@ srs_error_t SrsHlsController::write_audio(SrsMediaPacket *shared_audio, SrsForma
|
|||
|
||||
// for pure audio, aggregate some frame to one.
|
||||
// TODO: FIXME: Check whether it's necessary.
|
||||
if (muxer->pure_audio() && tsmc->audio) {
|
||||
if (dts - tsmc->audio->start_pts < SRS_CONSTS_HLS_PURE_AUDIO_AGGREGATE) {
|
||||
if (muxer->pure_audio() && tsmc->audio_) {
|
||||
if (dts - tsmc->audio_->start_pts_ < SRS_CONSTS_HLS_PURE_AUDIO_AGGREGATE) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
|
@ -2143,14 +2143,14 @@ srs_error_t SrsHlsController::write_audio(SrsMediaPacket *shared_audio, SrsForma
|
|||
srs_error_t SrsHlsController::write_video(SrsMediaPacket *shared_video, SrsFormat *format)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
SrsParsedVideoPacket *frame = format->video;
|
||||
int64_t dts = shared_video->timestamp * 90;
|
||||
SrsParsedVideoPacket *frame = format->video_;
|
||||
int64_t dts = shared_video->timestamp_ * 90;
|
||||
|
||||
// Refresh the codec ASAP.
|
||||
if (muxer->latest_vcodec() != frame->vcodec()->id) {
|
||||
if (muxer->latest_vcodec() != frame->vcodec()->id_) {
|
||||
srs_trace("HLS: Switch video codec %d(%s) to %d(%s)", muxer->latest_vcodec(), srs_video_codec_id2str(muxer->latest_vcodec()).c_str(),
|
||||
frame->vcodec()->id, srs_video_codec_id2str(frame->vcodec()->id).c_str());
|
||||
muxer->set_latest_vcodec(frame->vcodec()->id);
|
||||
frame->vcodec()->id_, srs_video_codec_id2str(frame->vcodec()->id_).c_str());
|
||||
muxer->set_latest_vcodec(frame->vcodec()->id_);
|
||||
}
|
||||
|
||||
// write video to cache.
|
||||
|
|
@ -2160,14 +2160,14 @@ srs_error_t SrsHlsController::write_video(SrsMediaPacket *shared_video, SrsForma
|
|||
|
||||
// First, update the duration of the segment, as we might reap the segment. The duration should
|
||||
// cover from the first frame to the last frame.
|
||||
muxer->update_duration(tsmc->video->dts);
|
||||
muxer->update_duration(tsmc->video_->dts_);
|
||||
|
||||
// when segment overflow, reap if possible.
|
||||
if (muxer->is_segment_overflow()) {
|
||||
// do reap ts if any of:
|
||||
// a. wait keyframe and got keyframe.
|
||||
// b. always reap when not wait keyframe.
|
||||
if (!muxer->wait_keyframe() || frame->frame_type == SrsVideoAvcFrameTypeKeyFrame) {
|
||||
if (!muxer->wait_keyframe() || frame->frame_type_ == SrsVideoAvcFrameTypeKeyFrame) {
|
||||
// reap the segment, which will also flush the video.
|
||||
if ((err = reap_segment()) != srs_success) {
|
||||
return srs_error_wrap(err, "hls: reap segment");
|
||||
|
|
@ -2309,7 +2309,7 @@ srs_error_t SrsHlsMp4Controller::on_unpublish()
|
|||
srs_error_t SrsHlsMp4Controller::write_audio(SrsMediaPacket *shared_audio, SrsFormat *format)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
SrsParsedAudioPacket *frame = format->audio;
|
||||
SrsParsedAudioPacket *frame = format->audio_;
|
||||
|
||||
// Ignore audio sequence header
|
||||
if (format->is_aac_sequence_header() || format->is_mp3_sequence_header()) {
|
||||
|
|
@ -2317,13 +2317,13 @@ srs_error_t SrsHlsMp4Controller::write_audio(SrsMediaPacket *shared_audio, SrsFo
|
|||
}
|
||||
|
||||
// Refresh the codec ASAP.
|
||||
if (muxer_->latest_acodec() != frame->acodec()->id) {
|
||||
if (muxer_->latest_acodec() != frame->acodec()->id_) {
|
||||
srs_trace("HLS: Switch audio codec %d(%s) to %d(%s)", muxer_->latest_acodec(), srs_audio_codec_id2str(muxer_->latest_acodec()).c_str(),
|
||||
frame->acodec()->id, srs_audio_codec_id2str(frame->acodec()->id).c_str());
|
||||
muxer_->set_latest_acodec(frame->acodec()->id);
|
||||
frame->acodec()->id_, srs_audio_codec_id2str(frame->acodec()->id_).c_str());
|
||||
muxer_->set_latest_acodec(frame->acodec()->id_);
|
||||
}
|
||||
|
||||
audio_dts_ = shared_audio->timestamp;
|
||||
audio_dts_ = shared_audio->timestamp_;
|
||||
|
||||
if ((err = muxer_->write_audio(shared_audio, format)) != srs_success) {
|
||||
return srs_error_wrap(err, "write audio");
|
||||
|
|
@ -2335,16 +2335,16 @@ srs_error_t SrsHlsMp4Controller::write_audio(SrsMediaPacket *shared_audio, SrsFo
|
|||
srs_error_t SrsHlsMp4Controller::write_video(SrsMediaPacket *shared_video, SrsFormat *format)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
SrsParsedVideoPacket *frame = format->video;
|
||||
SrsParsedVideoPacket *frame = format->video_;
|
||||
|
||||
// Refresh the codec ASAP.
|
||||
if (muxer_->latest_vcodec() != frame->vcodec()->id) {
|
||||
if (muxer_->latest_vcodec() != frame->vcodec()->id_) {
|
||||
srs_trace("HLS: Switch video codec %d(%s) to %d(%s)", muxer_->latest_vcodec(), srs_video_codec_id2str(muxer_->latest_vcodec()).c_str(),
|
||||
frame->vcodec()->id, srs_video_codec_id2str(frame->vcodec()->id).c_str());
|
||||
muxer_->set_latest_vcodec(frame->vcodec()->id);
|
||||
frame->vcodec()->id_, srs_video_codec_id2str(frame->vcodec()->id_).c_str());
|
||||
muxer_->set_latest_vcodec(frame->vcodec()->id_);
|
||||
}
|
||||
|
||||
video_dts_ = shared_video->timestamp;
|
||||
video_dts_ = shared_video->timestamp_;
|
||||
|
||||
if ((err = muxer_->write_video(shared_video, format)) != srs_success) {
|
||||
return srs_error_wrap(err, "write video");
|
||||
|
|
@ -2366,7 +2366,7 @@ srs_error_t SrsHlsMp4Controller::on_sequence_header(SrsMediaPacket *msg, SrsForm
|
|||
}
|
||||
|
||||
if (msg->is_audio()) {
|
||||
if (format->acodec->aac_extra_data.size() == 0) {
|
||||
if (format->acodec_->aac_extra_data_.size() == 0) {
|
||||
srs_trace("the audio codec's aac extra data is empty");
|
||||
return err;
|
||||
}
|
||||
|
|
@ -2635,7 +2635,7 @@ srs_error_t SrsHls::on_audio(SrsMediaPacket *shared_audio, SrsFormat *format)
|
|||
// Ignore if no format->acodec, it means the codec is not parsed, or unknown codec.
|
||||
// @issue https://github.com/ossrs/srs/issues/1506#issuecomment-562079474
|
||||
// TODO: format->acodec is always not-nil, remove this check.
|
||||
if (!format->acodec) {
|
||||
if (!format->acodec_) {
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -2645,13 +2645,13 @@ srs_error_t SrsHls::on_audio(SrsMediaPacket *shared_audio, SrsFormat *format)
|
|||
SrsUniquePtr<SrsMediaPacket> audio(shared_audio->copy());
|
||||
|
||||
// ts support audio codec: aac/mp3
|
||||
SrsAudioCodecId acodec = format->acodec->id;
|
||||
SrsAudioCodecId acodec = format->acodec_->id_;
|
||||
if (acodec != SrsAudioCodecIdAAC && acodec != SrsAudioCodecIdMP3) {
|
||||
return err;
|
||||
}
|
||||
|
||||
// ignore sequence header
|
||||
srs_assert(format->audio);
|
||||
srs_assert(format->audio_);
|
||||
// TODO: verify mp3 play by HLS.
|
||||
if (format->is_aac_sequence_header() || format->is_mp3_sequence_header()) {
|
||||
return controller->on_sequence_header(audio.get(), format);
|
||||
|
|
@ -2681,7 +2681,7 @@ srs_error_t SrsHls::on_video(SrsMediaPacket *shared_video, SrsFormat *format)
|
|||
|
||||
// Ignore if no format->vcodec, it means the codec is not parsed, or unknown codec.
|
||||
// @issue https://github.com/ossrs/srs/issues/1506#issuecomment-562079474
|
||||
if (!format->vcodec) {
|
||||
if (!format->vcodec_) {
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -2692,13 +2692,13 @@ srs_error_t SrsHls::on_video(SrsMediaPacket *shared_video, SrsFormat *format)
|
|||
|
||||
// ignore info frame,
|
||||
// @see https://github.com/ossrs/srs/issues/288#issuecomment-69863909
|
||||
srs_assert(format->video);
|
||||
if (format->video->frame_type == SrsVideoAvcFrameTypeVideoInfoFrame) {
|
||||
srs_assert(format->video_);
|
||||
if (format->video_->frame_type_ == SrsVideoAvcFrameTypeVideoInfoFrame) {
|
||||
return err;
|
||||
}
|
||||
|
||||
srs_assert(format->vcodec);
|
||||
if (format->vcodec->id != SrsVideoCodecIdAVC && format->vcodec->id != SrsVideoCodecIdHEVC) {
|
||||
srs_assert(format->vcodec_);
|
||||
if (format->vcodec_->id_ != SrsVideoCodecIdAVC && format->vcodec_->id_ != SrsVideoCodecIdHEVC) {
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ srs_error_t SrsHourGlass::cycle()
|
|||
srs_utime_t interval = it->second;
|
||||
|
||||
if (interval == 0 || (total_elapse % interval) == 0) {
|
||||
++_srs_pps_timer->sugar;
|
||||
++_srs_pps_timer->sugar_;
|
||||
|
||||
if ((err = handler->notify(event, interval, total_elapse)) != srs_success) {
|
||||
return srs_error_wrap(err, "notify");
|
||||
|
|
@ -179,7 +179,7 @@ srs_error_t SrsFastTimer::cycle()
|
|||
return srs_error_wrap(err, "quit");
|
||||
}
|
||||
|
||||
++_srs_pps_timer->sugar;
|
||||
++_srs_pps_timer->sugar_;
|
||||
|
||||
for (int i = 0; i < (int)handlers_.size(); i++) {
|
||||
ISrsFastTimer *timer = handlers_.at(i);
|
||||
|
|
@ -219,23 +219,23 @@ srs_error_t SrsClockWallMonitor::on_timer(srs_utime_t interval)
|
|||
clock = now;
|
||||
|
||||
if (elapsed <= 15 * SRS_UTIME_MILLISECONDS) {
|
||||
++_srs_pps_clock_15ms->sugar;
|
||||
++_srs_pps_clock_15ms->sugar_;
|
||||
} else if (elapsed <= 21 * SRS_UTIME_MILLISECONDS) {
|
||||
++_srs_pps_clock_20ms->sugar;
|
||||
++_srs_pps_clock_20ms->sugar_;
|
||||
} else if (elapsed <= 25 * SRS_UTIME_MILLISECONDS) {
|
||||
++_srs_pps_clock_25ms->sugar;
|
||||
++_srs_pps_clock_25ms->sugar_;
|
||||
} else if (elapsed <= 30 * SRS_UTIME_MILLISECONDS) {
|
||||
++_srs_pps_clock_30ms->sugar;
|
||||
++_srs_pps_clock_30ms->sugar_;
|
||||
} else if (elapsed <= 35 * SRS_UTIME_MILLISECONDS) {
|
||||
++_srs_pps_clock_35ms->sugar;
|
||||
++_srs_pps_clock_35ms->sugar_;
|
||||
} else if (elapsed <= 40 * SRS_UTIME_MILLISECONDS) {
|
||||
++_srs_pps_clock_40ms->sugar;
|
||||
++_srs_pps_clock_40ms->sugar_;
|
||||
} else if (elapsed <= 80 * SRS_UTIME_MILLISECONDS) {
|
||||
++_srs_pps_clock_80ms->sugar;
|
||||
++_srs_pps_clock_80ms->sugar_;
|
||||
} else if (elapsed <= 160 * SRS_UTIME_MILLISECONDS) {
|
||||
++_srs_pps_clock_160ms->sugar;
|
||||
++_srs_pps_clock_160ms->sugar_;
|
||||
} else {
|
||||
++_srs_pps_timer_s->sugar;
|
||||
++_srs_pps_timer_s->sugar_;
|
||||
}
|
||||
|
||||
return err;
|
||||
|
|
|
|||
|
|
@ -958,11 +958,11 @@ srs_error_t SrsLiveStream::streaming_send_messages(ISrsBufferEncoder *enc, SrsMe
|
|||
SrsMediaPacket *msg = msgs[i];
|
||||
|
||||
if (msg->is_audio()) {
|
||||
err = enc->write_audio(msg->timestamp, msg->payload(), msg->size());
|
||||
err = enc->write_audio(msg->timestamp_, msg->payload(), msg->size());
|
||||
} else if (msg->is_video()) {
|
||||
err = enc->write_video(msg->timestamp, msg->payload(), msg->size());
|
||||
err = enc->write_video(msg->timestamp_, msg->payload(), msg->size());
|
||||
} else {
|
||||
err = enc->write_metadata(msg->timestamp, msg->payload(), msg->size());
|
||||
err = enc->write_metadata(msg->timestamp_, msg->payload(), msg->size());
|
||||
}
|
||||
|
||||
if (err != srs_success) {
|
||||
|
|
|
|||
|
|
@ -463,7 +463,7 @@ int SrsUdpMuxSocket::recvfrom(srs_utime_t timeout)
|
|||
address_changed_ = true;
|
||||
|
||||
// Update the stat.
|
||||
++_srs_pps_rpkts->sugar;
|
||||
++_srs_pps_rpkts->sugar_;
|
||||
|
||||
return nread;
|
||||
}
|
||||
|
|
@ -472,7 +472,7 @@ srs_error_t SrsUdpMuxSocket::sendto(void *data, int size, srs_utime_t timeout)
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
++_srs_pps_spkts->sugar;
|
||||
++_srs_pps_spkts->sugar_;
|
||||
|
||||
int nb_write = srs_sendto(lfd, data, size, (sockaddr *)&from, fromlen, timeout);
|
||||
|
||||
|
|
@ -576,7 +576,7 @@ std::string SrsUdpMuxSocket::peer_id()
|
|||
peer_id_ = string(id_buf, len);
|
||||
|
||||
// Update the stat.
|
||||
++_srs_pps_addrs->sugar;
|
||||
++_srs_pps_addrs->sugar_;
|
||||
}
|
||||
|
||||
return peer_id_;
|
||||
|
|
@ -584,7 +584,7 @@ std::string SrsUdpMuxSocket::peer_id()
|
|||
|
||||
uint64_t SrsUdpMuxSocket::fast_id()
|
||||
{
|
||||
++_srs_pps_fast_addrs->sugar;
|
||||
++_srs_pps_fast_addrs->sugar_;
|
||||
return fast_id_;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,15 +98,15 @@ srs_error_t SrsMpegtsQueue::push(SrsMediaPacket *msg)
|
|||
|
||||
// TODO: FIXME: use right way.
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (msgs.find(msg->timestamp) == msgs.end()) {
|
||||
if (msgs.find(msg->timestamp_) == msgs.end()) {
|
||||
break;
|
||||
}
|
||||
|
||||
// adjust the ts, add 1ms.
|
||||
msg->timestamp += 1;
|
||||
msg->timestamp_ += 1;
|
||||
|
||||
if (i >= 100) {
|
||||
srs_warn("mpegts: free the msg for dts exists, dts=%" PRId64, msg->timestamp);
|
||||
srs_warn("mpegts: free the msg for dts exists, dts=%" PRId64, msg->timestamp_);
|
||||
srs_freep(msg);
|
||||
return err;
|
||||
}
|
||||
|
|
@ -120,7 +120,7 @@ srs_error_t SrsMpegtsQueue::push(SrsMediaPacket *msg)
|
|||
nb_videos++;
|
||||
}
|
||||
|
||||
msgs[msg->timestamp] = msg;
|
||||
msgs[msg->timestamp_] = msg;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
@ -327,8 +327,8 @@ srs_error_t SrsMpegtsOverUdp::on_ts_message(SrsTsMessage *msg)
|
|||
|
||||
if (pprint->can_print()) {
|
||||
srs_trace("<- " SRS_CONSTS_LOG_STREAM_CASTER " mpegts: got %s age=%d stream=%s, dts=%" PRId64 ", pts=%" PRId64 ", size=%d, us=%d, cc=%d, sid=%#x(%s-%d)",
|
||||
(msg->channel->apply == SrsTsPidApplyVideo) ? "Video" : "Audio", pprint->age(), srs_ts_stream2string(msg->channel->stream).c_str(),
|
||||
msg->dts, msg->pts, msg->payload->length(), msg->packet->payload_unit_start_indicator, msg->continuity_counter, msg->sid,
|
||||
(msg->channel_->apply_ == SrsTsPidApplyVideo) ? "Video" : "Audio", pprint->age(), srs_ts_stream2string(msg->channel_->stream_).c_str(),
|
||||
msg->dts_, msg->pts_, msg->payload_->length(), msg->packet_->payload_unit_start_indicator_, msg->continuity_counter_, msg->sid_,
|
||||
msg->is_audio() ? "A" : msg->is_video() ? "V"
|
||||
: "N",
|
||||
msg->stream_number());
|
||||
|
|
@ -336,33 +336,33 @@ srs_error_t SrsMpegtsOverUdp::on_ts_message(SrsTsMessage *msg)
|
|||
|
||||
// When the audio SID is private stream 1, we use common audio.
|
||||
// @see https://github.com/ossrs/srs/issues/740
|
||||
if (msg->channel->apply == SrsTsPidApplyAudio && msg->sid == SrsTsPESStreamIdPrivateStream1) {
|
||||
msg->sid = SrsTsPESStreamIdAudioCommon;
|
||||
if (msg->channel_->apply_ == SrsTsPidApplyAudio && msg->sid_ == SrsTsPESStreamIdPrivateStream1) {
|
||||
msg->sid_ = SrsTsPESStreamIdAudioCommon;
|
||||
}
|
||||
|
||||
// when not audio/video, or not adts/annexb format, donot support.
|
||||
if (msg->stream_number() != 0) {
|
||||
return srs_error_new(ERROR_STREAM_CASTER_TS_ES, "ts: unsupported stream format, sid=%#x(%s-%d)",
|
||||
msg->sid, msg->is_audio() ? "A" : msg->is_video() ? "V"
|
||||
: "N",
|
||||
msg->sid_, msg->is_audio() ? "A" : msg->is_video() ? "V"
|
||||
: "N",
|
||||
msg->stream_number());
|
||||
}
|
||||
|
||||
// check supported codec
|
||||
if (msg->channel->stream != SrsTsStreamVideoH264 && msg->channel->stream != SrsTsStreamAudioAAC) {
|
||||
return srs_error_new(ERROR_STREAM_CASTER_TS_CODEC, "ts: unsupported stream codec=%d", msg->channel->stream);
|
||||
if (msg->channel_->stream_ != SrsTsStreamVideoH264 && msg->channel_->stream_ != SrsTsStreamAudioAAC) {
|
||||
return srs_error_new(ERROR_STREAM_CASTER_TS_CODEC, "ts: unsupported stream codec=%d", msg->channel_->stream_);
|
||||
}
|
||||
|
||||
// parse the stream.
|
||||
SrsBuffer avs(msg->payload->bytes(), msg->payload->length());
|
||||
SrsBuffer avs(msg->payload_->bytes(), msg->payload_->length());
|
||||
|
||||
// publish audio or video.
|
||||
if (msg->channel->stream == SrsTsStreamVideoH264) {
|
||||
if (msg->channel_->stream_ == SrsTsStreamVideoH264) {
|
||||
if ((err = on_ts_video(msg, &avs)) != srs_success) {
|
||||
return srs_error_wrap(err, "ts: consume video");
|
||||
}
|
||||
}
|
||||
if (msg->channel->stream == SrsTsStreamAudioAAC) {
|
||||
if (msg->channel_->stream_ == SrsTsStreamAudioAAC) {
|
||||
if ((err = on_ts_audio(msg, &avs)) != srs_success) {
|
||||
return srs_error_wrap(err, "ts: consume audio");
|
||||
}
|
||||
|
|
@ -382,8 +382,8 @@ srs_error_t SrsMpegtsOverUdp::on_ts_video(SrsTsMessage *msg, SrsBuffer *avs)
|
|||
}
|
||||
|
||||
// ts tbn to flv tbn.
|
||||
uint32_t dts = (uint32_t)(msg->dts / 90);
|
||||
uint32_t pts = (uint32_t)(msg->dts / 90);
|
||||
uint32_t dts = (uint32_t)(msg->dts_ / 90);
|
||||
uint32_t pts = (uint32_t)(msg->dts_ / 90);
|
||||
|
||||
// send each frame.
|
||||
while (!avs->empty()) {
|
||||
|
|
@ -540,7 +540,7 @@ srs_error_t SrsMpegtsOverUdp::on_ts_audio(SrsTsMessage *msg, SrsBuffer *avs)
|
|||
}
|
||||
|
||||
// ts tbn to flv tbn.
|
||||
uint32_t dts = (uint32_t)(msg->dts / 90);
|
||||
uint32_t dts = (uint32_t)(msg->dts_ / 90);
|
||||
|
||||
// send each frame.
|
||||
while (!avs->empty()) {
|
||||
|
|
@ -629,7 +629,7 @@ srs_error_t SrsMpegtsOverUdp::rtmp_write_packet(char type, uint32_t timestamp, c
|
|||
srs_trace("mpegts: send msg %s age=%d, dts=%" PRId64 ", size=%d",
|
||||
msg->is_audio() ? "A" : msg->is_video() ? "V"
|
||||
: "N",
|
||||
pprint->age(), msg->timestamp, msg->size());
|
||||
pprint->age(), msg->timestamp_, msg->size());
|
||||
}
|
||||
|
||||
// send out encoded msg.
|
||||
|
|
|
|||
|
|
@ -360,13 +360,13 @@ srs_error_t SrsPublishRecvThread::consume(SrsRtmpCommonMessage *msg)
|
|||
|
||||
_nb_msgs++;
|
||||
|
||||
if (msg->header.is_video()) {
|
||||
if (msg->header_.is_video()) {
|
||||
video_frames++;
|
||||
}
|
||||
|
||||
// log to show the time of recv thread.
|
||||
srs_verbose("recv thread now=%" PRId64 "us, got msg time=%" PRId64 "ms, size=%d",
|
||||
srs_time_now_realtime(), msg->header.timestamp, msg->size);
|
||||
srs_time_now_realtime(), msg->header_.timestamp, msg->size);
|
||||
|
||||
// the rtmp connection will handle this message
|
||||
err = _conn->handle_publish_message(source_, msg);
|
||||
|
|
|
|||
|
|
@ -179,8 +179,8 @@ void SrsAudioTranscoder::free_frames(std::vector<SrsParsedAudioPacket *> &frames
|
|||
for (std::vector<SrsParsedAudioPacket *>::iterator it = frames.begin(); it != frames.end(); ++it) {
|
||||
SrsParsedAudioPacket *p = *it;
|
||||
|
||||
for (int i = 0; i < p->nb_samples; i++) {
|
||||
char *pa = p->samples[i].bytes;
|
||||
for (int i = 0; i < p->nb_samples_; i++) {
|
||||
char *pa = p->samples_[i].bytes_;
|
||||
srs_freepa(pa);
|
||||
}
|
||||
|
||||
|
|
@ -329,8 +329,8 @@ srs_error_t SrsAudioTranscoder::decode_and_resample(SrsParsedAudioPacket *pkt)
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
dec_packet_->data = (uint8_t *)pkt->samples[0].bytes;
|
||||
dec_packet_->size = pkt->samples[0].size;
|
||||
dec_packet_->data = (uint8_t *)pkt->samples_[0].bytes_;
|
||||
dec_packet_->size = pkt->samples_[0].size_;
|
||||
|
||||
// Ignore empty packet, see https://github.com/ossrs/srs/pull/2757#discussion_r759797651
|
||||
if (!dec_packet_->data || !dec_packet_->size) {
|
||||
|
|
@ -344,7 +344,7 @@ srs_error_t SrsAudioTranscoder::decode_and_resample(SrsParsedAudioPacket *pkt)
|
|||
av_make_error_string(err_buf, AV_ERROR_MAX_STRING_SIZE, error));
|
||||
}
|
||||
|
||||
new_pkt_pts_ = pkt->dts + pkt->cts;
|
||||
new_pkt_pts_ = pkt->dts_ + pkt->cts_;
|
||||
while (error >= 0) {
|
||||
error = avcodec_receive_frame(dec_, dec_frame_);
|
||||
if (error == AVERROR(EAGAIN) || error == AVERROR_EOF) {
|
||||
|
|
@ -439,8 +439,8 @@ srs_error_t SrsAudioTranscoder::encode(std::vector<SrsParsedAudioPacket *> &pkts
|
|||
char *buf = new char[enc_packet_->size];
|
||||
memcpy(buf, enc_packet_->data, enc_packet_->size);
|
||||
out_frame->add_sample(buf, enc_packet_->size);
|
||||
out_frame->dts = enc_packet_->dts;
|
||||
out_frame->cts = enc_packet_->pts - enc_packet_->dts;
|
||||
out_frame->dts_ = enc_packet_->dts;
|
||||
out_frame->cts_ = enc_packet_->pts - enc_packet_->dts;
|
||||
pkts.push_back(out_frame);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ srs_error_t SrsSecurityTransport::write_dtls_data(void *data, int size)
|
|||
return err;
|
||||
}
|
||||
|
||||
++_srs_pps_sstuns->sugar;
|
||||
++_srs_pps_sstuns->sugar_;
|
||||
|
||||
if ((err = network_->write(data, size, NULL)) != srs_success) {
|
||||
return srs_error_wrap(err, "send dtls packet");
|
||||
|
|
@ -352,7 +352,7 @@ srs_error_t SrsRtcPLIWorker::cycle()
|
|||
uint32_t ssrc = it->first;
|
||||
SrsContextId cid = it->second;
|
||||
|
||||
++_srs_pps_pli->sugar;
|
||||
++_srs_pps_pli->sugar_;
|
||||
|
||||
if ((err = handler_->do_request_keyframe(ssrc, cid)) != srs_success) {
|
||||
srs_warn("PLI error, %s", srs_error_desc(err).c_str());
|
||||
|
|
@ -822,7 +822,7 @@ srs_error_t SrsRtcPlayStream::on_rtcp_nack(SrsRtcpNack *rtcp)
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
++_srs_pps_rnack->sugar;
|
||||
++_srs_pps_rnack->sugar_;
|
||||
|
||||
uint32_t ssrc = rtcp->get_media_ssrc();
|
||||
|
||||
|
|
@ -951,14 +951,14 @@ srs_error_t SrsRtcPublishRtcpTimer::on_timer(srs_utime_t interval)
|
|||
// to prevent it from being freed.
|
||||
SrsLocker(&lock_);
|
||||
|
||||
++_srs_pps_pub->sugar;
|
||||
++_srs_pps_pub->sugar_;
|
||||
|
||||
if (!p_->is_started) {
|
||||
return err;
|
||||
}
|
||||
|
||||
// For RR and RRTR.
|
||||
++_srs_pps_rr->sugar;
|
||||
++_srs_pps_rr->sugar_;
|
||||
|
||||
if ((err = p_->send_rtcp_rr()) != srs_success) {
|
||||
srs_warn("RR err %s", srs_error_desc(err).c_str());
|
||||
|
|
@ -998,7 +998,7 @@ srs_error_t SrsRtcPublishTwccTimer::on_timer(srs_utime_t interval)
|
|||
// to prevent it from being freed.
|
||||
SrsLocker(&lock_);
|
||||
|
||||
++_srs_pps_pub->sugar;
|
||||
++_srs_pps_pub->sugar_;
|
||||
|
||||
if (!p_->is_started) {
|
||||
return err;
|
||||
|
|
@ -1009,11 +1009,11 @@ srs_error_t SrsRtcPublishTwccTimer::on_timer(srs_utime_t interval)
|
|||
return err;
|
||||
}
|
||||
|
||||
++_srs_pps_twcc->sugar;
|
||||
++_srs_pps_twcc->sugar_;
|
||||
|
||||
// If circuit-breaker is dropping packet, disable TWCC.
|
||||
if (_srs_circuit_breaker->hybrid_critical_water_level()) {
|
||||
++_srs_pps_snack4->sugar;
|
||||
++_srs_pps_snack4->sugar_;
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -1445,12 +1445,12 @@ srs_error_t SrsRtcPublishStream::do_on_rtp_plaintext(SrsRtpPacket *&pkt, SrsBuff
|
|||
SrsRtcAudioRecvTrack *audio_track = get_audio_track(ssrc);
|
||||
SrsRtcVideoRecvTrack *video_track = get_video_track(ssrc);
|
||||
if (audio_track) {
|
||||
pkt->frame_type = SrsFrameTypeAudio;
|
||||
pkt->frame_type_ = SrsFrameTypeAudio;
|
||||
if ((err = audio_track->on_rtp(source_, pkt)) != srs_success) {
|
||||
return srs_error_wrap(err, "on audio");
|
||||
}
|
||||
} else if (video_track) {
|
||||
pkt->frame_type = SrsFrameTypeVideo;
|
||||
pkt->frame_type_ = SrsFrameTypeVideo;
|
||||
if ((err = video_track->on_rtp(source_, pkt)) != srs_success) {
|
||||
return srs_error_wrap(err, "on video");
|
||||
}
|
||||
|
|
@ -1460,7 +1460,7 @@ srs_error_t SrsRtcPublishStream::do_on_rtp_plaintext(SrsRtpPacket *&pkt, SrsBuff
|
|||
|
||||
// If circuit-breaker is enabled, disable nack.
|
||||
if (_srs_circuit_breaker->hybrid_critical_water_level()) {
|
||||
++_srs_pps_snack4->sugar;
|
||||
++_srs_pps_snack4->sugar_;
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -1542,7 +1542,7 @@ srs_error_t SrsRtcPublishStream::send_periodic_twcc()
|
|||
return err;
|
||||
}
|
||||
|
||||
++_srs_pps_srtcps->sugar;
|
||||
++_srs_pps_srtcps->sugar_;
|
||||
|
||||
// limit the max count=1024 to avoid dead loop.
|
||||
for (int i = 0; i < 1024 && rtcp_twcc_.need_feedback(); ++i) {
|
||||
|
|
@ -1772,11 +1772,11 @@ srs_error_t SrsRtcConnectionNackTimer::on_timer(srs_utime_t interval)
|
|||
return err;
|
||||
}
|
||||
|
||||
++_srs_pps_conn->sugar;
|
||||
++_srs_pps_conn->sugar_;
|
||||
|
||||
// If circuit-breaker is enabled, disable nack.
|
||||
if (_srs_circuit_breaker->hybrid_critical_water_level()) {
|
||||
++_srs_pps_snack4->sugar;
|
||||
++_srs_pps_snack4->sugar_;
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -2315,7 +2315,7 @@ srs_error_t SrsRtcConnection::send_rtcp(char *data, int nb_data)
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
++_srs_pps_srtcps->sugar;
|
||||
++_srs_pps_srtcps->sugar_;
|
||||
|
||||
int nb_buf = nb_data;
|
||||
if ((err = networks_->available()->protect_rtcp(data, &nb_buf)) != srs_success) {
|
||||
|
|
@ -2331,7 +2331,7 @@ srs_error_t SrsRtcConnection::send_rtcp(char *data, int nb_data)
|
|||
|
||||
void SrsRtcConnection::check_send_nacks(SrsRtpNackForReceiver *nack, uint32_t ssrc, uint32_t &sent_nacks, uint32_t &timeout_nacks)
|
||||
{
|
||||
++_srs_pps_snack->sugar;
|
||||
++_srs_pps_snack->sugar_;
|
||||
|
||||
SrsRtcpNack rtcpNack(ssrc);
|
||||
|
||||
|
|
@ -2342,8 +2342,8 @@ void SrsRtcConnection::check_send_nacks(SrsRtpNackForReceiver *nack, uint32_t ss
|
|||
return;
|
||||
}
|
||||
|
||||
++_srs_pps_snack2->sugar;
|
||||
++_srs_pps_srtcps->sugar;
|
||||
++_srs_pps_snack2->sugar_;
|
||||
++_srs_pps_srtcps->sugar_;
|
||||
|
||||
char buf[kRtcpPacketSize];
|
||||
SrsBuffer stream(buf, sizeof(buf));
|
||||
|
|
@ -2357,7 +2357,7 @@ void SrsRtcConnection::check_send_nacks(SrsRtpNackForReceiver *nack, uint32_t ss
|
|||
|
||||
srs_error_t SrsRtcConnection::send_rtcp_rr(uint32_t ssrc, SrsRtpRingBuffer *rtp_queue, const uint64_t &last_send_systime, const SrsNtp &last_send_ntp)
|
||||
{
|
||||
++_srs_pps_srtcps->sugar;
|
||||
++_srs_pps_srtcps->sugar_;
|
||||
|
||||
// @see https://tools.ietf.org/html/rfc3550#section-6.4.2
|
||||
char buf[kRtpPacketSize];
|
||||
|
|
@ -2397,7 +2397,7 @@ srs_error_t SrsRtcConnection::send_rtcp_rr(uint32_t ssrc, SrsRtpRingBuffer *rtp_
|
|||
|
||||
srs_error_t SrsRtcConnection::send_rtcp_xr_rrtr(uint32_t ssrc)
|
||||
{
|
||||
++_srs_pps_srtcps->sugar;
|
||||
++_srs_pps_srtcps->sugar_;
|
||||
|
||||
/*
|
||||
@see: http://www.rfc-editor.org/rfc/rfc3611.html#section-2
|
||||
|
|
@ -2444,7 +2444,7 @@ srs_error_t SrsRtcConnection::send_rtcp_xr_rrtr(uint32_t ssrc)
|
|||
|
||||
srs_error_t SrsRtcConnection::send_rtcp_fb_pli(uint32_t ssrc, const SrsContextId &cid_of_subscriber)
|
||||
{
|
||||
++_srs_pps_srtcps->sugar;
|
||||
++_srs_pps_srtcps->sugar_;
|
||||
|
||||
char buf[kRtpPacketSize];
|
||||
SrsBuffer stream(buf, sizeof(buf));
|
||||
|
|
@ -2519,7 +2519,7 @@ srs_error_t SrsRtcConnection::do_send_packet(SrsRtpPacket *pkt)
|
|||
return err;
|
||||
}
|
||||
|
||||
++_srs_pps_srtps->sugar;
|
||||
++_srs_pps_srtps->sugar_;
|
||||
|
||||
if ((err = networks_->available()->write(iov->iov_base, iov->iov_len, NULL)) != srs_success) {
|
||||
srs_warn("RTC: Write %d bytes err %s", iov->iov_len, srs_error_desc(err).c_str());
|
||||
|
|
@ -2562,7 +2562,7 @@ srs_error_t SrsRtcConnection::on_binding_request(SrsStunPacket *r, string &ice_p
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
++_srs_pps_sstuns->sugar;
|
||||
++_srs_pps_sstuns->sugar_;
|
||||
|
||||
bool strict_check = _srs_config->get_rtc_stun_strict_check(req_->vhost);
|
||||
if (strict_check && r->get_ice_controlled()) {
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ void SrsRtpNackForReceiver::insert(uint16_t first, uint16_t last)
|
|||
{
|
||||
// If circuit-breaker is enabled, disable nack.
|
||||
if (_srs_circuit_breaker->hybrid_high_water_level()) {
|
||||
++_srs_pps_snack4->sugar;
|
||||
++_srs_pps_snack4->sugar_;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -255,7 +255,7 @@ void SrsRtpNackForReceiver::get_nack_seqs(SrsRtcpNack &seqs, uint32_t &timeout_n
|
|||
// If circuit-breaker is enabled, disable nack.
|
||||
if (_srs_circuit_breaker->hybrid_high_water_level()) {
|
||||
queue_.clear();
|
||||
++_srs_pps_snack4->sugar;
|
||||
++_srs_pps_snack4->sugar_;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -538,8 +538,8 @@ void SrsRtcSessionManager::srs_update_rtc_sessions()
|
|||
|
||||
srs_trace("RTC: Server conns=%u%s%s%s%s%s%s%s",
|
||||
nn_rtc_conns,
|
||||
stats.rpkts_desc.c_str(), stats.spkts_desc.c_str(), stats.rtcp_desc.c_str(), stats.snk_desc.c_str(),
|
||||
stats.rnk_desc.c_str(), loss_desc.c_str(), stats.fid_desc.c_str());
|
||||
stats.rpkts_desc_.c_str(), stats.spkts_desc_.c_str(), stats.rtcp_desc_.c_str(), stats.snk_desc_.c_str(),
|
||||
stats.rnk_desc_.c_str(), loss_desc.c_str(), stats.fid_desc_.c_str());
|
||||
}
|
||||
|
||||
srs_error_t SrsRtcSessionManager::exec_rtc_async_work(ISrsAsyncCallTask *t)
|
||||
|
|
@ -574,7 +574,7 @@ srs_error_t SrsRtcSessionManager::on_udp_packet(SrsUdpMuxSocket *skt)
|
|||
|
||||
// For STUN, the peer address may change.
|
||||
if (!is_rtp_or_rtcp && srs_is_stun((uint8_t *)data, size)) {
|
||||
++_srs_pps_rstuns->sugar;
|
||||
++_srs_pps_rstuns->sugar_;
|
||||
string peer_id = skt->peer_id();
|
||||
|
||||
// TODO: FIXME: Should support ICE renomination, to switch network between candidates.
|
||||
|
|
@ -614,7 +614,7 @@ srs_error_t SrsRtcSessionManager::on_udp_packet(SrsUdpMuxSocket *skt)
|
|||
|
||||
// Note that we don't(except error) switch to the context of session, for performance issue.
|
||||
if (is_rtp_or_rtcp && !is_rtcp) {
|
||||
++_srs_pps_rrtps->sugar;
|
||||
++_srs_pps_rrtps->sugar_;
|
||||
|
||||
err = session->udp()->on_rtp(data, size);
|
||||
if (err != srs_success) {
|
||||
|
|
@ -625,12 +625,12 @@ srs_error_t SrsRtcSessionManager::on_udp_packet(SrsUdpMuxSocket *skt)
|
|||
|
||||
session->switch_to_context();
|
||||
if (is_rtp_or_rtcp && is_rtcp) {
|
||||
++_srs_pps_rrtcps->sugar;
|
||||
++_srs_pps_rrtcps->sugar_;
|
||||
|
||||
return session->udp()->on_rtcp(data, size);
|
||||
}
|
||||
if (srs_is_dtls((uint8_t *)data, size)) {
|
||||
++_srs_pps_rstuns->sugar;
|
||||
++_srs_pps_rstuns->sugar_;
|
||||
|
||||
return session->udp()->on_dtls(data, size);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,29 +77,29 @@ srs_error_t aac_raw_append_adts_header(SrsMediaPacket *shared_audio, SrsFormat *
|
|||
}
|
||||
|
||||
// If no audio RAW frame, or not parsed for no sequence header, drop the packet.
|
||||
if (format->audio->nb_samples == 0) {
|
||||
if (format->audio_->nb_samples_ == 0) {
|
||||
srs_warn("RTC: Drop AAC %d bytes for no sample", shared_audio->size());
|
||||
return err;
|
||||
}
|
||||
|
||||
if (format->audio->nb_samples != 1) {
|
||||
return srs_error_new(ERROR_RTC_RTP_MUXER, "adts samples=%d", format->audio->nb_samples);
|
||||
if (format->audio_->nb_samples_ != 1) {
|
||||
return srs_error_new(ERROR_RTC_RTP_MUXER, "adts samples=%d", format->audio_->nb_samples_);
|
||||
}
|
||||
|
||||
int nb_buf = format->audio->samples[0].size + 7;
|
||||
int nb_buf = format->audio_->samples_[0].size_ + 7;
|
||||
char *buf = new char[nb_buf];
|
||||
SrsBuffer stream(buf, nb_buf);
|
||||
|
||||
// TODO: Add comment.
|
||||
stream.write_1bytes(0xFF);
|
||||
stream.write_1bytes(0xF9);
|
||||
stream.write_1bytes(((format->acodec->aac_object - 1) << 6) | ((format->acodec->aac_sample_rate & 0x0F) << 2) | ((format->acodec->aac_channels & 0x04) >> 2));
|
||||
stream.write_1bytes(((format->acodec->aac_channels & 0x03) << 6) | ((nb_buf >> 11) & 0x03));
|
||||
stream.write_1bytes(((format->acodec_->aac_object_ - 1) << 6) | ((format->acodec_->aac_sample_rate_ & 0x0F) << 2) | ((format->acodec_->aac_channels_ & 0x04) >> 2));
|
||||
stream.write_1bytes(((format->acodec_->aac_channels_ & 0x03) << 6) | ((nb_buf >> 11) & 0x03));
|
||||
stream.write_1bytes((nb_buf >> 3) & 0xFF);
|
||||
stream.write_1bytes(((nb_buf & 0x07) << 5) | 0x1F);
|
||||
stream.write_1bytes(0xFC);
|
||||
|
||||
stream.write_bytes(format->audio->samples[0].bytes, format->audio->samples[0].size);
|
||||
stream.write_bytes(format->audio_->samples_[0].bytes_, format->audio_->samples_[0].size_);
|
||||
|
||||
*pbuf = buf;
|
||||
*pnn_buf = nb_buf;
|
||||
|
|
@ -778,7 +778,7 @@ srs_error_t SrsRtcSource::on_rtp(SrsRtpPacket *pkt)
|
|||
|
||||
// If circuit-breaker is dying, drop packet.
|
||||
if (_srs_circuit_breaker->hybrid_dying_water_level()) {
|
||||
_srs_pps_aloss2->sugar += (int64_t)consumers.size();
|
||||
_srs_pps_aloss2->sugar_ += (int64_t)consumers.size();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -975,7 +975,7 @@ srs_error_t SrsRtcRtpBuilder::initialize(ISrsRequest *r)
|
|||
}
|
||||
|
||||
// Setup the SPS/PPS parsing strategy.
|
||||
format->try_annexb_first = _srs_config->try_annexb_first(r->vhost);
|
||||
format->try_annexb_first_ = _srs_config->try_annexb_first(r->vhost);
|
||||
|
||||
keep_bframe = _srs_config->get_rtc_keep_bframe(req->vhost);
|
||||
keep_avc_nalu_sei = _srs_config->get_rtc_keep_avc_nalu_sei(req->vhost);
|
||||
|
|
@ -1025,18 +1025,18 @@ srs_error_t SrsRtcRtpBuilder::on_audio(SrsMediaPacket *msg)
|
|||
}
|
||||
|
||||
// Try to init codec when startup or codec changed.
|
||||
if (format->acodec && (err = init_codec(format->acodec->id)) != srs_success) {
|
||||
if (format->acodec_ && (err = init_codec(format->acodec_->id_)) != srs_success) {
|
||||
return srs_error_wrap(err, "init codec");
|
||||
}
|
||||
|
||||
// Ignore if no format->acodec, it means the codec is not parsed, or unknown codec.
|
||||
// @issue https://github.com/ossrs/srs/issues/1506#issuecomment-562079474
|
||||
if (!format->acodec) {
|
||||
if (!format->acodec_) {
|
||||
return err;
|
||||
}
|
||||
|
||||
// support audio codec: aac/mp3
|
||||
SrsAudioCodecId acodec = format->acodec->id;
|
||||
SrsAudioCodecId acodec = format->acodec_->id_;
|
||||
if (acodec != SrsAudioCodecIdAAC && acodec != SrsAudioCodecIdMP3) {
|
||||
return err;
|
||||
}
|
||||
|
|
@ -1050,10 +1050,10 @@ srs_error_t SrsRtcRtpBuilder::on_audio(SrsMediaPacket *msg)
|
|||
}
|
||||
|
||||
// ignore sequence header
|
||||
srs_assert(format->audio);
|
||||
srs_assert(format->audio_);
|
||||
|
||||
if (format->acodec->id == SrsAudioCodecIdMP3) {
|
||||
return transcode(format->audio);
|
||||
if (format->acodec_->id_ == SrsAudioCodecIdMP3) {
|
||||
return transcode(format->audio_);
|
||||
}
|
||||
|
||||
// When drop aac audio packet, never transcode.
|
||||
|
|
@ -1073,8 +1073,8 @@ srs_error_t SrsRtcRtpBuilder::on_audio(SrsMediaPacket *msg)
|
|||
}
|
||||
|
||||
SrsParsedAudioPacket aac;
|
||||
aac.dts = format->audio->dts;
|
||||
aac.cts = format->audio->cts;
|
||||
aac.dts_ = format->audio_->dts_;
|
||||
aac.cts_ = format->audio_->cts_;
|
||||
if ((err = aac.add_sample(adts_audio, nn_adts_audio)) == srs_success) {
|
||||
// If OK, transcode the AAC to Opus and consume it.
|
||||
err = transcode(&aac);
|
||||
|
|
@ -1155,17 +1155,17 @@ srs_error_t SrsRtcRtpBuilder::package_opus(SrsParsedAudioPacket *audio, SrsRtpPa
|
|||
|
||||
pkt->header.set_payload_type(audio_payload_type_);
|
||||
pkt->header.set_ssrc(audio_ssrc_);
|
||||
pkt->frame_type = SrsFrameTypeAudio;
|
||||
pkt->frame_type_ = SrsFrameTypeAudio;
|
||||
pkt->header.set_marker(true);
|
||||
pkt->header.set_sequence(audio_sequence++);
|
||||
pkt->header.set_timestamp(audio->dts * 48);
|
||||
pkt->header.set_timestamp(audio->dts_ * 48);
|
||||
|
||||
SrsRtpRawPayload *raw = new SrsRtpRawPayload();
|
||||
pkt->set_payload(raw, SrsRtpPacketPayloadTypeRaw);
|
||||
|
||||
srs_assert(audio->nb_samples == 1);
|
||||
raw->payload = pkt->wrap(audio->samples[0].bytes, audio->samples[0].size);
|
||||
raw->nn_payload = audio->samples[0].size;
|
||||
srs_assert(audio->nb_samples_ == 1);
|
||||
raw->payload_ = pkt->wrap(audio->samples_[0].bytes_, audio->samples_[0].size_);
|
||||
raw->nn_payload_ = audio->samples_[0].size_;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
@ -1197,12 +1197,12 @@ srs_error_t SrsRtcRtpBuilder::on_video(SrsMediaPacket *msg)
|
|||
|
||||
// Ignore if no format->vcodec, it means the codec is not parsed, or unsupport/unknown codec
|
||||
// such as H.263 codec
|
||||
if (!format->vcodec) {
|
||||
if (!format->vcodec_) {
|
||||
return err;
|
||||
}
|
||||
|
||||
// support video codec: h264/h265
|
||||
SrsVideoCodecId vcodec = format->vcodec->id;
|
||||
SrsVideoCodecId vcodec = format->vcodec_->id_;
|
||||
if (vcodec != SrsVideoCodecIdAVC && vcodec != SrsVideoCodecIdHEVC) {
|
||||
return err;
|
||||
}
|
||||
|
|
@ -1249,7 +1249,7 @@ srs_error_t SrsRtcRtpBuilder::on_video(SrsMediaPacket *msg)
|
|||
for (int i = 0; i < nn_samples; i++) {
|
||||
SrsNaluSample *sample = samples[i];
|
||||
|
||||
if (sample->size <= kRtpMaxPayloadSize) {
|
||||
if (sample->size_ <= kRtpMaxPayloadSize) {
|
||||
if ((err = package_single_nalu(msg, sample, pkts)) != srs_success) {
|
||||
return srs_error_wrap(err, "package single nalu");
|
||||
}
|
||||
|
|
@ -1273,15 +1273,15 @@ srs_error_t SrsRtcRtpBuilder::filter(SrsMediaPacket *msg, SrsFormat *format, boo
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
// If IDR, we will insert SPS/PPS before IDR frame.
|
||||
if (format->video && format->video->has_idr) {
|
||||
if (format->video_ && format->video_->has_idr_) {
|
||||
has_idr = true;
|
||||
}
|
||||
|
||||
// Update samples to shared frame.
|
||||
for (int i = 0; i < format->video->nb_samples; ++i) {
|
||||
SrsNaluSample *sample = &format->video->samples[i];
|
||||
for (int i = 0; i < format->video_->nb_samples_; ++i) {
|
||||
SrsNaluSample *sample = &format->video_->samples_[i];
|
||||
|
||||
if (!keep_avc_nalu_sei && format->vcodec->id == SrsVideoCodecIdAVC) {
|
||||
if (!keep_avc_nalu_sei && format->vcodec_->id_ == SrsVideoCodecIdAVC) {
|
||||
SrsAvcNaluType avc_nalu_type;
|
||||
|
||||
if ((err = SrsParsedVideoPacket::parse_avc_nalu_type(sample, avc_nalu_type)) != srs_success) {
|
||||
|
|
@ -1297,11 +1297,11 @@ srs_error_t SrsRtcRtpBuilder::filter(SrsMediaPacket *msg, SrsFormat *format, boo
|
|||
// TODO: Drop B-frame in better way, which not cause picture corruption.
|
||||
if (!keep_bframe) {
|
||||
bool is_b_frame = false;
|
||||
if (format->vcodec->id == SrsVideoCodecIdAVC) {
|
||||
if (format->vcodec_->id_ == SrsVideoCodecIdAVC) {
|
||||
if ((err = SrsParsedVideoPacket::parse_avc_bframe(sample, is_b_frame)) != srs_success) {
|
||||
return srs_error_wrap(err, "parse bframe");
|
||||
}
|
||||
} else if (format->vcodec->id == SrsVideoCodecIdHEVC) {
|
||||
} else if (format->vcodec_->id_ == SrsVideoCodecIdHEVC) {
|
||||
if ((err = SrsParsedVideoPacket::parse_hevc_bframe(sample, format, is_b_frame)) != srs_success) {
|
||||
return srs_error_wrap(err, "parse bframe");
|
||||
}
|
||||
|
|
@ -1322,7 +1322,7 @@ srs_error_t SrsRtcRtpBuilder::package_stap_a(SrsMediaPacket *msg, SrsRtpPacket *
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
SrsFormat *format = meta->vsh_format();
|
||||
if (!format || !format->vcodec) {
|
||||
if (!format || !format->vcodec_) {
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -1334,7 +1334,7 @@ srs_error_t SrsRtcRtpBuilder::package_nalus(SrsMediaPacket *msg, const vector<Sr
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
SrsFormat *format = meta->vsh_format();
|
||||
if (!format || !format->vcodec) {
|
||||
if (!format || !format->vcodec_) {
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -1352,7 +1352,7 @@ srs_error_t SrsRtcRtpBuilder::package_fu_a(SrsMediaPacket *msg, SrsNaluSample *s
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
SrsFormat *format = meta->vsh_format();
|
||||
if (!format || !format->vcodec) {
|
||||
if (!format || !format->vcodec_) {
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -1514,11 +1514,11 @@ bool SrsRtcFrameBuilderVideoPacketCache::check_frame_complete(const uint16_t sta
|
|||
if (!fua_payload)
|
||||
continue;
|
||||
|
||||
if (fua_payload->start) {
|
||||
if (fua_payload->start_) {
|
||||
++nn_fu_start;
|
||||
}
|
||||
|
||||
if (fua_payload->end) {
|
||||
if (fua_payload->end_) {
|
||||
++nn_fu_end;
|
||||
}
|
||||
}
|
||||
|
|
@ -1882,9 +1882,9 @@ srs_error_t SrsRtcFrameBuilder::transcode_audio(SrsRtpPacket *pkt)
|
|||
SrsRtpRawPayload *payload = dynamic_cast<SrsRtpRawPayload *>(pkt->payload());
|
||||
|
||||
SrsParsedAudioPacket frame;
|
||||
frame.add_sample(payload->payload, payload->nn_payload);
|
||||
frame.dts = ts;
|
||||
frame.cts = 0;
|
||||
frame.add_sample(payload->payload_, payload->nn_payload_);
|
||||
frame.dts_ = ts;
|
||||
frame.cts_ = 0;
|
||||
|
||||
err = audio_transcoder_->transcode(&frame, out_pkts);
|
||||
if (err != srs_success) {
|
||||
|
|
@ -1894,8 +1894,8 @@ srs_error_t SrsRtcFrameBuilder::transcode_audio(SrsRtpPacket *pkt)
|
|||
for (std::vector<SrsParsedAudioPacket *>::iterator it = out_pkts.begin(); it != out_pkts.end(); ++it) {
|
||||
SrsRtmpCommonMessage out_rtmp;
|
||||
// TODO: FIXME: Should never directly use it, please define a variable with class name.
|
||||
out_rtmp.header.timestamp = (*it)->dts;
|
||||
packet_aac(&out_rtmp, (*it)->samples[0].bytes, (*it)->samples[0].size, ts, is_first_audio_);
|
||||
out_rtmp.header_.timestamp_ = (*it)->dts_;
|
||||
packet_aac(&out_rtmp, (*it)->samples_[0].bytes_, (*it)->samples_[0].size_, ts, is_first_audio_);
|
||||
|
||||
SrsMediaPacket msg;
|
||||
out_rtmp.to_msg(&msg);
|
||||
|
|
@ -1913,7 +1913,7 @@ srs_error_t SrsRtcFrameBuilder::transcode_audio(SrsRtpPacket *pkt)
|
|||
void SrsRtcFrameBuilder::packet_aac(SrsRtmpCommonMessage *audio, char *data, int len, uint32_t pts, bool is_header)
|
||||
{
|
||||
int rtmp_len = len + 2;
|
||||
audio->header.initialize_audio(rtmp_len, pts, 1);
|
||||
audio->header_.initialize_audio(rtmp_len, pts, 1);
|
||||
audio->create_payload(rtmp_len);
|
||||
SrsBuffer stream(audio->payload(), rtmp_len);
|
||||
uint8_t aac_flag = (SrsAudioCodecIdAAC << 4) | (SrsAudioSampleRate44100 << 2) | (SrsAudioSampleBits16bit << 1) | SrsAudioChannelsStereo;
|
||||
|
|
@ -1998,11 +1998,11 @@ srs_error_t SrsRtcFrameBuilder::packet_sequence_header_avc(SrsRtpPacket *pkt)
|
|||
bool has_sps_pps_in_raw_payload = false;
|
||||
SrsRtpRawPayload *raw_payload = dynamic_cast<SrsRtpRawPayload *>(pkt->payload());
|
||||
if (raw_payload) {
|
||||
if (pkt->nalu_type == SrsAvcNaluTypeSPS) {
|
||||
if (pkt->nalu_type_ == SrsAvcNaluTypeSPS) {
|
||||
has_sps_pps_in_raw_payload = true;
|
||||
srs_freep(obs_whip_sps_);
|
||||
obs_whip_sps_ = pkt->copy();
|
||||
} else if (pkt->nalu_type == SrsAvcNaluTypePPS) {
|
||||
} else if (pkt->nalu_type_ == SrsAvcNaluTypePPS) {
|
||||
has_sps_pps_in_raw_payload = true;
|
||||
srs_freep(obs_whip_pps_);
|
||||
obs_whip_pps_ = pkt->copy();
|
||||
|
|
@ -2052,8 +2052,8 @@ srs_error_t SrsRtcFrameBuilder::do_packet_sequence_header_avc(SrsRtpPacket *pkt,
|
|||
std::string sh;
|
||||
SrsUniquePtr<SrsRawH264Stream> avc(new SrsRawH264Stream());
|
||||
|
||||
string sps2 = string(sps->bytes, sps->size);
|
||||
string pps2 = string(pps->bytes, pps->size);
|
||||
string sps2 = string(sps->bytes_, sps->size_);
|
||||
string pps2 = string(pps->bytes_, pps->size_);
|
||||
if ((err = avc->mux_sequence_header(sps2, pps2, sh)) != srs_success) {
|
||||
return srs_error_wrap(err, "mux sequence header");
|
||||
}
|
||||
|
|
@ -2093,15 +2093,15 @@ srs_error_t SrsRtcFrameBuilder::packet_sequence_header_hevc(SrsRtpPacket *pkt)
|
|||
bool has_vps_sps_pps_in_raw_payload = false;
|
||||
SrsRtpRawPayload *raw_payload = dynamic_cast<SrsRtpRawPayload *>(pkt->payload());
|
||||
if (raw_payload) {
|
||||
if (pkt->nalu_type == SrsHevcNaluType_VPS) {
|
||||
if (pkt->nalu_type_ == SrsHevcNaluType_VPS) {
|
||||
has_vps_sps_pps_in_raw_payload = true;
|
||||
srs_freep(obs_whip_vps_);
|
||||
obs_whip_vps_ = pkt->copy();
|
||||
} else if (pkt->nalu_type == SrsHevcNaluType_SPS) {
|
||||
} else if (pkt->nalu_type_ == SrsHevcNaluType_SPS) {
|
||||
has_vps_sps_pps_in_raw_payload = true;
|
||||
srs_freep(obs_whip_sps_);
|
||||
obs_whip_sps_ = pkt->copy();
|
||||
} else if (pkt->nalu_type == SrsHevcNaluType_PPS) {
|
||||
} else if (pkt->nalu_type_ == SrsHevcNaluType_PPS) {
|
||||
has_vps_sps_pps_in_raw_payload = true;
|
||||
srs_freep(obs_whip_pps_);
|
||||
obs_whip_pps_ = pkt->copy();
|
||||
|
|
@ -2150,10 +2150,10 @@ srs_error_t SrsRtcFrameBuilder::do_packet_sequence_header_hevc(SrsRtpPacket *pkt
|
|||
SrsUniquePtr<SrsRawHEVCStream> hevc(new SrsRawHEVCStream());
|
||||
|
||||
std::vector<string> h265_pps;
|
||||
h265_pps.push_back(string(pps->bytes, pps->size));
|
||||
h265_pps.push_back(string(pps->bytes_, pps->size_));
|
||||
|
||||
std::string sh;
|
||||
if ((err = hevc->mux_sequence_header(string(vps->bytes, vps->size), string(sps->bytes, sps->size), h265_pps, sh)) != srs_success) {
|
||||
if ((err = hevc->mux_sequence_header(string(vps->bytes_, vps->size_), string(sps->bytes_, sps->size_), h265_pps, sh)) != srs_success) {
|
||||
return srs_error_wrap(err, "mux sequence header");
|
||||
}
|
||||
|
||||
|
|
@ -2189,9 +2189,9 @@ int SrsRtcFrameBuilder::calculate_packet_payload_size(SrsRtpPacket *pkt)
|
|||
|
||||
// H.264 FU-A payload
|
||||
SrsRtpFUAPayload2 *fua_payload = dynamic_cast<SrsRtpFUAPayload2 *>(pkt->payload());
|
||||
if (fua_payload && fua_payload->size > 0) {
|
||||
int size = fua_payload->size;
|
||||
if (fua_payload->start) {
|
||||
if (fua_payload && fua_payload->size_ > 0) {
|
||||
int size = fua_payload->size_;
|
||||
if (fua_payload->start_) {
|
||||
size += 1 + 4; // NALU header + length prefix
|
||||
}
|
||||
return size;
|
||||
|
|
@ -2201,10 +2201,10 @@ int SrsRtcFrameBuilder::calculate_packet_payload_size(SrsRtpPacket *pkt)
|
|||
SrsRtpSTAPPayload *stap_payload = dynamic_cast<SrsRtpSTAPPayload *>(pkt->payload());
|
||||
if (stap_payload) {
|
||||
int size = 0;
|
||||
for (int j = 0; j < (int)stap_payload->nalus.size(); ++j) {
|
||||
SrsNaluSample *sample = stap_payload->nalus.at(j);
|
||||
if (sample->size > 0) {
|
||||
size += 4 + sample->size; // length prefix + NALU
|
||||
for (int j = 0; j < (int)stap_payload->nalus_.size(); ++j) {
|
||||
SrsNaluSample *sample = stap_payload->nalus_.at(j);
|
||||
if (sample->size_ > 0) {
|
||||
size += 4 + sample->size_; // length prefix + NALU
|
||||
}
|
||||
}
|
||||
return size;
|
||||
|
|
@ -2212,9 +2212,9 @@ int SrsRtcFrameBuilder::calculate_packet_payload_size(SrsRtpPacket *pkt)
|
|||
|
||||
// H.265 FU-A payload
|
||||
SrsRtpFUAPayloadHevc2 *fua_payload_hevc = dynamic_cast<SrsRtpFUAPayloadHevc2 *>(pkt->payload());
|
||||
if (fua_payload_hevc && fua_payload_hevc->size > 0) {
|
||||
int size = fua_payload_hevc->size;
|
||||
if (fua_payload_hevc->start) {
|
||||
if (fua_payload_hevc && fua_payload_hevc->size_ > 0) {
|
||||
int size = fua_payload_hevc->size_;
|
||||
if (fua_payload_hevc->start_) {
|
||||
size += 2 + 4; // HEVC NALU header + length prefix
|
||||
}
|
||||
return size;
|
||||
|
|
@ -2224,10 +2224,10 @@ int SrsRtcFrameBuilder::calculate_packet_payload_size(SrsRtpPacket *pkt)
|
|||
SrsRtpSTAPPayloadHevc *stap_payload_hevc = dynamic_cast<SrsRtpSTAPPayloadHevc *>(pkt->payload());
|
||||
if (stap_payload_hevc) {
|
||||
int size = 0;
|
||||
for (int j = 0; j < (int)stap_payload_hevc->nalus.size(); ++j) {
|
||||
SrsNaluSample *sample = stap_payload_hevc->nalus.at(j);
|
||||
if (sample->size > 0) {
|
||||
size += 4 + sample->size; // length prefix + NALU
|
||||
for (int j = 0; j < (int)stap_payload_hevc->nalus_.size(); ++j) {
|
||||
SrsNaluSample *sample = stap_payload_hevc->nalus_.at(j);
|
||||
if (sample->size_ > 0) {
|
||||
size += 4 + sample->size_; // length prefix + NALU
|
||||
}
|
||||
}
|
||||
return size;
|
||||
|
|
@ -2235,8 +2235,8 @@ int SrsRtcFrameBuilder::calculate_packet_payload_size(SrsRtpPacket *pkt)
|
|||
|
||||
// Raw payload
|
||||
SrsRtpRawPayload *raw_payload = dynamic_cast<SrsRtpRawPayload *>(pkt->payload());
|
||||
if (raw_payload && raw_payload->nn_payload > 0) {
|
||||
return 4 + raw_payload->nn_payload; // length prefix + payload
|
||||
if (raw_payload && raw_payload->nn_payload_ > 0) {
|
||||
return 4 + raw_payload->nn_payload_; // length prefix + payload
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -2250,16 +2250,16 @@ void SrsRtcFrameBuilder::write_packet_payload_to_buffer(SrsRtpPacket *pkt, SrsBu
|
|||
|
||||
// H.264 FU-A payload
|
||||
SrsRtpFUAPayload2 *fua_payload = dynamic_cast<SrsRtpFUAPayload2 *>(pkt->payload());
|
||||
if (fua_payload && fua_payload->size > 0) {
|
||||
if (fua_payload->start) {
|
||||
nalu_len = fua_payload->size + 1;
|
||||
if (fua_payload && fua_payload->size_ > 0) {
|
||||
if (fua_payload->start_) {
|
||||
nalu_len = fua_payload->size_ + 1;
|
||||
payload.skip(4); // Skip 4 bytes to write nalu_len later
|
||||
payload.write_1bytes(fua_payload->nri | fua_payload->nalu_type);
|
||||
payload.write_bytes(fua_payload->payload, fua_payload->size);
|
||||
payload.write_1bytes(fua_payload->nri_ | fua_payload->nalu_type_);
|
||||
payload.write_bytes(fua_payload->payload_, fua_payload->size_);
|
||||
} else {
|
||||
nalu_len += fua_payload->size;
|
||||
payload.write_bytes(fua_payload->payload, fua_payload->size);
|
||||
if (fua_payload->end) {
|
||||
nalu_len += fua_payload->size_;
|
||||
payload.write_bytes(fua_payload->payload_, fua_payload->size_);
|
||||
if (fua_payload->end_) {
|
||||
// Write nalu_len back
|
||||
payload.skip(-(4 + nalu_len));
|
||||
payload.write_4bytes(nalu_len);
|
||||
|
|
@ -2272,11 +2272,11 @@ void SrsRtcFrameBuilder::write_packet_payload_to_buffer(SrsRtpPacket *pkt, SrsBu
|
|||
// H.264 STAP-A payload
|
||||
SrsRtpSTAPPayload *stap_payload = dynamic_cast<SrsRtpSTAPPayload *>(pkt->payload());
|
||||
if (stap_payload) {
|
||||
for (int j = 0; j < (int)stap_payload->nalus.size(); ++j) {
|
||||
SrsNaluSample *sample = stap_payload->nalus.at(j);
|
||||
if (sample->size > 0) {
|
||||
payload.write_4bytes(sample->size);
|
||||
payload.write_bytes(sample->bytes, sample->size);
|
||||
for (int j = 0; j < (int)stap_payload->nalus_.size(); ++j) {
|
||||
SrsNaluSample *sample = stap_payload->nalus_.at(j);
|
||||
if (sample->size_ > 0) {
|
||||
payload.write_4bytes(sample->size_);
|
||||
payload.write_bytes(sample->bytes_, sample->size_);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
|
@ -2284,17 +2284,17 @@ void SrsRtcFrameBuilder::write_packet_payload_to_buffer(SrsRtpPacket *pkt, SrsBu
|
|||
|
||||
// H.265 FU-A payload
|
||||
SrsRtpFUAPayloadHevc2 *fua_payload_hevc = dynamic_cast<SrsRtpFUAPayloadHevc2 *>(pkt->payload());
|
||||
if (fua_payload_hevc && fua_payload_hevc->size > 0) {
|
||||
if (fua_payload_hevc->start) {
|
||||
nalu_len = fua_payload_hevc->size + 2;
|
||||
if (fua_payload_hevc && fua_payload_hevc->size_ > 0) {
|
||||
if (fua_payload_hevc->start_) {
|
||||
nalu_len = fua_payload_hevc->size_ + 2;
|
||||
payload.skip(4); // Skip 4 bytes to write nalu_len later
|
||||
payload.write_1bytes(fua_payload_hevc->nalu_type << 1);
|
||||
payload.write_1bytes(fua_payload_hevc->nalu_type_ << 1);
|
||||
payload.write_1bytes(0x01);
|
||||
payload.write_bytes(fua_payload_hevc->payload, fua_payload_hevc->size);
|
||||
payload.write_bytes(fua_payload_hevc->payload_, fua_payload_hevc->size_);
|
||||
} else {
|
||||
nalu_len += fua_payload_hevc->size;
|
||||
payload.write_bytes(fua_payload_hevc->payload, fua_payload_hevc->size);
|
||||
if (fua_payload_hevc->end) {
|
||||
nalu_len += fua_payload_hevc->size_;
|
||||
payload.write_bytes(fua_payload_hevc->payload_, fua_payload_hevc->size_);
|
||||
if (fua_payload_hevc->end_) {
|
||||
// Write nalu_len back
|
||||
payload.skip(-(4 + nalu_len));
|
||||
payload.write_4bytes(nalu_len);
|
||||
|
|
@ -2307,11 +2307,11 @@ void SrsRtcFrameBuilder::write_packet_payload_to_buffer(SrsRtpPacket *pkt, SrsBu
|
|||
// H.265 STAP payload
|
||||
SrsRtpSTAPPayloadHevc *stap_payload_hevc = dynamic_cast<SrsRtpSTAPPayloadHevc *>(pkt->payload());
|
||||
if (stap_payload_hevc) {
|
||||
for (int j = 0; j < (int)stap_payload_hevc->nalus.size(); ++j) {
|
||||
SrsNaluSample *sample = stap_payload_hevc->nalus.at(j);
|
||||
if (sample->size > 0) {
|
||||
payload.write_4bytes(sample->size);
|
||||
payload.write_bytes(sample->bytes, sample->size);
|
||||
for (int j = 0; j < (int)stap_payload_hevc->nalus_.size(); ++j) {
|
||||
SrsNaluSample *sample = stap_payload_hevc->nalus_.at(j);
|
||||
if (sample->size_ > 0) {
|
||||
payload.write_4bytes(sample->size_);
|
||||
payload.write_bytes(sample->bytes_, sample->size_);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
|
@ -2319,9 +2319,9 @@ void SrsRtcFrameBuilder::write_packet_payload_to_buffer(SrsRtpPacket *pkt, SrsBu
|
|||
|
||||
// Raw payload
|
||||
SrsRtpRawPayload *raw_payload = dynamic_cast<SrsRtpRawPayload *>(pkt->payload());
|
||||
if (raw_payload && raw_payload->nn_payload > 0) {
|
||||
payload.write_4bytes(raw_payload->nn_payload);
|
||||
payload.write_bytes(raw_payload->payload, raw_payload->nn_payload);
|
||||
if (raw_payload && raw_payload->nn_payload_ > 0) {
|
||||
payload.write_4bytes(raw_payload->nn_payload_);
|
||||
payload.write_bytes(raw_payload->payload_, raw_payload->nn_payload_);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -2395,7 +2395,7 @@ srs_error_t SrsRtcFrameBuilder::packet_video_rtmp(const uint16_t start, const ui
|
|||
}
|
||||
|
||||
SrsRtmpCommonMessage rtmp;
|
||||
rtmp.header.initialize_video(nb_payload, pkt->get_avsync_time(), 1);
|
||||
rtmp.header_.initialize_video(nb_payload, pkt->get_avsync_time(), 1);
|
||||
rtmp.create_payload(nb_payload);
|
||||
SrsBuffer payload(rtmp.payload(), rtmp.size());
|
||||
if (video_codec_ == SrsVideoCodecIdHEVC) {
|
||||
|
|
@ -3250,7 +3250,7 @@ srs_error_t SrsRtcAudioRecvTrack::check_send_nacks()
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
++_srs_pps_sanack->sugar;
|
||||
++_srs_pps_sanack->sugar_;
|
||||
|
||||
uint32_t timeout_nacks = 0;
|
||||
if ((err = do_check_send_nacks(timeout_nacks)) != srs_success) {
|
||||
|
|
@ -3279,7 +3279,7 @@ void SrsRtcVideoRecvTrack::on_before_decode_payload(SrsRtpPacket *pkt, SrsBuffer
|
|||
SrsVideoCodecId codec = (SrsVideoCodecId)track_desc_->media_->codec(true);
|
||||
if (codec == SrsVideoCodecIdAVC) {
|
||||
uint8_t v = SrsAvcNaluTypeParse(buf->head()[0]);
|
||||
pkt->nalu_type = v;
|
||||
pkt->nalu_type_ = v;
|
||||
|
||||
if (v == kStapA) {
|
||||
*ppayload = new SrsRtpSTAPPayload();
|
||||
|
|
@ -3293,7 +3293,7 @@ void SrsRtcVideoRecvTrack::on_before_decode_payload(SrsRtpPacket *pkt, SrsBuffer
|
|||
}
|
||||
} else if (codec == SrsVideoCodecIdHEVC) {
|
||||
uint8_t v = SrsHevcNaluTypeParse(buf->head()[0]);
|
||||
pkt->nalu_type = v;
|
||||
pkt->nalu_type_ = v;
|
||||
|
||||
if (v == kStapHevc) {
|
||||
*ppayload = new SrsRtpSTAPPayloadHevc();
|
||||
|
|
@ -3329,7 +3329,7 @@ srs_error_t SrsRtcVideoRecvTrack::check_send_nacks()
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
++_srs_pps_svnack->sugar;
|
||||
++_srs_pps_svnack->sugar_;
|
||||
|
||||
uint32_t timeout_nacks = 0;
|
||||
if ((err = do_check_send_nacks(timeout_nacks)) != srs_success) {
|
||||
|
|
@ -3422,10 +3422,10 @@ SrsRtpPacket *SrsRtcSendTrack::fetch_rtp_packet(uint16_t seq)
|
|||
// For NACK, it sequence must match exactly, or it cause SRTP fail.
|
||||
// Return packet only when sequence is equal.
|
||||
if (pkt->header.get_sequence() == seq) {
|
||||
++_srs_pps_rhnack->sugar;
|
||||
++_srs_pps_rhnack->sugar_;
|
||||
return pkt;
|
||||
}
|
||||
++_srs_pps_rmnack->sugar;
|
||||
++_srs_pps_rmnack->sugar_;
|
||||
|
||||
// Ignore if sequence not match.
|
||||
uint32_t nn = 0;
|
||||
|
|
@ -3490,7 +3490,7 @@ srs_error_t SrsRtcSendTrack::on_recv_nack(const vector<uint16_t> &lost_seqs)
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
++_srs_pps_rnack2->sugar;
|
||||
++_srs_pps_rnack2->sugar_;
|
||||
|
||||
for (int i = 0; i < (int)lost_seqs.size(); ++i) {
|
||||
uint16_t seq = lost_seqs.at(i);
|
||||
|
|
|
|||
|
|
@ -829,11 +829,11 @@ srs_error_t SrsRtmpConn::do_playing(SrsSharedPtr<SrsLiveSource> source, SrsLiveC
|
|||
|
||||
// foreach msg, collect the duration.
|
||||
// @remark: never use msg when sent it, for the protocol sdk will free it.
|
||||
if (starttime < 0 || starttime > msg->timestamp) {
|
||||
starttime = msg->timestamp;
|
||||
if (starttime < 0 || starttime > msg->timestamp_) {
|
||||
starttime = msg->timestamp_;
|
||||
}
|
||||
duration += (msg->timestamp - starttime) * SRS_UTIME_MILLISECONDS;
|
||||
starttime = msg->timestamp;
|
||||
duration += (msg->timestamp_ - starttime) * SRS_UTIME_MILLISECONDS;
|
||||
starttime = msg->timestamp_;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1108,7 +1108,7 @@ srs_error_t SrsRtmpConn::handle_publish_message(SrsSharedPtr<SrsLiveSource> &sou
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
// process publish event.
|
||||
if (msg->header.is_amf0_command() || msg->header.is_amf3_command()) {
|
||||
if (msg->header_.is_amf0_command() || msg->header_.is_amf3_command()) {
|
||||
SrsRtmpCommand *pkt_raw = NULL;
|
||||
if ((err = rtmp->decode_message(msg, &pkt_raw)) != srs_success) {
|
||||
return srs_error_wrap(err, "rtmp: decode message");
|
||||
|
|
@ -1157,14 +1157,14 @@ srs_error_t SrsRtmpConn::process_publish_message(SrsSharedPtr<SrsLiveSource> &so
|
|||
}
|
||||
|
||||
// process audio packet
|
||||
if (msg->header.is_audio()) {
|
||||
if (msg->header_.is_audio()) {
|
||||
if ((err = source->on_audio(msg)) != srs_success) {
|
||||
return srs_error_wrap(err, "rtmp: consume audio");
|
||||
}
|
||||
return err;
|
||||
}
|
||||
// process video packet
|
||||
if (msg->header.is_video()) {
|
||||
if (msg->header_.is_video()) {
|
||||
if ((err = source->on_video(msg)) != srs_success) {
|
||||
return srs_error_wrap(err, "rtmp: consume video");
|
||||
}
|
||||
|
|
@ -1172,7 +1172,7 @@ srs_error_t SrsRtmpConn::process_publish_message(SrsSharedPtr<SrsLiveSource> &so
|
|||
}
|
||||
|
||||
// process aggregate packet
|
||||
if (msg->header.is_aggregate()) {
|
||||
if (msg->header_.is_aggregate()) {
|
||||
if ((err = source->on_aggregate(msg)) != srs_success) {
|
||||
return srs_error_wrap(err, "rtmp: consume aggregate");
|
||||
}
|
||||
|
|
@ -1180,7 +1180,7 @@ srs_error_t SrsRtmpConn::process_publish_message(SrsSharedPtr<SrsLiveSource> &so
|
|||
}
|
||||
|
||||
// process onMetaData
|
||||
if (msg->header.is_amf0_data() || msg->header.is_amf3_data()) {
|
||||
if (msg->header_.is_amf0_data() || msg->header_.is_amf3_data()) {
|
||||
SrsRtmpCommand *pkt_raw = NULL;
|
||||
if ((err = rtmp->decode_message(msg, &pkt_raw)) != srs_success) {
|
||||
return srs_error_wrap(err, "rtmp: decode message");
|
||||
|
|
@ -1209,7 +1209,7 @@ srs_error_t SrsRtmpConn::process_play_control_msg(SrsLiveConsumer *consumer, Srs
|
|||
}
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
if (!msg->header.is_amf0_command() && !msg->header.is_amf3_command()) {
|
||||
if (!msg->header_.is_amf0_command() && !msg->header_.is_amf3_command()) {
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -467,7 +467,7 @@ srs_error_t SrsRtspSource::on_rtp(SrsRtpPacket *pkt)
|
|||
|
||||
// If circuit-breaker is dying, drop packet.
|
||||
if (_srs_circuit_breaker->hybrid_dying_water_level()) {
|
||||
_srs_pps_aloss2->sugar += (int64_t)consumers.size();
|
||||
_srs_pps_aloss2->sugar_ += (int64_t)consumers.size();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -548,18 +548,18 @@ srs_error_t SrsRtspRtpBuilder::initialize_audio_track(SrsAudioCodecId codec)
|
|||
audio_ssrc_ = SrsRtcSSRCGenerator::instance()->generate_ssrc();
|
||||
audio_desc->ssrc_ = audio_ssrc_;
|
||||
|
||||
int sample_rate = srs_flv_srates[format->acodec->sound_rate];
|
||||
int sample_rate = srs_flv_srates[format->acodec_->sound_rate_];
|
||||
audio_sample_rate_ = sample_rate;
|
||||
|
||||
// Build payload from actual audio format
|
||||
if (codec == SrsAudioCodecIdOpus) {
|
||||
// For Opus, use actual format parameters if available
|
||||
int channels = (format->acodec->sound_type == SrsAudioChannelsStereo) ? 2 : 1;
|
||||
int channels = (format->acodec_->sound_type_ == SrsAudioChannelsStereo) ? 2 : 1;
|
||||
audio_payload_type_ = kAudioPayloadType;
|
||||
audio_desc->media_ = new SrsAudioPayload(audio_payload_type_, "opus", sample_rate, channels);
|
||||
} else if (codec == SrsAudioCodecIdAAC) {
|
||||
// For AAC, extract parameters from format
|
||||
int channels = format->acodec->aac_channels;
|
||||
int channels = format->acodec_->aac_channels_;
|
||||
audio_payload_type_ = kAudioPayloadType;
|
||||
|
||||
// Note: Use "MPEG4-GENERIC" instead of "AAC" for RTSP/SDP compliance
|
||||
|
|
@ -569,7 +569,7 @@ srs_error_t SrsRtspRtpBuilder::initialize_audio_track(SrsAudioCodecId codec)
|
|||
|
||||
// AAC requires AudioSpecificConfig in SDP fmtp line
|
||||
// Build the config string from AAC sequence header
|
||||
const std::vector<char> &asc = format->acodec->aac_extra_data;
|
||||
const std::vector<char> &asc = format->acodec_->aac_extra_data_;
|
||||
if (!asc.empty()) {
|
||||
int hex_len = asc.size() * 2;
|
||||
SrsUniquePtr<char> hex_buf(new char[hex_len + 1]);
|
||||
|
|
@ -666,9 +666,9 @@ srs_error_t SrsRtspRtpBuilder::initialize(ISrsRequest *r)
|
|||
}
|
||||
|
||||
// Setup the SPS/PPS parsing strategy.
|
||||
format->try_annexb_first = _srs_config->try_annexb_first(r->vhost);
|
||||
format->try_annexb_first_ = _srs_config->try_annexb_first(r->vhost);
|
||||
|
||||
srs_trace("RTSP bridge from RTMP, try_annexb_first=%d", format->try_annexb_first);
|
||||
srs_trace("RTSP bridge from RTMP, try_annexb_first=%d", format->try_annexb_first_);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
@ -712,12 +712,12 @@ srs_error_t SrsRtspRtpBuilder::on_audio(SrsMediaPacket *msg)
|
|||
|
||||
// Ignore if no format->acodec, it means the codec is not parsed, or unknown codec.
|
||||
// @issue https://github.com/ossrs/srs/issues/1506#issuecomment-562079474
|
||||
if (!format->acodec) {
|
||||
if (!format->acodec_) {
|
||||
return err;
|
||||
}
|
||||
|
||||
// support audio codec: aac/opus
|
||||
SrsAudioCodecId acodec = format->acodec->id;
|
||||
SrsAudioCodecId acodec = format->acodec_->id_;
|
||||
if (acodec != SrsAudioCodecIdAAC && acodec != SrsAudioCodecIdOpus) {
|
||||
return err;
|
||||
}
|
||||
|
|
@ -731,7 +731,7 @@ srs_error_t SrsRtspRtpBuilder::on_audio(SrsMediaPacket *msg)
|
|||
}
|
||||
|
||||
// Skip empty audio frames
|
||||
if (format->audio->nb_samples == 0) {
|
||||
if (format->audio_->nb_samples_ == 0) {
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -739,7 +739,7 @@ srs_error_t SrsRtspRtpBuilder::on_audio(SrsMediaPacket *msg)
|
|||
SrsUniquePtr<SrsRtpPacket> pkt(new SrsRtpPacket());
|
||||
|
||||
if (acodec == SrsAudioCodecIdAAC) {
|
||||
if ((err = package_aac(format->audio, pkt.get())) != srs_success) {
|
||||
if ((err = package_aac(format->audio_, pkt.get())) != srs_success) {
|
||||
return srs_error_wrap(err, "package aac");
|
||||
}
|
||||
} else {
|
||||
|
|
@ -757,17 +757,17 @@ srs_error_t SrsRtspRtpBuilder::package_aac(SrsParsedAudioPacket *audio, SrsRtpPa
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
srs_assert(audio->nb_samples);
|
||||
srs_assert(audio->nb_samples_);
|
||||
|
||||
// For RTSP, audio TBN is not fixed, but use the sample rate, so we
|
||||
// need to convert FLV TBN(1000) to the sample rate TBN.
|
||||
int64_t dts = (int64_t)audio->dts;
|
||||
int64_t dts = (int64_t)audio->dts_;
|
||||
dts *= (int64_t)audio_sample_rate_;
|
||||
dts /= 1000;
|
||||
|
||||
pkt->header.set_payload_type(audio_payload_type_);
|
||||
pkt->header.set_ssrc(audio_ssrc_);
|
||||
pkt->frame_type = SrsFrameTypeAudio;
|
||||
pkt->frame_type_ = SrsFrameTypeAudio;
|
||||
pkt->header.set_marker(true);
|
||||
pkt->header.set_sequence(audio_sequence++);
|
||||
pkt->header.set_timestamp(dts);
|
||||
|
|
@ -779,12 +779,12 @@ srs_error_t SrsRtspRtpBuilder::package_aac(SrsParsedAudioPacket *audio, SrsRtpPa
|
|||
// Use AAC-hbr mode with AU-headers
|
||||
// Calculate total size for all AU samples
|
||||
int total_au_size = 0;
|
||||
for (int i = 0; i < audio->nb_samples; i++) {
|
||||
total_au_size += audio->samples[i].size;
|
||||
for (int i = 0; i < audio->nb_samples_; i++) {
|
||||
total_au_size += audio->samples_[i].size_;
|
||||
}
|
||||
|
||||
// AU-headers: 16 bits per AU (13 bits for size + 3 bits for index)
|
||||
int au_headers_length = audio->nb_samples * 16; // bits
|
||||
int au_headers_length = audio->nb_samples_ * 16; // bits
|
||||
int au_headers_bytes = (au_headers_length + 7) / 8; // convert to bytes
|
||||
int payload_size = 2 + au_headers_bytes + total_au_size; // AU-headers-length(2) + AU-headers + AU data
|
||||
|
||||
|
|
@ -796,22 +796,22 @@ srs_error_t SrsRtspRtpBuilder::package_aac(SrsParsedAudioPacket *audio, SrsRtpPa
|
|||
buffer.write_2bytes(au_headers_length);
|
||||
|
||||
// Write AU-headers for each sample
|
||||
for (int i = 0; i < audio->nb_samples; i++) {
|
||||
for (int i = 0; i < audio->nb_samples_; i++) {
|
||||
// AU-header: AU-size(13 bits) + AU-index(3 bits) = 16 bits
|
||||
// According to RFC 3640, AU-size comes first (MSB), then AU-index (LSB)
|
||||
uint16_t au_size = audio->samples[i].size & 0x1FFF; // 13 bits mask
|
||||
uint16_t au_index = i & 0x07; // 3 bits mask
|
||||
uint16_t au_size = audio->samples_[i].size_ & 0x1FFF; // 13 bits mask
|
||||
uint16_t au_index = i & 0x07; // 3 bits mask
|
||||
buffer.write_2bytes((au_size << 3) | au_index);
|
||||
}
|
||||
|
||||
// Copy all AAC AU data
|
||||
for (int i = 0; i < audio->nb_samples; i++) {
|
||||
buffer.write_bytes(audio->samples[i].bytes, audio->samples[i].size);
|
||||
for (int i = 0; i < audio->nb_samples_; i++) {
|
||||
buffer.write_bytes(audio->samples_[i].bytes_, audio->samples_[i].size_);
|
||||
}
|
||||
|
||||
// Wrap the payload in the RTP packet
|
||||
raw->payload = pkt->wrap(payload.get(), payload_size);
|
||||
raw->nn_payload = payload_size;
|
||||
raw->payload_ = pkt->wrap(payload.get(), payload_size);
|
||||
raw->nn_payload_ = payload_size;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
@ -843,12 +843,12 @@ srs_error_t SrsRtspRtpBuilder::on_video(SrsMediaPacket *msg)
|
|||
|
||||
// Ignore if no format->vcodec, it means the codec is not parsed, or unsupport/unknown codec
|
||||
// such as H.263 codec
|
||||
if (!format->vcodec) {
|
||||
if (!format->vcodec_) {
|
||||
return err;
|
||||
}
|
||||
|
||||
// support video codec: h264/h265
|
||||
SrsVideoCodecId vcodec = format->vcodec->id;
|
||||
SrsVideoCodecId vcodec = format->vcodec_->id_;
|
||||
if (vcodec != SrsVideoCodecIdAVC && vcodec != SrsVideoCodecIdHEVC) {
|
||||
return err;
|
||||
}
|
||||
|
|
@ -890,7 +890,7 @@ srs_error_t SrsRtspRtpBuilder::on_video(SrsMediaPacket *msg)
|
|||
for (int i = 0; i < nn_samples; i++) {
|
||||
SrsNaluSample *sample = samples[i];
|
||||
|
||||
if (sample->size <= kRtpMaxPayloadSize) {
|
||||
if (sample->size_ <= kRtpMaxPayloadSize) {
|
||||
if ((err = package_single_nalu(msg, sample, pkts)) != srs_success) {
|
||||
return srs_error_wrap(err, "package single nalu");
|
||||
}
|
||||
|
|
@ -913,13 +913,13 @@ srs_error_t SrsRtspRtpBuilder::filter(SrsMediaPacket *msg, SrsFormat *format, bo
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
// If IDR, we will insert SPS/PPS before IDR frame.
|
||||
if (format->video && format->video->has_idr) {
|
||||
if (format->video_ && format->video_->has_idr_) {
|
||||
has_idr = true;
|
||||
}
|
||||
|
||||
// Update samples to shared frame.
|
||||
for (int i = 0; i < format->video->nb_samples; ++i) {
|
||||
SrsNaluSample *sample = &format->video->samples[i];
|
||||
for (int i = 0; i < format->video_->nb_samples_; ++i) {
|
||||
SrsNaluSample *sample = &format->video_->samples_[i];
|
||||
samples.push_back(sample);
|
||||
}
|
||||
|
||||
|
|
@ -931,7 +931,7 @@ srs_error_t SrsRtspRtpBuilder::package_stap_a(SrsMediaPacket *msg, SrsRtpPacket
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
SrsFormat *format = meta->vsh_format();
|
||||
if (!format || !format->vcodec) {
|
||||
if (!format || !format->vcodec_) {
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -943,7 +943,7 @@ srs_error_t SrsRtspRtpBuilder::package_nalus(SrsMediaPacket *msg, const vector<S
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
SrsFormat *format = meta->vsh_format();
|
||||
if (!format || !format->vcodec) {
|
||||
if (!format || !format->vcodec_) {
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -961,7 +961,7 @@ srs_error_t SrsRtspRtpBuilder::package_fu_a(SrsMediaPacket *msg, SrsNaluSample *
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
SrsFormat *format = meta->vsh_format();
|
||||
if (!format || !format->vcodec) {
|
||||
if (!format || !format->vcodec_) {
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1363,10 +1363,10 @@ srs_error_t SrsServer::srs_update_server_statistics()
|
|||
|
||||
srs_trace("SRS: cpu=%.2f%%,%dMB%s%s%s%s%s%s%s%s%s%s%s",
|
||||
u->percent * 100, memory,
|
||||
stats.cid_desc.c_str(), stats.timer_desc.c_str(),
|
||||
stats.recvfrom_desc.c_str(), stats.io_desc.c_str(), stats.msg_desc.c_str(),
|
||||
stats.epoll_desc.c_str(), stats.sched_desc.c_str(), stats.clock_desc.c_str(),
|
||||
stats.thread_desc.c_str(), stats.free_desc.c_str(), stats.objs_desc.c_str());
|
||||
stats.cid_desc_.c_str(), stats.timer_desc_.c_str(),
|
||||
stats.recvfrom_desc_.c_str(), stats.io_desc_.c_str(), stats.msg_desc_.c_str(),
|
||||
stats.epoll_desc_.c_str(), stats.sched_desc_.c_str(), stats.clock_desc_.c_str(),
|
||||
stats.thread_desc_.c_str(), stats.free_desc_.c_str(), stats.objs_desc_.c_str());
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,9 +85,9 @@ srs_error_t SrsRtmpJitter::correct(SrsMediaPacket *msg, SrsRtmpJitterAlgorithm a
|
|||
if (ag == SrsRtmpJitterAlgorithmZERO) {
|
||||
// for the first time, last_pkt_correct_time is -1.
|
||||
if (last_pkt_correct_time == -1) {
|
||||
last_pkt_correct_time = msg->timestamp;
|
||||
last_pkt_correct_time = msg->timestamp_;
|
||||
}
|
||||
msg->timestamp -= last_pkt_correct_time;
|
||||
msg->timestamp_ -= last_pkt_correct_time;
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ srs_error_t SrsRtmpJitter::correct(SrsMediaPacket *msg, SrsRtmpJitterAlgorithm a
|
|||
// full jitter algorithm, do jitter correct.
|
||||
// set to 0 for metadata.
|
||||
if (!msg->is_av()) {
|
||||
msg->timestamp = 0;
|
||||
msg->timestamp_ = 0;
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ srs_error_t SrsRtmpJitter::correct(SrsMediaPacket *msg, SrsRtmpJitterAlgorithm a
|
|||
* 3. last_pkt_correct_time: simply add the positive delta,
|
||||
* and enforce the time monotonically.
|
||||
*/
|
||||
int64_t time = msg->timestamp;
|
||||
int64_t time = msg->timestamp_;
|
||||
int64_t delta = time - last_pkt_time;
|
||||
|
||||
// if jitter detected, reset the delta.
|
||||
|
|
@ -124,7 +124,7 @@ srs_error_t SrsRtmpJitter::correct(SrsMediaPacket *msg, SrsRtmpJitterAlgorithm a
|
|||
|
||||
last_pkt_correct_time = srs_max(0, last_pkt_correct_time + delta);
|
||||
|
||||
msg->timestamp = last_pkt_correct_time;
|
||||
msg->timestamp_ = last_pkt_correct_time;
|
||||
last_pkt_time = time;
|
||||
|
||||
return err;
|
||||
|
|
@ -259,12 +259,12 @@ srs_error_t SrsMessageQueue::enqueue(SrsMediaPacket *msg, bool *is_overflow)
|
|||
// If jitter is off, the timestamp of first sequence header is zero, which wll cause SRS to shrink and drop the
|
||||
// keyframes even if there is not overflow packets in queue, so we must ignore the zero timestamps, please
|
||||
// @see https://github.com/ossrs/srs/pull/2186#issuecomment-953383063
|
||||
if (msg->is_av() && msg->timestamp != 0) {
|
||||
if (msg->is_av() && msg->timestamp_ != 0) {
|
||||
if (av_start_time == -1) {
|
||||
av_start_time = srs_utime_t(msg->timestamp * SRS_UTIME_MILLISECONDS);
|
||||
av_start_time = srs_utime_t(msg->timestamp_ * SRS_UTIME_MILLISECONDS);
|
||||
}
|
||||
|
||||
av_end_time = srs_utime_t(msg->timestamp * SRS_UTIME_MILLISECONDS);
|
||||
av_end_time = srs_utime_t(msg->timestamp_ * SRS_UTIME_MILLISECONDS);
|
||||
}
|
||||
|
||||
if (max_queue_size <= 0) {
|
||||
|
|
@ -299,7 +299,7 @@ srs_error_t SrsMessageQueue::dump_packets(int max_count, SrsMediaPacket **pmsgs,
|
|||
memcpy(pmsgs, omsgs, count * sizeof(SrsMediaPacket *));
|
||||
|
||||
SrsMediaPacket *last = omsgs[count - 1];
|
||||
av_start_time = srs_utime_t(last->timestamp * SRS_UTIME_MILLISECONDS);
|
||||
av_start_time = srs_utime_t(last->timestamp_ * SRS_UTIME_MILLISECONDS);
|
||||
|
||||
if (count >= nb_msgs) {
|
||||
// the pmsgs is big enough and clear msgs at most time.
|
||||
|
|
@ -364,11 +364,11 @@ void SrsMessageQueue::shrink()
|
|||
|
||||
// Push back sequence headers and update their timestamps.
|
||||
if (video_sh) {
|
||||
video_sh->timestamp = srsu2ms(av_end_time);
|
||||
video_sh->timestamp_ = srsu2ms(av_end_time);
|
||||
msgs.push_back(video_sh);
|
||||
}
|
||||
if (audio_sh) {
|
||||
audio_sh->timestamp = srsu2ms(av_end_time);
|
||||
audio_sh->timestamp_ = srsu2ms(av_end_time);
|
||||
msgs.push_back(audio_sh);
|
||||
}
|
||||
|
||||
|
|
@ -710,7 +710,7 @@ srs_utime_t SrsGopCache::start_time()
|
|||
SrsMediaPacket *msg = gop_cache[0];
|
||||
srs_assert(msg);
|
||||
|
||||
return srs_utime_t(msg->timestamp * SRS_UTIME_MILLISECONDS);
|
||||
return srs_utime_t(msg->timestamp_ * SRS_UTIME_MILLISECONDS);
|
||||
}
|
||||
|
||||
bool SrsGopCache::pure_audio()
|
||||
|
|
@ -771,7 +771,7 @@ void SrsMixQueue::clear()
|
|||
|
||||
void SrsMixQueue::push(SrsMediaPacket *msg)
|
||||
{
|
||||
msgs.insert(std::make_pair(msg->timestamp, msg));
|
||||
msgs.insert(std::make_pair(msg->timestamp_, msg));
|
||||
|
||||
if (msg->is_video()) {
|
||||
nb_videos++;
|
||||
|
|
@ -951,28 +951,28 @@ srs_error_t SrsOriginHub::on_audio(SrsMediaPacket *shared_audio)
|
|||
|
||||
// Handle the metadata when got sequence header.
|
||||
if (format->is_aac_sequence_header() || format->is_mp3_sequence_header()) {
|
||||
srs_assert(format->acodec);
|
||||
SrsAudioCodecConfig *c = format->acodec;
|
||||
srs_assert(format->acodec_);
|
||||
SrsAudioCodecConfig *c = format->acodec_;
|
||||
|
||||
static int flv_sample_sizes[] = {8, 16, 0};
|
||||
static int flv_sound_types[] = {1, 2, 0};
|
||||
|
||||
// when got audio stream info.
|
||||
SrsStatistic *stat = SrsStatistic::instance();
|
||||
if ((err = stat->on_audio_info(req_, format->acodec->id, c->sound_rate, c->sound_type, c->aac_object)) != srs_success) {
|
||||
if ((err = stat->on_audio_info(req_, format->acodec_->id_, c->sound_rate_, c->sound_type_, c->aac_object_)) != srs_success) {
|
||||
return srs_error_wrap(err, "stat audio");
|
||||
}
|
||||
|
||||
if (format->acodec->id == SrsAudioCodecIdMP3) {
|
||||
if (format->acodec_->id_ == SrsAudioCodecIdMP3) {
|
||||
srs_trace("%dB audio sh, codec(%d, %dbits, %dchannels, %dHZ)",
|
||||
msg->size(), c->id, flv_sample_sizes[c->sound_size], flv_sound_types[c->sound_type],
|
||||
srs_flv_srates[c->sound_rate]);
|
||||
msg->size(), c->id_, flv_sample_sizes[c->sound_size_], flv_sound_types[c->sound_type_],
|
||||
srs_flv_srates[c->sound_rate_]);
|
||||
} else {
|
||||
srs_trace("%dB audio sh, codec(%d, profile=%s, %dchannels, %dkbps, %dHZ), flv(%dbits, %dchannels, %dHZ)",
|
||||
msg->size(), c->id, srs_aac_object2str(c->aac_object).c_str(), c->aac_channels,
|
||||
c->audio_data_rate / 1000, srs_aac_srates[c->aac_sample_rate],
|
||||
flv_sample_sizes[c->sound_size], flv_sound_types[c->sound_type],
|
||||
srs_flv_srates[c->sound_rate]);
|
||||
msg->size(), c->id_, srs_aac_object2str(c->aac_object_).c_str(), c->aac_channels_,
|
||||
c->audio_data_rate_ / 1000, srs_aac_srates[c->aac_sample_rate_],
|
||||
flv_sample_sizes[c->sound_size_], flv_sound_types[c->sound_type_],
|
||||
srs_flv_srates[c->sound_rate_]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1038,22 +1038,22 @@ srs_error_t SrsOriginHub::on_video(SrsMediaPacket *shared_video, bool is_sequenc
|
|||
// cache the sequence header if h264
|
||||
// donot cache the sequence header to gop_cache, return here.
|
||||
if (format->is_avc_sequence_header()) {
|
||||
SrsVideoCodecConfig *c = format->vcodec;
|
||||
SrsVideoCodecConfig *c = format->vcodec_;
|
||||
srs_assert(c);
|
||||
|
||||
// when got video stream info.
|
||||
SrsStatistic *stat = SrsStatistic::instance();
|
||||
|
||||
if (c->id == SrsVideoCodecIdAVC) {
|
||||
err = stat->on_video_info(req_, c->id, c->avc_profile, c->avc_level, c->width, c->height);
|
||||
if (c->id_ == SrsVideoCodecIdAVC) {
|
||||
err = stat->on_video_info(req_, c->id_, c->avc_profile_, c->avc_level_, c->width_, c->height_);
|
||||
srs_trace("%dB video sh, codec(%d, profile=%s, level=%s, %dx%d, %dkbps, %.1ffps, %.1fs)",
|
||||
msg->size(), c->id, srs_avc_profile2str(c->avc_profile).c_str(), srs_avc_level2str(c->avc_level).c_str(),
|
||||
c->width, c->height, c->video_data_rate / 1000, c->frame_rate, c->duration);
|
||||
} else if (c->id == SrsVideoCodecIdHEVC) {
|
||||
err = stat->on_video_info(req_, c->id, c->hevc_profile, c->hevc_level, c->width, c->height);
|
||||
msg->size(), c->id_, srs_avc_profile2str(c->avc_profile_).c_str(), srs_avc_level2str(c->avc_level_).c_str(),
|
||||
c->width_, c->height_, c->video_data_rate_ / 1000, c->frame_rate_, c->duration_);
|
||||
} else if (c->id_ == SrsVideoCodecIdHEVC) {
|
||||
err = stat->on_video_info(req_, c->id_, c->hevc_profile_, c->hevc_level_, c->width_, c->height_);
|
||||
srs_trace("%dB video sh, codec(%d, profile=%s, level=%s, %dx%d, %dkbps, %.1ffps, %.1fs)",
|
||||
msg->size(), c->id, srs_hevc_profile2str(c->hevc_profile).c_str(), srs_hevc_level2str(c->hevc_level).c_str(),
|
||||
c->width, c->height, c->video_data_rate / 1000, c->frame_rate, c->duration);
|
||||
msg->size(), c->id_, srs_hevc_profile2str(c->hevc_profile_).c_str(), srs_hevc_level2str(c->hevc_level_).c_str(),
|
||||
c->width_, c->height_, c->video_data_rate_ / 1000, c->frame_rate_, c->duration_);
|
||||
}
|
||||
if (err != srs_success) {
|
||||
return srs_error_wrap(err, "stat video");
|
||||
|
|
@ -1062,7 +1062,7 @@ srs_error_t SrsOriginHub::on_video(SrsMediaPacket *shared_video, bool is_sequenc
|
|||
|
||||
// Ignore video data when no sps/pps
|
||||
// @bug https://github.com/ossrs/srs/issues/703#issuecomment-578393155
|
||||
if (format->vcodec && !format->vcodec->is_avc_codec_ok()) {
|
||||
if (format->vcodec_ && !format->vcodec_->is_avc_codec_ok()) {
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -1435,7 +1435,7 @@ srs_error_t SrsMetaCache::dumps(SrsLiveConsumer *consumer, bool atc, SrsRtmpJitt
|
|||
|
||||
// copy sequence header
|
||||
// copy audio sequence first, for hls to fast parse the "right" audio codec.
|
||||
if (aformat && aformat->acodec && aformat->acodec->id != SrsAudioCodecIdMP3) {
|
||||
if (aformat && aformat->acodec_ && aformat->acodec_->id_ != SrsAudioCodecIdMP3) {
|
||||
if (ds && audio && (err = consumer->enqueue(audio, atc, ag)) != srs_success) {
|
||||
return srs_error_wrap(err, "enqueue audio sh");
|
||||
}
|
||||
|
|
@ -1833,7 +1833,7 @@ srs_error_t SrsLiveSource::initialize(SrsSharedPtr<SrsLiveSource> wrapper, ISrsR
|
|||
}
|
||||
|
||||
// Setup the SPS/PPS parsing strategy.
|
||||
format_->try_annexb_first = _srs_config->try_annexb_first(r->vhost);
|
||||
format_->try_annexb_first_ = _srs_config->try_annexb_first(r->vhost);
|
||||
|
||||
if ((err = play_edge->initialize(wrapper, req)) != srs_success) {
|
||||
return srs_error_wrap(err, "edge(play)");
|
||||
|
|
@ -1933,7 +1933,7 @@ srs_error_t SrsLiveSource::on_meta_data(SrsRtmpCommonMessage *msg, SrsOnMetaData
|
|||
|
||||
// Update the meta cache.
|
||||
bool updated = false;
|
||||
if ((err = meta->update_data(&msg->header, metadata, updated)) != srs_success) {
|
||||
if ((err = meta->update_data(&msg->header_, metadata, updated)) != srs_success) {
|
||||
return srs_error_wrap(err, "update metadata");
|
||||
}
|
||||
if (!updated) {
|
||||
|
|
@ -1967,13 +1967,13 @@ srs_error_t SrsLiveSource::on_audio(SrsRtmpCommonMessage *shared_audio)
|
|||
|
||||
// Detect where stream is monotonically increasing.
|
||||
if (!mix_correct && is_monotonically_increase) {
|
||||
if (last_packet_time > 0 && shared_audio->header.timestamp < last_packet_time) {
|
||||
if (last_packet_time > 0 && shared_audio->header_.timestamp_ < last_packet_time) {
|
||||
is_monotonically_increase = false;
|
||||
srs_warn("AUDIO: Timestamp %" PRId64 "=>%" PRId64 ", may need mix_correct.",
|
||||
last_packet_time, shared_audio->header.timestamp);
|
||||
last_packet_time, shared_audio->header_.timestamp_);
|
||||
}
|
||||
}
|
||||
last_packet_time = shared_audio->header.timestamp;
|
||||
last_packet_time = shared_audio->header_.timestamp_;
|
||||
|
||||
// convert shared_audio to msg, user should not use shared_audio again.
|
||||
// the payload is transfer to msg, and set to NULL in shared_audio.
|
||||
|
|
@ -2027,7 +2027,7 @@ srs_error_t SrsLiveSource::on_audio_imp(SrsMediaPacket *msg)
|
|||
|
||||
// Ignore if no format->acodec, it means the codec is not parsed, or unsupport/unknown codec
|
||||
// such as G.711 codec
|
||||
if (!format_->acodec) {
|
||||
if (!format_->acodec_) {
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -2083,10 +2083,10 @@ srs_error_t SrsLiveSource::on_audio_imp(SrsMediaPacket *msg)
|
|||
// if atc, update the sequence header to abs time.
|
||||
if (atc) {
|
||||
if (meta->ash()) {
|
||||
meta->ash()->timestamp = msg->timestamp;
|
||||
meta->ash()->timestamp_ = msg->timestamp_;
|
||||
}
|
||||
if (meta->data()) {
|
||||
meta->data()->timestamp = msg->timestamp;
|
||||
meta->data()->timestamp_ = msg->timestamp_;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2099,13 +2099,13 @@ srs_error_t SrsLiveSource::on_video(SrsRtmpCommonMessage *shared_video)
|
|||
|
||||
// Detect where stream is monotonically increasing.
|
||||
if (!mix_correct && is_monotonically_increase) {
|
||||
if (last_packet_time > 0 && shared_video->header.timestamp < last_packet_time) {
|
||||
if (last_packet_time > 0 && shared_video->header_.timestamp_ < last_packet_time) {
|
||||
is_monotonically_increase = false;
|
||||
srs_warn("VIDEO: Timestamp %" PRId64 "=>%" PRId64 ", may need mix_correct.",
|
||||
last_packet_time, shared_video->header.timestamp);
|
||||
last_packet_time, shared_video->header_.timestamp_);
|
||||
}
|
||||
}
|
||||
last_packet_time = shared_video->header.timestamp;
|
||||
last_packet_time = shared_video->header_.timestamp_;
|
||||
|
||||
// drop any unknown header video.
|
||||
// @see https://github.com/ossrs/srs/issues/421
|
||||
|
|
@ -2136,7 +2136,7 @@ srs_error_t SrsLiveSource::on_video_imp(SrsMediaPacket *msg)
|
|||
// user can disable the sps parse to workaround when parse sps failed.
|
||||
// @see https://github.com/ossrs/srs/issues/474
|
||||
if (is_sequence_header) {
|
||||
format_->avc_parse_sps = _srs_config->get_parse_sps(req->vhost);
|
||||
format_->avc_parse_sps_ = _srs_config->get_parse_sps(req->vhost);
|
||||
}
|
||||
|
||||
if ((err = format_->on_video(msg)) != srs_success) {
|
||||
|
|
@ -2145,7 +2145,7 @@ srs_error_t SrsLiveSource::on_video_imp(SrsMediaPacket *msg)
|
|||
|
||||
// Ignore if no format->vcodec, it means the codec is not parsed, or unsupport/unknown codec
|
||||
// such as H.263 codec
|
||||
if (!format_->vcodec) {
|
||||
if (!format_->vcodec_) {
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -2197,10 +2197,10 @@ srs_error_t SrsLiveSource::on_video_imp(SrsMediaPacket *msg)
|
|||
// if atc, update the sequence header to abs time.
|
||||
if (atc) {
|
||||
if (meta->vsh()) {
|
||||
meta->vsh()->timestamp = msg->timestamp;
|
||||
meta->vsh()->timestamp_ = msg->timestamp_;
|
||||
}
|
||||
if (meta->data()) {
|
||||
meta->data()->timestamp = msg->timestamp;
|
||||
meta->data()->timestamp_ = msg->timestamp_;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2247,7 +2247,7 @@ srs_error_t SrsLiveSource::on_aggregate(SrsRtmpCommonMessage *msg)
|
|||
// adjust abs timestamp in aggregate msg.
|
||||
// only -1 means uninitialized delta.
|
||||
if (delta == -1) {
|
||||
delta = (int)msg->header.timestamp - (int)timestamp;
|
||||
delta = (int)msg->header_.timestamp_ - (int)timestamp;
|
||||
}
|
||||
timestamp += delta;
|
||||
|
||||
|
|
@ -2263,11 +2263,11 @@ srs_error_t SrsLiveSource::on_aggregate(SrsRtmpCommonMessage *msg)
|
|||
// to common message.
|
||||
SrsRtmpCommonMessage o;
|
||||
|
||||
o.header.message_type = type;
|
||||
o.header.payload_length = data_size;
|
||||
o.header.timestamp_delta = timestamp;
|
||||
o.header.timestamp = timestamp;
|
||||
o.header.stream_id = stream_id;
|
||||
o.header_.message_type_ = type;
|
||||
o.header_.payload_length_ = data_size;
|
||||
o.header_.timestamp_delta_ = timestamp;
|
||||
o.header_.timestamp_ = timestamp;
|
||||
o.header_.stream_id_ = stream_id;
|
||||
|
||||
if (data_size > 0) {
|
||||
o.create_payload(data_size);
|
||||
|
|
@ -2280,11 +2280,11 @@ srs_error_t SrsLiveSource::on_aggregate(SrsRtmpCommonMessage *msg)
|
|||
stream->read_4bytes();
|
||||
|
||||
// process parsed message
|
||||
if (o.header.is_audio()) {
|
||||
if (o.header_.is_audio()) {
|
||||
if ((err = on_audio(&o)) != srs_success) {
|
||||
return srs_error_wrap(err, "consume audio");
|
||||
}
|
||||
} else if (o.header.is_video()) {
|
||||
} else if (o.header_.is_video()) {
|
||||
if ((err = on_video(&o)) != srs_success) {
|
||||
return srs_error_wrap(err, "consume video");
|
||||
}
|
||||
|
|
@ -2431,13 +2431,13 @@ srs_error_t SrsLiveSource::consumer_dumps(SrsLiveConsumer *consumer, bool ds, bo
|
|||
// if atc, update the sequence header to gop cache time.
|
||||
if (atc && !gop_cache->empty()) {
|
||||
if (meta->data()) {
|
||||
meta->data()->timestamp = srsu2ms(gop_cache->start_time());
|
||||
meta->data()->timestamp_ = srsu2ms(gop_cache->start_time());
|
||||
}
|
||||
if (meta->vsh()) {
|
||||
meta->vsh()->timestamp = srsu2ms(gop_cache->start_time());
|
||||
meta->vsh()->timestamp_ = srsu2ms(gop_cache->start_time());
|
||||
}
|
||||
if (meta->ash()) {
|
||||
meta->ash()->timestamp = srsu2ms(gop_cache->start_time());
|
||||
meta->ash()->timestamp_ = srsu2ms(gop_cache->start_time());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -366,40 +366,40 @@ srs_error_t SrsSrtFrameBuilder::on_ts_message(SrsTsMessage *msg)
|
|||
|
||||
// When the audio SID is private stream 1, we use common audio.
|
||||
// @see https://github.com/ossrs/srs/issues/740
|
||||
if (msg->channel->apply == SrsTsPidApplyAudio && msg->sid == SrsTsPESStreamIdPrivateStream1) {
|
||||
msg->sid = SrsTsPESStreamIdAudioCommon;
|
||||
if (msg->channel_->apply_ == SrsTsPidApplyAudio && msg->sid_ == SrsTsPESStreamIdPrivateStream1) {
|
||||
msg->sid_ = SrsTsPESStreamIdAudioCommon;
|
||||
}
|
||||
|
||||
// when not audio/video, or not adts/annexb format, donot support.
|
||||
if (msg->stream_number() != 0) {
|
||||
return srs_error_new(ERROR_STREAM_CASTER_TS_ES, "ts: unsupported stream format, sid=%#x(%s-%d)",
|
||||
msg->sid, msg->is_audio() ? "A" : msg->is_video() ? "V"
|
||||
: "N",
|
||||
msg->sid_, msg->is_audio() ? "A" : msg->is_video() ? "V"
|
||||
: "N",
|
||||
msg->stream_number());
|
||||
}
|
||||
|
||||
// check supported codec
|
||||
if (msg->channel->stream != SrsTsStreamVideoH264 && msg->channel->stream != SrsTsStreamVideoHEVC && msg->channel->stream != SrsTsStreamAudioAAC) {
|
||||
return srs_error_new(ERROR_STREAM_CASTER_TS_CODEC, "ts: unsupported stream codec=%d", msg->channel->stream);
|
||||
if (msg->channel_->stream_ != SrsTsStreamVideoH264 && msg->channel_->stream_ != SrsTsStreamVideoHEVC && msg->channel_->stream_ != SrsTsStreamAudioAAC) {
|
||||
return srs_error_new(ERROR_STREAM_CASTER_TS_CODEC, "ts: unsupported stream codec=%d", msg->channel_->stream_);
|
||||
}
|
||||
|
||||
// parse the stream.
|
||||
SrsBuffer avs(msg->payload->bytes(), msg->payload->length());
|
||||
SrsBuffer avs(msg->payload_->bytes(), msg->payload_->length());
|
||||
|
||||
// publish audio or video.
|
||||
if (msg->channel->stream == SrsTsStreamVideoH264) {
|
||||
if (msg->channel_->stream_ == SrsTsStreamVideoH264) {
|
||||
if ((err = on_ts_video_avc(msg, &avs)) != srs_success) {
|
||||
return srs_error_wrap(err, "ts: consume video");
|
||||
}
|
||||
}
|
||||
if (msg->channel->stream == SrsTsStreamAudioAAC) {
|
||||
if (msg->channel_->stream_ == SrsTsStreamAudioAAC) {
|
||||
if ((err = on_ts_audio(msg, &avs)) != srs_success) {
|
||||
return srs_error_wrap(err, "ts: consume audio");
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: FIXME: implements other codec?
|
||||
if (msg->channel->stream == SrsTsStreamVideoHEVC) {
|
||||
if (msg->channel_->stream_ == SrsTsStreamVideoHEVC) {
|
||||
if ((err = on_ts_video_hevc(msg, &avs)) != srs_success) {
|
||||
return srs_error_wrap(err, "ts: consume hevc video");
|
||||
}
|
||||
|
|
@ -484,7 +484,7 @@ srs_error_t SrsSrtFrameBuilder::check_sps_pps_change(SrsTsMessage *msg)
|
|||
sps_pps_change_ = false;
|
||||
|
||||
// ts tbn to flv tbn.
|
||||
uint32_t dts = (uint32_t)(msg->dts / 90);
|
||||
uint32_t dts = (uint32_t)(msg->dts_ / 90);
|
||||
|
||||
std::string sh;
|
||||
SrsUniquePtr<SrsRawH264Stream> avc(new SrsRawH264Stream());
|
||||
|
|
@ -528,8 +528,8 @@ srs_error_t SrsSrtFrameBuilder::on_h264_frame(SrsTsMessage *msg, vector<pair<cha
|
|||
bool is_keyframe = false;
|
||||
|
||||
// ts tbn to flv tbn.
|
||||
uint32_t dts = (uint32_t)(msg->dts / 90);
|
||||
uint32_t pts = (uint32_t)(msg->pts / 90);
|
||||
uint32_t dts = (uint32_t)(msg->dts_ / 90);
|
||||
uint32_t pts = (uint32_t)(msg->pts_ / 90);
|
||||
int32_t cts = pts - dts;
|
||||
|
||||
int frame_size = 5; // 5bytes video tag header
|
||||
|
|
@ -542,7 +542,7 @@ srs_error_t SrsSrtFrameBuilder::on_h264_frame(SrsTsMessage *msg, vector<pair<cha
|
|||
}
|
||||
|
||||
SrsRtmpCommonMessage rtmp;
|
||||
rtmp.header.initialize_video(frame_size, dts, video_streamid_);
|
||||
rtmp.header_.initialize_video(frame_size, dts, video_streamid_);
|
||||
rtmp.create_payload(frame_size);
|
||||
SrsBuffer payload(rtmp.payload(), rtmp.size());
|
||||
// Write 5bytes video tag header.
|
||||
|
|
@ -670,7 +670,7 @@ srs_error_t SrsSrtFrameBuilder::check_vps_sps_pps_change(SrsTsMessage *msg)
|
|||
vps_sps_pps_change_ = false;
|
||||
|
||||
// ts tbn to flv tbn.
|
||||
uint32_t dts = (uint32_t)(msg->dts / 90);
|
||||
uint32_t dts = (uint32_t)(msg->dts_ / 90);
|
||||
|
||||
std::string sh;
|
||||
SrsUniquePtr<SrsRawHEVCStream> hevc(new SrsRawHEVCStream());
|
||||
|
|
@ -712,8 +712,8 @@ srs_error_t SrsSrtFrameBuilder::on_hevc_frame(SrsTsMessage *msg, vector<pair<cha
|
|||
}
|
||||
|
||||
// ts tbn to flv tbn.
|
||||
uint32_t dts = (uint32_t)(msg->dts / 90);
|
||||
uint32_t pts = (uint32_t)(msg->pts / 90);
|
||||
uint32_t dts = (uint32_t)(msg->dts_ / 90);
|
||||
uint32_t pts = (uint32_t)(msg->pts_ / 90);
|
||||
int32_t cts = pts - dts;
|
||||
|
||||
// for IDR frame, the frame is keyframe.
|
||||
|
|
@ -731,7 +731,7 @@ srs_error_t SrsSrtFrameBuilder::on_hevc_frame(SrsTsMessage *msg, vector<pair<cha
|
|||
}
|
||||
|
||||
SrsRtmpCommonMessage rtmp;
|
||||
rtmp.header.initialize_video(frame_size, dts, video_streamid_);
|
||||
rtmp.header_.initialize_video(frame_size, dts, video_streamid_);
|
||||
rtmp.create_payload(frame_size);
|
||||
SrsBuffer payload(rtmp.payload(), rtmp.size());
|
||||
|
||||
|
|
@ -775,7 +775,7 @@ srs_error_t SrsSrtFrameBuilder::on_ts_audio(SrsTsMessage *msg, SrsBuffer *avs)
|
|||
SrsUniquePtr<SrsRawAacStream> aac(new SrsRawAacStream());
|
||||
|
||||
// ts tbn to flv tbn.
|
||||
uint32_t pts = (uint32_t)(msg->pts / 90);
|
||||
uint32_t pts = (uint32_t)(msg->pts_ / 90);
|
||||
|
||||
int frame_idx = 0;
|
||||
int duration_ms = 0;
|
||||
|
|
@ -863,7 +863,7 @@ srs_error_t SrsSrtFrameBuilder::check_audio_sh_change(SrsTsMessage *msg, uint32_
|
|||
int rtmp_len = audio_sh_.size() + 2;
|
||||
|
||||
SrsRtmpCommonMessage rtmp;
|
||||
rtmp.header.initialize_audio(rtmp_len, pts, audio_streamid_);
|
||||
rtmp.header_.initialize_audio(rtmp_len, pts, audio_streamid_);
|
||||
rtmp.create_payload(rtmp_len);
|
||||
|
||||
SrsBuffer stream(rtmp.payload(), rtmp_len);
|
||||
|
|
@ -889,7 +889,7 @@ srs_error_t SrsSrtFrameBuilder::on_aac_frame(SrsTsMessage *msg, uint32_t pts, ch
|
|||
int rtmp_len = data_size + 2 /* 2 bytes of flv audio tag header*/;
|
||||
|
||||
SrsRtmpCommonMessage rtmp;
|
||||
rtmp.header.initialize_audio(rtmp_len, pts, audio_streamid_);
|
||||
rtmp.header_.initialize_audio(rtmp_len, pts, audio_streamid_);
|
||||
rtmp.create_payload(rtmp_len);
|
||||
|
||||
SrsBuffer stream(rtmp.payload(), rtmp_len);
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ srs_error_t SrsStatisticStream::dumps(SrsJsonObject *obj)
|
|||
obj->set("url", SrsJsonAny::str(url.c_str()));
|
||||
obj->set("live_ms", SrsJsonAny::integer(srsu2ms(srs_time_now_cached())));
|
||||
obj->set("clients", SrsJsonAny::integer(nb_clients));
|
||||
obj->set("frames", SrsJsonAny::integer(frames->sugar));
|
||||
obj->set("frames", SrsJsonAny::integer(frames->sugar_));
|
||||
obj->set("send_bytes", SrsJsonAny::integer(kbps->get_send_bytes()));
|
||||
obj->set("recv_bytes", SrsJsonAny::integer(kbps->get_recv_bytes()));
|
||||
|
||||
|
|
@ -395,7 +395,7 @@ srs_error_t SrsStatistic::on_video_frames(ISrsRequest *req, int nb_frames)
|
|||
SrsStatisticVhost *vhost = create_vhost(req);
|
||||
SrsStatisticStream *stream = create_stream(vhost, req);
|
||||
|
||||
stream->frames->sugar += nb_frames;
|
||||
stream->frames->sugar_ += nb_frames;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@
|
|||
|
||||
#define VERSION_MAJOR 7
|
||||
#define VERSION_MINOR 0
|
||||
#define VERSION_REVISION 81
|
||||
#define VERSION_REVISION 82
|
||||
|
||||
#endif
|
||||
|
|
@ -24,11 +24,11 @@ using namespace std;
|
|||
|
||||
SrsAacTransmuxer::SrsAacTransmuxer()
|
||||
{
|
||||
writer = NULL;
|
||||
got_sequence_header = false;
|
||||
aac_object = SrsAacObjectTypeReserved;
|
||||
aac_sample_rate = 0;
|
||||
aac_channels = 0;
|
||||
writer_ = NULL;
|
||||
got_sequence_header_ = false;
|
||||
aac_object_ = SrsAacObjectTypeReserved;
|
||||
aac_sample_rate_ = 0;
|
||||
aac_channels_ = 0;
|
||||
}
|
||||
|
||||
SrsAacTransmuxer::~SrsAacTransmuxer()
|
||||
|
|
@ -41,7 +41,7 @@ srs_error_t SrsAacTransmuxer::initialize(ISrsStreamWriter *fs)
|
|||
|
||||
srs_assert(fs);
|
||||
|
||||
writer = fs;
|
||||
writer_ = fs;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
@ -91,20 +91,20 @@ srs_error_t SrsAacTransmuxer::write_audio(int64_t timestamp, char *data, int siz
|
|||
}
|
||||
|
||||
int8_t audioObjectType = stream->read_1bytes();
|
||||
aac_sample_rate = stream->read_1bytes();
|
||||
aac_sample_rate_ = stream->read_1bytes();
|
||||
|
||||
aac_channels = (aac_sample_rate >> 3) & 0x0f;
|
||||
aac_sample_rate = ((audioObjectType << 1) & 0x0e) | ((aac_sample_rate >> 7) & 0x01);
|
||||
aac_channels_ = (aac_sample_rate_ >> 3) & 0x0f;
|
||||
aac_sample_rate_ = ((audioObjectType << 1) & 0x0e) | ((aac_sample_rate_ >> 7) & 0x01);
|
||||
|
||||
audioObjectType = (audioObjectType >> 3) & 0x1f;
|
||||
aac_object = (SrsAacObjectType)audioObjectType;
|
||||
aac_object_ = (SrsAacObjectType)audioObjectType;
|
||||
|
||||
got_sequence_header = true;
|
||||
got_sequence_header_ = true;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
if (!got_sequence_header) {
|
||||
if (!got_sequence_header_) {
|
||||
return srs_error_new(ERROR_AAC_DECODE_ERROR, "aac no sequence header");
|
||||
}
|
||||
|
||||
|
|
@ -149,13 +149,13 @@ srs_error_t SrsAacTransmuxer::write_audio(int64_t timestamp, char *data, int siz
|
|||
// channel_configuration 3 uimsbf
|
||||
// original/copy 1 bslbf
|
||||
// home 1 bslbf
|
||||
SrsAacProfile aac_profile = srs_aac_rtmp2ts(aac_object);
|
||||
*pp++ = ((aac_profile << 6) & 0xc0) | ((aac_sample_rate << 2) & 0x3c) | ((aac_channels >> 2) & 0x01);
|
||||
SrsAacProfile aac_profile = srs_aac_rtmp2ts(aac_object_);
|
||||
*pp++ = ((aac_profile << 6) & 0xc0) | ((aac_sample_rate_ << 2) & 0x3c) | ((aac_channels_ >> 2) & 0x01);
|
||||
// 4bits left.
|
||||
// adts_variable_header(), 1.A.2.2.2 Variable Header of ADTS
|
||||
// copyright_identification_bit 1 bslbf
|
||||
// copyright_identification_start 1 bslbf
|
||||
*pp++ = ((aac_channels << 6) & 0xc0) | ((aac_frame_length >> 11) & 0x03);
|
||||
*pp++ = ((aac_channels_ << 6) & 0xc0) | ((aac_frame_length >> 11) & 0x03);
|
||||
|
||||
// aac_frame_length 13 bslbf: Length of the frame including headers and error_check in bytes.
|
||||
// use the left 2bits as the 13 and 12 bit,
|
||||
|
|
@ -169,12 +169,12 @@ srs_error_t SrsAacTransmuxer::write_audio(int64_t timestamp, char *data, int siz
|
|||
}
|
||||
|
||||
// write 7bytes fixed header.
|
||||
if ((err = writer->write(aac_fixed_header, 7, NULL)) != srs_success) {
|
||||
if ((err = writer_->write(aac_fixed_header, 7, NULL)) != srs_success) {
|
||||
return srs_error_wrap(err, "write aac header");
|
||||
}
|
||||
|
||||
// write aac frame body.
|
||||
if ((err = writer->write(data + stream->pos(), aac_raw_length, NULL)) != srs_success) {
|
||||
if ((err = writer_->write(data + stream->pos(), aac_raw_length, NULL)) != srs_success) {
|
||||
return srs_error_wrap(err, "write aac frame");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,13 +20,13 @@ class ISrsStreamWriter;
|
|||
class SrsAacTransmuxer
|
||||
{
|
||||
private:
|
||||
ISrsStreamWriter *writer;
|
||||
ISrsStreamWriter *writer_;
|
||||
|
||||
private:
|
||||
SrsAacObjectType aac_object;
|
||||
int8_t aac_sample_rate;
|
||||
int8_t aac_channels;
|
||||
bool got_sequence_header;
|
||||
SrsAacObjectType aac_object_;
|
||||
int8_t aac_sample_rate_;
|
||||
int8_t aac_channels_;
|
||||
bool got_sequence_header_;
|
||||
|
||||
public:
|
||||
SrsAacTransmuxer();
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ ISrsLbRoundRobin::~ISrsLbRoundRobin()
|
|||
|
||||
SrsLbRoundRobin::SrsLbRoundRobin()
|
||||
{
|
||||
index = -1;
|
||||
count = 0;
|
||||
index_ = -1;
|
||||
count_ = 0;
|
||||
}
|
||||
|
||||
SrsLbRoundRobin::~SrsLbRoundRobin()
|
||||
|
|
@ -30,20 +30,20 @@ SrsLbRoundRobin::~SrsLbRoundRobin()
|
|||
|
||||
uint32_t SrsLbRoundRobin::current()
|
||||
{
|
||||
return index;
|
||||
return index_;
|
||||
}
|
||||
|
||||
string SrsLbRoundRobin::selected()
|
||||
{
|
||||
return elem;
|
||||
return elem_;
|
||||
}
|
||||
|
||||
string SrsLbRoundRobin::select(const vector<string> &servers)
|
||||
{
|
||||
srs_assert(!servers.empty());
|
||||
|
||||
index = (int)(count++ % servers.size());
|
||||
elem = servers.at(index);
|
||||
index_ = (int)(count_++ % servers.size());
|
||||
elem_ = servers.at(index_);
|
||||
|
||||
return elem;
|
||||
return elem_;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,9 +51,9 @@ public:
|
|||
class SrsLbRoundRobin : public ISrsLbRoundRobin
|
||||
{
|
||||
private:
|
||||
int index;
|
||||
uint32_t count;
|
||||
std::string elem;
|
||||
int index_;
|
||||
uint32_t count_;
|
||||
std::string elem_;
|
||||
|
||||
public:
|
||||
SrsLbRoundRobin();
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ ISrsCodec::~ISrsCodec()
|
|||
|
||||
SrsBuffer::SrsBuffer(char *b, int nn)
|
||||
{
|
||||
p = bytes = b;
|
||||
nb_bytes = nn;
|
||||
p_ = bytes_ = b;
|
||||
nb_bytes_ = nn;
|
||||
}
|
||||
|
||||
SrsBuffer::~SrsBuffer()
|
||||
|
|
@ -48,44 +48,44 @@ SrsBuffer::~SrsBuffer()
|
|||
|
||||
SrsBuffer *SrsBuffer::copy()
|
||||
{
|
||||
SrsBuffer *cp = new SrsBuffer(bytes, nb_bytes);
|
||||
cp->p = p;
|
||||
SrsBuffer *cp = new SrsBuffer(bytes_, nb_bytes_);
|
||||
cp->p_ = p_;
|
||||
return cp;
|
||||
}
|
||||
|
||||
char *SrsBuffer::data()
|
||||
{
|
||||
return bytes;
|
||||
return bytes_;
|
||||
}
|
||||
|
||||
char *SrsBuffer::head()
|
||||
{
|
||||
return p;
|
||||
return p_;
|
||||
}
|
||||
|
||||
int SrsBuffer::size()
|
||||
{
|
||||
return nb_bytes;
|
||||
return nb_bytes_;
|
||||
}
|
||||
|
||||
void SrsBuffer::set_size(int v)
|
||||
{
|
||||
nb_bytes = v;
|
||||
nb_bytes_ = v;
|
||||
}
|
||||
|
||||
int SrsBuffer::pos()
|
||||
{
|
||||
return (int)(p - bytes);
|
||||
return (int)(p_ - bytes_);
|
||||
}
|
||||
|
||||
int SrsBuffer::left()
|
||||
{
|
||||
return nb_bytes - (int)(p - bytes);
|
||||
return nb_bytes_ - (int)(p_ - bytes_);
|
||||
}
|
||||
|
||||
bool SrsBuffer::empty()
|
||||
{
|
||||
return !bytes || (p >= bytes + nb_bytes);
|
||||
return !bytes_ || (p_ >= bytes_ + nb_bytes_);
|
||||
}
|
||||
|
||||
bool SrsBuffer::require(int required_size)
|
||||
|
|
@ -94,23 +94,23 @@ bool SrsBuffer::require(int required_size)
|
|||
return false;
|
||||
}
|
||||
|
||||
return required_size <= nb_bytes - (p - bytes);
|
||||
return required_size <= nb_bytes_ - (p_ - bytes_);
|
||||
}
|
||||
|
||||
void SrsBuffer::skip(int size)
|
||||
{
|
||||
srs_assert(p);
|
||||
srs_assert(p + size >= bytes);
|
||||
srs_assert(p + size <= bytes + nb_bytes);
|
||||
srs_assert(p_);
|
||||
srs_assert(p_ + size >= bytes_);
|
||||
srs_assert(p_ + size <= bytes_ + nb_bytes_);
|
||||
|
||||
p += size;
|
||||
p_ += size;
|
||||
}
|
||||
|
||||
int8_t SrsBuffer::read_1bytes()
|
||||
{
|
||||
srs_assert(require(1));
|
||||
|
||||
return (int8_t)*p++;
|
||||
return (int8_t)*p_++;
|
||||
}
|
||||
|
||||
int16_t SrsBuffer::read_2bytes()
|
||||
|
|
@ -119,8 +119,8 @@ int16_t SrsBuffer::read_2bytes()
|
|||
|
||||
int16_t value;
|
||||
char *pp = (char *)&value;
|
||||
pp[1] = *p++;
|
||||
pp[0] = *p++;
|
||||
pp[1] = *p_++;
|
||||
pp[0] = *p_++;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
|
@ -131,8 +131,8 @@ int16_t SrsBuffer::read_le2bytes()
|
|||
|
||||
int16_t value;
|
||||
char *pp = (char *)&value;
|
||||
pp[0] = *p++;
|
||||
pp[1] = *p++;
|
||||
pp[0] = *p_++;
|
||||
pp[1] = *p_++;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
|
@ -143,9 +143,9 @@ int32_t SrsBuffer::read_3bytes()
|
|||
|
||||
int32_t value = 0x00;
|
||||
char *pp = (char *)&value;
|
||||
pp[2] = *p++;
|
||||
pp[1] = *p++;
|
||||
pp[0] = *p++;
|
||||
pp[2] = *p_++;
|
||||
pp[1] = *p_++;
|
||||
pp[0] = *p_++;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
|
@ -156,9 +156,9 @@ int32_t SrsBuffer::read_le3bytes()
|
|||
|
||||
int32_t value = 0x00;
|
||||
char *pp = (char *)&value;
|
||||
pp[0] = *p++;
|
||||
pp[1] = *p++;
|
||||
pp[2] = *p++;
|
||||
pp[0] = *p_++;
|
||||
pp[1] = *p_++;
|
||||
pp[2] = *p_++;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
|
@ -169,10 +169,10 @@ int32_t SrsBuffer::read_4bytes()
|
|||
|
||||
int32_t value;
|
||||
char *pp = (char *)&value;
|
||||
pp[3] = *p++;
|
||||
pp[2] = *p++;
|
||||
pp[1] = *p++;
|
||||
pp[0] = *p++;
|
||||
pp[3] = *p_++;
|
||||
pp[2] = *p_++;
|
||||
pp[1] = *p_++;
|
||||
pp[0] = *p_++;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
|
@ -183,10 +183,10 @@ int32_t SrsBuffer::read_le4bytes()
|
|||
|
||||
int32_t value;
|
||||
char *pp = (char *)&value;
|
||||
pp[0] = *p++;
|
||||
pp[1] = *p++;
|
||||
pp[2] = *p++;
|
||||
pp[3] = *p++;
|
||||
pp[0] = *p_++;
|
||||
pp[1] = *p_++;
|
||||
pp[2] = *p_++;
|
||||
pp[3] = *p_++;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
|
@ -197,14 +197,14 @@ int64_t SrsBuffer::read_8bytes()
|
|||
|
||||
int64_t value;
|
||||
char *pp = (char *)&value;
|
||||
pp[7] = *p++;
|
||||
pp[6] = *p++;
|
||||
pp[5] = *p++;
|
||||
pp[4] = *p++;
|
||||
pp[3] = *p++;
|
||||
pp[2] = *p++;
|
||||
pp[1] = *p++;
|
||||
pp[0] = *p++;
|
||||
pp[7] = *p_++;
|
||||
pp[6] = *p_++;
|
||||
pp[5] = *p_++;
|
||||
pp[4] = *p_++;
|
||||
pp[3] = *p_++;
|
||||
pp[2] = *p_++;
|
||||
pp[1] = *p_++;
|
||||
pp[0] = *p_++;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
|
@ -215,14 +215,14 @@ int64_t SrsBuffer::read_le8bytes()
|
|||
|
||||
int64_t value;
|
||||
char *pp = (char *)&value;
|
||||
pp[0] = *p++;
|
||||
pp[1] = *p++;
|
||||
pp[2] = *p++;
|
||||
pp[3] = *p++;
|
||||
pp[4] = *p++;
|
||||
pp[5] = *p++;
|
||||
pp[6] = *p++;
|
||||
pp[7] = *p++;
|
||||
pp[0] = *p_++;
|
||||
pp[1] = *p_++;
|
||||
pp[2] = *p_++;
|
||||
pp[3] = *p_++;
|
||||
pp[4] = *p_++;
|
||||
pp[5] = *p_++;
|
||||
pp[6] = *p_++;
|
||||
pp[7] = *p_++;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
|
@ -232,9 +232,9 @@ string SrsBuffer::read_string(int len)
|
|||
srs_assert(require(len));
|
||||
|
||||
std::string value;
|
||||
value.append(p, len);
|
||||
value.append(p_, len);
|
||||
|
||||
p += len;
|
||||
p_ += len;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
|
@ -243,16 +243,16 @@ void SrsBuffer::read_bytes(char *data, int size)
|
|||
{
|
||||
srs_assert(require(size));
|
||||
|
||||
memcpy(data, p, size);
|
||||
memcpy(data, p_, size);
|
||||
|
||||
p += size;
|
||||
p_ += size;
|
||||
}
|
||||
|
||||
void SrsBuffer::write_1bytes(int8_t value)
|
||||
{
|
||||
srs_assert(require(1));
|
||||
|
||||
*p++ = value;
|
||||
*p_++ = value;
|
||||
}
|
||||
|
||||
void SrsBuffer::write_2bytes(int16_t value)
|
||||
|
|
@ -260,8 +260,8 @@ void SrsBuffer::write_2bytes(int16_t value)
|
|||
srs_assert(require(2));
|
||||
|
||||
char *pp = (char *)&value;
|
||||
*p++ = pp[1];
|
||||
*p++ = pp[0];
|
||||
*p_++ = pp[1];
|
||||
*p_++ = pp[0];
|
||||
}
|
||||
|
||||
void SrsBuffer::write_le2bytes(int16_t value)
|
||||
|
|
@ -269,8 +269,8 @@ void SrsBuffer::write_le2bytes(int16_t value)
|
|||
srs_assert(require(2));
|
||||
|
||||
char *pp = (char *)&value;
|
||||
*p++ = pp[0];
|
||||
*p++ = pp[1];
|
||||
*p_++ = pp[0];
|
||||
*p_++ = pp[1];
|
||||
}
|
||||
|
||||
void SrsBuffer::write_4bytes(int32_t value)
|
||||
|
|
@ -278,10 +278,10 @@ void SrsBuffer::write_4bytes(int32_t value)
|
|||
srs_assert(require(4));
|
||||
|
||||
char *pp = (char *)&value;
|
||||
*p++ = pp[3];
|
||||
*p++ = pp[2];
|
||||
*p++ = pp[1];
|
||||
*p++ = pp[0];
|
||||
*p_++ = pp[3];
|
||||
*p_++ = pp[2];
|
||||
*p_++ = pp[1];
|
||||
*p_++ = pp[0];
|
||||
}
|
||||
|
||||
void SrsBuffer::write_le4bytes(int32_t value)
|
||||
|
|
@ -289,10 +289,10 @@ void SrsBuffer::write_le4bytes(int32_t value)
|
|||
srs_assert(require(4));
|
||||
|
||||
char *pp = (char *)&value;
|
||||
*p++ = pp[0];
|
||||
*p++ = pp[1];
|
||||
*p++ = pp[2];
|
||||
*p++ = pp[3];
|
||||
*p_++ = pp[0];
|
||||
*p_++ = pp[1];
|
||||
*p_++ = pp[2];
|
||||
*p_++ = pp[3];
|
||||
}
|
||||
|
||||
void SrsBuffer::write_3bytes(int32_t value)
|
||||
|
|
@ -300,9 +300,9 @@ void SrsBuffer::write_3bytes(int32_t value)
|
|||
srs_assert(require(3));
|
||||
|
||||
char *pp = (char *)&value;
|
||||
*p++ = pp[2];
|
||||
*p++ = pp[1];
|
||||
*p++ = pp[0];
|
||||
*p_++ = pp[2];
|
||||
*p_++ = pp[1];
|
||||
*p_++ = pp[0];
|
||||
}
|
||||
|
||||
void SrsBuffer::write_le3bytes(int32_t value)
|
||||
|
|
@ -310,9 +310,9 @@ void SrsBuffer::write_le3bytes(int32_t value)
|
|||
srs_assert(require(3));
|
||||
|
||||
char *pp = (char *)&value;
|
||||
*p++ = pp[0];
|
||||
*p++ = pp[1];
|
||||
*p++ = pp[2];
|
||||
*p_++ = pp[0];
|
||||
*p_++ = pp[1];
|
||||
*p_++ = pp[2];
|
||||
}
|
||||
|
||||
void SrsBuffer::write_8bytes(int64_t value)
|
||||
|
|
@ -320,14 +320,14 @@ void SrsBuffer::write_8bytes(int64_t value)
|
|||
srs_assert(require(8));
|
||||
|
||||
char *pp = (char *)&value;
|
||||
*p++ = pp[7];
|
||||
*p++ = pp[6];
|
||||
*p++ = pp[5];
|
||||
*p++ = pp[4];
|
||||
*p++ = pp[3];
|
||||
*p++ = pp[2];
|
||||
*p++ = pp[1];
|
||||
*p++ = pp[0];
|
||||
*p_++ = pp[7];
|
||||
*p_++ = pp[6];
|
||||
*p_++ = pp[5];
|
||||
*p_++ = pp[4];
|
||||
*p_++ = pp[3];
|
||||
*p_++ = pp[2];
|
||||
*p_++ = pp[1];
|
||||
*p_++ = pp[0];
|
||||
}
|
||||
|
||||
void SrsBuffer::write_le8bytes(int64_t value)
|
||||
|
|
@ -335,14 +335,14 @@ void SrsBuffer::write_le8bytes(int64_t value)
|
|||
srs_assert(require(8));
|
||||
|
||||
char *pp = (char *)&value;
|
||||
*p++ = pp[0];
|
||||
*p++ = pp[1];
|
||||
*p++ = pp[2];
|
||||
*p++ = pp[3];
|
||||
*p++ = pp[4];
|
||||
*p++ = pp[5];
|
||||
*p++ = pp[6];
|
||||
*p++ = pp[7];
|
||||
*p_++ = pp[0];
|
||||
*p_++ = pp[1];
|
||||
*p_++ = pp[2];
|
||||
*p_++ = pp[3];
|
||||
*p_++ = pp[4];
|
||||
*p_++ = pp[5];
|
||||
*p_++ = pp[6];
|
||||
*p_++ = pp[7];
|
||||
}
|
||||
|
||||
void SrsBuffer::write_string(string value)
|
||||
|
|
@ -353,8 +353,8 @@ void SrsBuffer::write_string(string value)
|
|||
|
||||
srs_assert(require((int)value.length()));
|
||||
|
||||
memcpy(p, value.data(), value.length());
|
||||
p += value.length();
|
||||
memcpy(p_, value.data(), value.length());
|
||||
p_ += value.length();
|
||||
}
|
||||
|
||||
void SrsBuffer::write_bytes(char *data, int size)
|
||||
|
|
@ -365,15 +365,15 @@ void SrsBuffer::write_bytes(char *data, int size)
|
|||
|
||||
srs_assert(require(size));
|
||||
|
||||
memcpy(p, data, size);
|
||||
p += size;
|
||||
memcpy(p_, data, size);
|
||||
p_ += size;
|
||||
}
|
||||
|
||||
SrsBitBuffer::SrsBitBuffer(SrsBuffer *b)
|
||||
{
|
||||
cb = 0;
|
||||
cb_left = 0;
|
||||
stream = b;
|
||||
cb_ = 0;
|
||||
cb_left_ = 0;
|
||||
stream_ = b;
|
||||
}
|
||||
|
||||
SrsBitBuffer::~SrsBitBuffer()
|
||||
|
|
@ -382,10 +382,10 @@ SrsBitBuffer::~SrsBitBuffer()
|
|||
|
||||
bool SrsBitBuffer::empty()
|
||||
{
|
||||
if (cb_left) {
|
||||
if (cb_left_) {
|
||||
return false;
|
||||
}
|
||||
return stream->empty();
|
||||
return stream_->empty();
|
||||
}
|
||||
|
||||
bool SrsBitBuffer::require_bits(int n)
|
||||
|
|
@ -399,20 +399,20 @@ bool SrsBitBuffer::require_bits(int n)
|
|||
|
||||
int8_t SrsBitBuffer::read_bit()
|
||||
{
|
||||
if (!cb_left) {
|
||||
srs_assert(!stream->empty());
|
||||
cb = stream->read_1bytes();
|
||||
cb_left = 8;
|
||||
if (!cb_left_) {
|
||||
srs_assert(!stream_->empty());
|
||||
cb_ = stream_->read_1bytes();
|
||||
cb_left_ = 8;
|
||||
}
|
||||
|
||||
int8_t v = (cb >> (cb_left - 1)) & 0x01;
|
||||
cb_left--;
|
||||
int8_t v = (cb_ >> (cb_left_ - 1)) & 0x01;
|
||||
cb_left_--;
|
||||
return v;
|
||||
}
|
||||
|
||||
int SrsBitBuffer::left_bits()
|
||||
{
|
||||
return cb_left + stream->left() * 8;
|
||||
return cb_left_ + stream_->left() * 8;
|
||||
}
|
||||
|
||||
void SrsBitBuffer::skip_bits(int n)
|
||||
|
|
@ -438,9 +438,9 @@ int32_t SrsBitBuffer::read_bits(int n)
|
|||
int8_t SrsBitBuffer::read_8bits()
|
||||
{
|
||||
// FAST_8
|
||||
if (!cb_left) {
|
||||
srs_assert(!stream->empty());
|
||||
return stream->read_1bytes();
|
||||
if (!cb_left_) {
|
||||
srs_assert(!stream_->empty());
|
||||
return stream_->read_1bytes();
|
||||
}
|
||||
|
||||
return read_bits(8);
|
||||
|
|
@ -449,9 +449,9 @@ int8_t SrsBitBuffer::read_8bits()
|
|||
int16_t SrsBitBuffer::read_16bits()
|
||||
{
|
||||
// FAST_16
|
||||
if (!cb_left) {
|
||||
srs_assert(!stream->empty());
|
||||
return stream->read_2bytes();
|
||||
if (!cb_left_) {
|
||||
srs_assert(!stream_->empty());
|
||||
return stream_->read_2bytes();
|
||||
}
|
||||
|
||||
return read_bits(16);
|
||||
|
|
@ -460,9 +460,9 @@ int16_t SrsBitBuffer::read_16bits()
|
|||
int32_t SrsBitBuffer::read_32bits()
|
||||
{
|
||||
// FAST_32
|
||||
if (!cb_left) {
|
||||
srs_assert(!stream->empty());
|
||||
return stream->read_4bytes();
|
||||
if (!cb_left_) {
|
||||
srs_assert(!stream_->empty());
|
||||
return stream_->read_4bytes();
|
||||
}
|
||||
|
||||
return read_bits(32);
|
||||
|
|
|
|||
|
|
@ -184,11 +184,11 @@ class SrsBuffer
|
|||
{
|
||||
private:
|
||||
// Current read/write position within the buffer
|
||||
char *p;
|
||||
char *p_;
|
||||
// Pointer to the start of the buffer data (not owned by this class)
|
||||
char *bytes;
|
||||
char *bytes_;
|
||||
// Total size of the buffer in bytes
|
||||
int nb_bytes;
|
||||
int nb_bytes_;
|
||||
|
||||
public:
|
||||
// Create a buffer wrapper around existing memory.
|
||||
|
|
@ -404,11 +404,11 @@ class SrsBitBuffer
|
|||
{
|
||||
private:
|
||||
// Current byte being processed (cached from stream)
|
||||
int8_t cb;
|
||||
int8_t cb_;
|
||||
// Number of unread bits remaining in current byte (0-8)
|
||||
uint8_t cb_left;
|
||||
uint8_t cb_left_;
|
||||
// Underlying byte buffer (not owned by this class)
|
||||
SrsBuffer *stream;
|
||||
SrsBuffer *stream_;
|
||||
|
||||
public:
|
||||
// Construct a bit buffer from an existing byte buffer.
|
||||
|
|
|
|||
|
|
@ -726,16 +726,16 @@ SrsCodecConfig::~SrsCodecConfig()
|
|||
|
||||
SrsAudioCodecConfig::SrsAudioCodecConfig()
|
||||
{
|
||||
id = SrsAudioCodecIdForbidden;
|
||||
sound_rate = SrsAudioSampleRateForbidden;
|
||||
sound_size = SrsAudioSampleBitsForbidden;
|
||||
sound_type = SrsAudioChannelsForbidden;
|
||||
id_ = SrsAudioCodecIdForbidden;
|
||||
sound_rate_ = SrsAudioSampleRateForbidden;
|
||||
sound_size_ = SrsAudioSampleBitsForbidden;
|
||||
sound_type_ = SrsAudioChannelsForbidden;
|
||||
|
||||
audio_data_rate = 0;
|
||||
audio_data_rate_ = 0;
|
||||
|
||||
aac_object = SrsAacObjectTypeForbidden;
|
||||
aac_sample_rate = SrsAacSampleRateUnset; // sample rate ignored
|
||||
aac_channels = 0;
|
||||
aac_object_ = SrsAacObjectTypeForbidden;
|
||||
aac_sample_rate_ = SrsAacSampleRateUnset; // sample rate ignored
|
||||
aac_channels_ = 0;
|
||||
}
|
||||
|
||||
SrsAudioCodecConfig::~SrsAudioCodecConfig()
|
||||
|
|
@ -744,23 +744,23 @@ SrsAudioCodecConfig::~SrsAudioCodecConfig()
|
|||
|
||||
bool SrsAudioCodecConfig::is_aac_codec_ok()
|
||||
{
|
||||
return !aac_extra_data.empty();
|
||||
return !aac_extra_data_.empty();
|
||||
}
|
||||
|
||||
SrsVideoCodecConfig::SrsVideoCodecConfig()
|
||||
{
|
||||
id = SrsVideoCodecIdForbidden;
|
||||
video_data_rate = 0;
|
||||
frame_rate = duration = 0;
|
||||
id_ = SrsVideoCodecIdForbidden;
|
||||
video_data_rate_ = 0;
|
||||
frame_rate_ = duration_ = 0;
|
||||
|
||||
width = 0;
|
||||
height = 0;
|
||||
width_ = 0;
|
||||
height_ = 0;
|
||||
|
||||
NAL_unit_length = 0;
|
||||
avc_profile = SrsAvcProfileReserved;
|
||||
avc_level = SrsAvcLevelReserved;
|
||||
NAL_unit_length_ = 0;
|
||||
avc_profile_ = SrsAvcProfileReserved;
|
||||
avc_level_ = SrsAvcLevelReserved;
|
||||
|
||||
payload_format = SrsAvcPayloadFormatGuess;
|
||||
payload_format_ = SrsAvcPayloadFormatGuess;
|
||||
}
|
||||
|
||||
SrsVideoCodecConfig::~SrsVideoCodecConfig()
|
||||
|
|
@ -769,7 +769,7 @@ SrsVideoCodecConfig::~SrsVideoCodecConfig()
|
|||
|
||||
bool SrsVideoCodecConfig::is_avc_codec_ok()
|
||||
{
|
||||
return !avc_extra_data.empty();
|
||||
return !avc_extra_data_.empty();
|
||||
}
|
||||
|
||||
bool srs_avc_startswith_annexb(SrsBuffer *stream, int *pnb_start_code)
|
||||
|
|
|
|||
|
|
@ -519,15 +519,15 @@ enum SrsHevcSliceType {
|
|||
};
|
||||
|
||||
struct SrsHevcNalData {
|
||||
uint16_t nal_unit_length;
|
||||
std::vector<uint8_t> nal_unit_data;
|
||||
uint16_t nal_unit_length_;
|
||||
std::vector<uint8_t> nal_unit_data_;
|
||||
};
|
||||
|
||||
struct SrsHevcHvccNalu {
|
||||
uint8_t array_completeness;
|
||||
uint8_t nal_unit_type;
|
||||
uint16_t num_nalus;
|
||||
std::vector<SrsHevcNalData> nal_data_vec;
|
||||
uint8_t array_completeness_;
|
||||
uint8_t nal_unit_type_;
|
||||
uint16_t num_nalus_;
|
||||
std::vector<SrsHevcNalData> nal_data_vec_;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -551,60 +551,60 @@ const int SrsHevcMax_PPS_COUNT = 64;
|
|||
*/
|
||||
struct SrsHevcProfileTierLevel {
|
||||
public:
|
||||
uint8_t general_profile_space;
|
||||
uint8_t general_tier_flag;
|
||||
uint8_t general_profile_idc;
|
||||
uint8_t general_profile_compatibility_flag[32];
|
||||
uint8_t general_progressive_source_flag;
|
||||
uint8_t general_interlaced_source_flag;
|
||||
uint8_t general_non_packed_constraint_flag;
|
||||
uint8_t general_frame_only_constraint_flag;
|
||||
uint8_t general_max_12bit_constraint_flag;
|
||||
uint8_t general_max_10bit_constraint_flag;
|
||||
uint8_t general_max_8bit_constraint_flag;
|
||||
uint8_t general_max_422chroma_constraint_flag;
|
||||
uint8_t general_max_420chroma_constraint_flag;
|
||||
uint8_t general_max_monochrome_constraint_flag;
|
||||
uint8_t general_intra_constraint_flag;
|
||||
uint8_t general_one_picture_only_constraint_flag;
|
||||
uint8_t general_lower_bit_rate_constraint_flag;
|
||||
uint32_t general_max_14bit_constraint_flag;
|
||||
uint8_t general_reserved_zero_7bits;
|
||||
uint64_t general_reserved_zero_33bits;
|
||||
uint64_t general_reserved_zero_34bits;
|
||||
uint64_t general_reserved_zero_35bits;
|
||||
uint64_t general_reserved_zero_43bits;
|
||||
uint8_t general_inbld_flag;
|
||||
uint8_t general_reserved_zero_bit;
|
||||
uint8_t general_level_idc;
|
||||
std::vector<uint8_t> sub_layer_profile_present_flag;
|
||||
std::vector<uint8_t> sub_layer_level_present_flag;
|
||||
uint8_t reserved_zero_2bits[8];
|
||||
std::vector<uint8_t> sub_layer_profile_space;
|
||||
std::vector<uint8_t> sub_layer_tier_flag;
|
||||
std::vector<uint8_t> sub_layer_profile_idc;
|
||||
std::vector<std::vector<uint8_t> > sub_layer_profile_compatibility_flag;
|
||||
std::vector<uint8_t> sub_layer_progressive_source_flag;
|
||||
std::vector<uint8_t> sub_layer_interlaced_source_flag;
|
||||
std::vector<uint8_t> sub_layer_non_packed_constraint_flag;
|
||||
std::vector<uint8_t> sub_layer_frame_only_constraint_flag;
|
||||
std::vector<uint8_t> sub_layer_max_12bit_constraint_flag;
|
||||
std::vector<uint8_t> sub_layer_max_10bit_constraint_flag;
|
||||
std::vector<uint8_t> sub_layer_max_8bit_constraint_flag;
|
||||
std::vector<uint8_t> sub_layer_max_422chroma_constraint_flag;
|
||||
std::vector<uint8_t> sub_layer_max_420chroma_constraint_flag;
|
||||
std::vector<uint8_t> sub_layer_max_monochrome_constraint_flag;
|
||||
std::vector<uint8_t> sub_layer_intra_constraint_flag;
|
||||
std::vector<uint8_t> sub_layer_one_picture_only_constraint_flag;
|
||||
std::vector<uint8_t> sub_layer_lower_bit_rate_constraint_flag;
|
||||
std::vector<uint8_t> sub_layer_reserved_zero_7bits;
|
||||
std::vector<uint64_t> sub_layer_reserved_zero_33bits;
|
||||
std::vector<uint64_t> sub_layer_reserved_zero_34bits;
|
||||
std::vector<uint64_t> sub_layer_reserved_zero_35bits;
|
||||
std::vector<uint64_t> sub_layer_reserved_zero_43bits;
|
||||
std::vector<uint8_t> sub_layer_inbld_flag;
|
||||
std::vector<uint8_t> sub_layer_reserved_zero_bit;
|
||||
std::vector<uint8_t> sub_layer_level_idc;
|
||||
uint8_t general_profile_space_;
|
||||
uint8_t general_tier_flag_;
|
||||
uint8_t general_profile_idc_;
|
||||
uint8_t general_profile_compatibility_flag_[32];
|
||||
uint8_t general_progressive_source_flag_;
|
||||
uint8_t general_interlaced_source_flag_;
|
||||
uint8_t general_non_packed_constraint_flag_;
|
||||
uint8_t general_frame_only_constraint_flag_;
|
||||
uint8_t general_max_12bit_constraint_flag_;
|
||||
uint8_t general_max_10bit_constraint_flag_;
|
||||
uint8_t general_max_8bit_constraint_flag_;
|
||||
uint8_t general_max_422chroma_constraint_flag_;
|
||||
uint8_t general_max_420chroma_constraint_flag_;
|
||||
uint8_t general_max_monochrome_constraint_flag_;
|
||||
uint8_t general_intra_constraint_flag_;
|
||||
uint8_t general_one_picture_only_constraint_flag_;
|
||||
uint8_t general_lower_bit_rate_constraint_flag_;
|
||||
uint32_t general_max_14bit_constraint_flag_;
|
||||
uint8_t general_reserved_zero_7bits_;
|
||||
uint64_t general_reserved_zero_33bits_;
|
||||
uint64_t general_reserved_zero_34bits_;
|
||||
uint64_t general_reserved_zero_35bits_;
|
||||
uint64_t general_reserved_zero_43bits_;
|
||||
uint8_t general_inbld_flag_;
|
||||
uint8_t general_reserved_zero_bit_;
|
||||
uint8_t general_level_idc_;
|
||||
std::vector<uint8_t> sub_layer_profile_present_flag_;
|
||||
std::vector<uint8_t> sub_layer_level_present_flag_;
|
||||
uint8_t reserved_zero_2bits_[8];
|
||||
std::vector<uint8_t> sub_layer_profile_space_;
|
||||
std::vector<uint8_t> sub_layer_tier_flag_;
|
||||
std::vector<uint8_t> sub_layer_profile_idc_;
|
||||
std::vector<std::vector<uint8_t> > sub_layer_profile_compatibility_flag_;
|
||||
std::vector<uint8_t> sub_layer_progressive_source_flag_;
|
||||
std::vector<uint8_t> sub_layer_interlaced_source_flag_;
|
||||
std::vector<uint8_t> sub_layer_non_packed_constraint_flag_;
|
||||
std::vector<uint8_t> sub_layer_frame_only_constraint_flag_;
|
||||
std::vector<uint8_t> sub_layer_max_12bit_constraint_flag_;
|
||||
std::vector<uint8_t> sub_layer_max_10bit_constraint_flag_;
|
||||
std::vector<uint8_t> sub_layer_max_8bit_constraint_flag_;
|
||||
std::vector<uint8_t> sub_layer_max_422chroma_constraint_flag_;
|
||||
std::vector<uint8_t> sub_layer_max_420chroma_constraint_flag_;
|
||||
std::vector<uint8_t> sub_layer_max_monochrome_constraint_flag_;
|
||||
std::vector<uint8_t> sub_layer_intra_constraint_flag_;
|
||||
std::vector<uint8_t> sub_layer_one_picture_only_constraint_flag_;
|
||||
std::vector<uint8_t> sub_layer_lower_bit_rate_constraint_flag_;
|
||||
std::vector<uint8_t> sub_layer_reserved_zero_7bits_;
|
||||
std::vector<uint64_t> sub_layer_reserved_zero_33bits_;
|
||||
std::vector<uint64_t> sub_layer_reserved_zero_34bits_;
|
||||
std::vector<uint64_t> sub_layer_reserved_zero_35bits_;
|
||||
std::vector<uint64_t> sub_layer_reserved_zero_43bits_;
|
||||
std::vector<uint8_t> sub_layer_inbld_flag_;
|
||||
std::vector<uint8_t> sub_layer_reserved_zero_bit_;
|
||||
std::vector<uint8_t> sub_layer_level_idc_;
|
||||
|
||||
public:
|
||||
SrsHevcProfileTierLevel();
|
||||
|
|
@ -617,11 +617,11 @@ public:
|
|||
* @doc ITU-T-H.265-2021.pdf, page 440.
|
||||
*/
|
||||
struct SrsHevcSubLayerHrdParameters {
|
||||
std::vector<int> bit_rate_value_minus1;
|
||||
std::vector<int> cpb_size_value_minus1;
|
||||
std::vector<int> cpb_size_du_value_minus1;
|
||||
std::vector<int> bit_rate_du_value_minus1;
|
||||
std::vector<uint8_t> cbr_flag;
|
||||
std::vector<int> bit_rate_value_minus1_;
|
||||
std::vector<int> cpb_size_value_minus1_;
|
||||
std::vector<int> cpb_size_du_value_minus1_;
|
||||
std::vector<int> bit_rate_du_value_minus1_;
|
||||
std::vector<uint8_t> cbr_flag_;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -630,26 +630,26 @@ struct SrsHevcSubLayerHrdParameters {
|
|||
* @doc ITU-T-H.265-2021.pdf, page 439.
|
||||
*/
|
||||
struct SrsHevcHrdParameters {
|
||||
uint8_t nal_hrd_parameters_present_flag;
|
||||
uint8_t vcl_hrd_parameters_present_flag;
|
||||
uint8_t sub_pic_hrd_params_present_flag;
|
||||
uint8_t tick_divisor_minus2;
|
||||
uint8_t du_cpb_removal_delay_increment_length_minus1;
|
||||
uint8_t sub_pic_cpb_params_in_pic_timing_sei_flag;
|
||||
uint8_t dpb_output_delay_du_length_minus1;
|
||||
uint8_t bit_rate_scale;
|
||||
uint8_t cpb_size_scale;
|
||||
uint8_t cpb_size_du_scale;
|
||||
uint8_t initial_cpb_removal_delay_length_minus1;
|
||||
uint8_t au_cpb_removal_delay_length_minus1;
|
||||
uint8_t dpb_output_delay_length_minus1;
|
||||
std::vector<uint8_t> fixed_pic_rate_general_flag;
|
||||
std::vector<uint8_t> fixed_pic_rate_within_cvs_flag;
|
||||
std::vector<int> elemental_duration_in_tc_minus1;
|
||||
std::vector<uint8_t> low_delay_hrd_flag;
|
||||
std::vector<int> cpb_cnt_minus1;
|
||||
SrsHevcSubLayerHrdParameters sub_layer_hrd_parameters; // nal
|
||||
SrsHevcSubLayerHrdParameters sub_layer_hrd_parameters_v; // vlc
|
||||
uint8_t nal_hrd_parameters_present_flag_;
|
||||
uint8_t vcl_hrd_parameters_present_flag_;
|
||||
uint8_t sub_pic_hrd_params_present_flag_;
|
||||
uint8_t tick_divisor_minus2_;
|
||||
uint8_t du_cpb_removal_delay_increment_length_minus1_;
|
||||
uint8_t sub_pic_cpb_params_in_pic_timing_sei_flag_;
|
||||
uint8_t dpb_output_delay_du_length_minus1_;
|
||||
uint8_t bit_rate_scale_;
|
||||
uint8_t cpb_size_scale_;
|
||||
uint8_t cpb_size_du_scale_;
|
||||
uint8_t initial_cpb_removal_delay_length_minus1_;
|
||||
uint8_t au_cpb_removal_delay_length_minus1_;
|
||||
uint8_t dpb_output_delay_length_minus1_;
|
||||
std::vector<uint8_t> fixed_pic_rate_general_flag_;
|
||||
std::vector<uint8_t> fixed_pic_rate_within_cvs_flag_;
|
||||
std::vector<int> elemental_duration_in_tc_minus1_;
|
||||
std::vector<uint8_t> low_delay_hrd_flag_;
|
||||
std::vector<int> cpb_cnt_minus1_;
|
||||
SrsHevcSubLayerHrdParameters sub_layer_hrd_parameters_; // nal
|
||||
SrsHevcSubLayerHrdParameters sub_layer_hrd_parameters_v_; // vlc
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -658,11 +658,11 @@ struct SrsHevcHrdParameters {
|
|||
* @doc ITU-T-H.265-2021.pdf, page 65.
|
||||
*/
|
||||
struct SrsHevcScalingListData {
|
||||
uint32_t scaling_list_pred_mode_flag[4][6];
|
||||
uint32_t scaling_list_pred_matrix_id_delta[4][6];
|
||||
int32_t scaling_list_dc_coef_minus8[4][6];
|
||||
uint32_t ScalingList[4][6][64];
|
||||
int32_t coefNum;
|
||||
uint32_t scaling_list_pred_mode_flag_[4][6];
|
||||
uint32_t scaling_list_pred_matrix_id_delta_[4][6];
|
||||
int32_t scaling_list_dc_coef_minus8_[4][6];
|
||||
uint32_t ScalingList_[4][6][64];
|
||||
int32_t coefNum_;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -671,15 +671,15 @@ struct SrsHevcScalingListData {
|
|||
* @doc ITU-T-H.265-2021.pdf, page 57.
|
||||
*/
|
||||
struct SrsHevcSpsRangeExtension {
|
||||
uint8_t transform_skip_rotation_enabled_flag;
|
||||
uint8_t transform_skip_context_enabled_flag;
|
||||
uint8_t implicit_rdpcm_enabled_flag;
|
||||
uint8_t explicit_rdpcm_enabled_flag;
|
||||
uint8_t extended_precision_processing_flag;
|
||||
uint8_t intra_smoothing_disabled_flag;
|
||||
uint8_t high_precision_offsets_enabled_flag;
|
||||
uint8_t persistent_rice_adaptation_enabled_flag;
|
||||
uint8_t cabac_bypass_alignment_enabled_flag;
|
||||
uint8_t transform_skip_rotation_enabled_flag_;
|
||||
uint8_t transform_skip_context_enabled_flag_;
|
||||
uint8_t implicit_rdpcm_enabled_flag_;
|
||||
uint8_t explicit_rdpcm_enabled_flag_;
|
||||
uint8_t extended_precision_processing_flag_;
|
||||
uint8_t intra_smoothing_disabled_flag_;
|
||||
uint8_t high_precision_offsets_enabled_flag_;
|
||||
uint8_t persistent_rice_adaptation_enabled_flag_;
|
||||
uint8_t cabac_bypass_alignment_enabled_flag_;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -688,15 +688,15 @@ struct SrsHevcSpsRangeExtension {
|
|||
* @doc ITU-T-H.265-2021.pdf, page 57.
|
||||
*/
|
||||
struct SrsHevcPpsRangeExtension {
|
||||
uint32_t log2_max_transform_skip_block_size_minus2;
|
||||
uint8_t cross_component_prediction_enabled_flag;
|
||||
uint8_t chroma_qp_offset_list_enabled_flag;
|
||||
uint32_t diff_cu_chroma_qp_offset_depth;
|
||||
uint32_t chroma_qp_offset_list_len_minus1;
|
||||
std::vector<int> cb_qp_offset_list;
|
||||
std::vector<int> cr_qp_offset_list;
|
||||
uint32_t log2_sao_offset_scale_luma;
|
||||
uint32_t log2_sao_offset_scale_chroma;
|
||||
uint32_t log2_max_transform_skip_block_size_minus2_;
|
||||
uint8_t cross_component_prediction_enabled_flag_;
|
||||
uint8_t chroma_qp_offset_list_enabled_flag_;
|
||||
uint32_t diff_cu_chroma_qp_offset_depth_;
|
||||
uint32_t chroma_qp_offset_list_len_minus1_;
|
||||
std::vector<int> cb_qp_offset_list_;
|
||||
std::vector<int> cr_qp_offset_list_;
|
||||
uint32_t log2_sao_offset_scale_luma_;
|
||||
uint32_t log2_sao_offset_scale_chroma_;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -705,19 +705,19 @@ struct SrsHevcPpsRangeExtension {
|
|||
* @doc ITU-T-H.265-2021.pdf, page 70.
|
||||
*/
|
||||
struct SrsHevcStRefPicSet {
|
||||
uint8_t inter_ref_pic_set_prediction_flag;
|
||||
int delta_idx_minus1;
|
||||
uint8_t delta_rps_sign;
|
||||
int abs_delta_rps_minus1;
|
||||
std::vector<uint8_t> used_by_curr_pic_flag;
|
||||
std::vector<uint8_t> use_delta_flag;
|
||||
int num_negative_pics;
|
||||
int num_positive_pics;
|
||||
uint8_t inter_ref_pic_set_prediction_flag_;
|
||||
int delta_idx_minus1_;
|
||||
uint8_t delta_rps_sign_;
|
||||
int abs_delta_rps_minus1_;
|
||||
std::vector<uint8_t> used_by_curr_pic_flag_;
|
||||
std::vector<uint8_t> use_delta_flag_;
|
||||
int num_negative_pics_;
|
||||
int num_positive_pics_;
|
||||
|
||||
std::vector<int> delta_poc_s0_minus1;
|
||||
std::vector<uint8_t> used_by_curr_pic_s0_flag;
|
||||
std::vector<int> delta_poc_s1_minus1;
|
||||
std::vector<uint8_t> used_by_curr_pic_s1_flag;
|
||||
std::vector<int> delta_poc_s0_minus1_;
|
||||
std::vector<uint8_t> used_by_curr_pic_s0_flag_;
|
||||
std::vector<int> delta_poc_s1_minus1_;
|
||||
std::vector<uint8_t> used_by_curr_pic_s1_flag_;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -726,46 +726,46 @@ struct SrsHevcStRefPicSet {
|
|||
* @doc ITU-T-H.265-2021.pdf, page 437.
|
||||
*/
|
||||
struct SrsHevcVuiParameters {
|
||||
uint8_t aspect_ratio_info_present_flag;
|
||||
uint8_t aspect_ratio_idc;
|
||||
int sar_width;
|
||||
int sar_height;
|
||||
uint8_t overscan_info_present_flag;
|
||||
uint8_t overscan_appropriate_flag;
|
||||
uint8_t video_signal_type_present_flag;
|
||||
uint8_t video_format;
|
||||
uint8_t video_full_range_flag;
|
||||
uint8_t colour_description_present_flag;
|
||||
uint8_t colour_primaries;
|
||||
uint8_t transfer_characteristics;
|
||||
uint8_t matrix_coeffs;
|
||||
uint8_t chroma_loc_info_present_flag;
|
||||
int chroma_sample_loc_type_top_field;
|
||||
int chroma_sample_loc_type_bottom_field;
|
||||
uint8_t neutral_chroma_indication_flag;
|
||||
uint8_t field_seq_flag;
|
||||
uint8_t frame_field_info_present_flag;
|
||||
uint8_t default_display_window_flag;
|
||||
int def_disp_win_left_offset;
|
||||
int def_disp_win_right_offset;
|
||||
int def_disp_win_top_offset;
|
||||
int def_disp_win_bottom_offset;
|
||||
uint8_t vui_timing_info_present_flag;
|
||||
uint32_t vui_num_units_in_tick;
|
||||
uint32_t vui_time_scale;
|
||||
uint8_t vui_poc_proportional_to_timing_flag;
|
||||
int vui_num_ticks_poc_diff_one_minus1;
|
||||
uint8_t vui_hrd_parameters_present_flag;
|
||||
SrsHevcHrdParameters hrd_parameters;
|
||||
uint8_t bitstream_restriction_flag;
|
||||
uint8_t tiles_fixed_structure_flag;
|
||||
uint8_t motion_vectors_over_pic_boundaries_flag;
|
||||
uint8_t restricted_ref_pic_lists_flag;
|
||||
int min_spatial_segmentation_idc;
|
||||
int max_bytes_per_pic_denom;
|
||||
int max_bits_per_min_cu_denom;
|
||||
int log2_max_mv_length_horizontal;
|
||||
int log2_max_mv_length_vertical;
|
||||
uint8_t aspect_ratio_info_present_flag_;
|
||||
uint8_t aspect_ratio_idc_;
|
||||
int sar_width_;
|
||||
int sar_height_;
|
||||
uint8_t overscan_info_present_flag_;
|
||||
uint8_t overscan_appropriate_flag_;
|
||||
uint8_t video_signal_type_present_flag_;
|
||||
uint8_t video_format_;
|
||||
uint8_t video_full_range_flag_;
|
||||
uint8_t colour_description_present_flag_;
|
||||
uint8_t colour_primaries_;
|
||||
uint8_t transfer_characteristics_;
|
||||
uint8_t matrix_coeffs_;
|
||||
uint8_t chroma_loc_info_present_flag_;
|
||||
int chroma_sample_loc_type_top_field_;
|
||||
int chroma_sample_loc_type_bottom_field_;
|
||||
uint8_t neutral_chroma_indication_flag_;
|
||||
uint8_t field_seq_flag_;
|
||||
uint8_t frame_field_info_present_flag_;
|
||||
uint8_t default_display_window_flag_;
|
||||
int def_disp_win_left_offset_;
|
||||
int def_disp_win_right_offset_;
|
||||
int def_disp_win_top_offset_;
|
||||
int def_disp_win_bottom_offset_;
|
||||
uint8_t vui_timing_info_present_flag_;
|
||||
uint32_t vui_num_units_in_tick_;
|
||||
uint32_t vui_time_scale_;
|
||||
uint8_t vui_poc_proportional_to_timing_flag_;
|
||||
int vui_num_ticks_poc_diff_one_minus1_;
|
||||
uint8_t vui_hrd_parameters_present_flag_;
|
||||
SrsHevcHrdParameters hrd_parameters_;
|
||||
uint8_t bitstream_restriction_flag_;
|
||||
uint8_t tiles_fixed_structure_flag_;
|
||||
uint8_t motion_vectors_over_pic_boundaries_flag_;
|
||||
uint8_t restricted_ref_pic_lists_flag_;
|
||||
int min_spatial_segmentation_idc_;
|
||||
int max_bytes_per_pic_denom_;
|
||||
int max_bits_per_min_cu_denom_;
|
||||
int log2_max_mv_length_horizontal_;
|
||||
int log2_max_mv_length_vertical_;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -774,33 +774,33 @@ struct SrsHevcVuiParameters {
|
|||
* @doc ITU-T-H.265-2021.pdf, page 54.
|
||||
*/
|
||||
struct SrsHevcRbspVps {
|
||||
uint8_t vps_video_parameter_set_id; // u(4)
|
||||
uint8_t vps_base_layer_internal_flag; // u(1)
|
||||
uint8_t vps_base_layer_available_flag; // u(1)
|
||||
uint8_t vps_max_layers_minus1; // u(6)
|
||||
uint8_t vps_max_sub_layers_minus1; // u(3)
|
||||
uint8_t vps_temporal_id_nesting_flag; // u(1)
|
||||
int vps_reserved_0xffff_16bits; // u(16)
|
||||
SrsHevcProfileTierLevel ptl;
|
||||
uint8_t vps_sub_layer_ordering_info_present_flag;
|
||||
uint8_t vps_video_parameter_set_id_; // u(4)
|
||||
uint8_t vps_base_layer_internal_flag_; // u(1)
|
||||
uint8_t vps_base_layer_available_flag_; // u(1)
|
||||
uint8_t vps_max_layers_minus1_; // u(6)
|
||||
uint8_t vps_max_sub_layers_minus1_; // u(3)
|
||||
uint8_t vps_temporal_id_nesting_flag_; // u(1)
|
||||
int vps_reserved_0xffff_16bits_; // u(16)
|
||||
SrsHevcProfileTierLevel ptl_;
|
||||
uint8_t vps_sub_layer_ordering_info_present_flag_;
|
||||
// Sublayers
|
||||
uint32_t vps_max_dec_pic_buffering_minus1[8]; // max u(3)
|
||||
uint32_t vps_max_num_reorder_pics[8];
|
||||
uint32_t vps_max_latency_increase_plus1[8];
|
||||
uint8_t vps_max_layer_id;
|
||||
uint32_t vps_num_layer_sets_minus1;
|
||||
std::vector<std::vector<uint8_t> > layer_id_included_flag;
|
||||
uint8_t vps_timing_info_present_flag;
|
||||
uint32_t vps_num_units_in_tick;
|
||||
uint32_t vps_time_scale;
|
||||
uint8_t vps_poc_proportional_to_timing_flag;
|
||||
uint32_t vps_num_ticks_poc_diff_one_minus1;
|
||||
uint32_t vps_num_hrd_parameters;
|
||||
std::vector<uint32_t> hrd_layer_set_idx;
|
||||
std::vector<uint8_t> cprms_present_flag;
|
||||
SrsHevcHrdParameters hrd_parameters;
|
||||
uint8_t vps_extension_flag;
|
||||
uint8_t vps_extension_data_flag;
|
||||
uint32_t vps_max_dec_pic_buffering_minus1_[8]; // max u(3)
|
||||
uint32_t vps_max_num_reorder_pics_[8];
|
||||
uint32_t vps_max_latency_increase_plus1_[8];
|
||||
uint8_t vps_max_layer_id_;
|
||||
uint32_t vps_num_layer_sets_minus1_;
|
||||
std::vector<std::vector<uint8_t> > layer_id_included_flag_;
|
||||
uint8_t vps_timing_info_present_flag_;
|
||||
uint32_t vps_num_units_in_tick_;
|
||||
uint32_t vps_time_scale_;
|
||||
uint8_t vps_poc_proportional_to_timing_flag_;
|
||||
uint32_t vps_num_ticks_poc_diff_one_minus1_;
|
||||
uint32_t vps_num_hrd_parameters_;
|
||||
std::vector<uint32_t> hrd_layer_set_idx_;
|
||||
std::vector<uint8_t> cprms_present_flag_;
|
||||
SrsHevcHrdParameters hrd_parameters_;
|
||||
uint8_t vps_extension_flag_;
|
||||
uint8_t vps_extension_data_flag_;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -809,64 +809,64 @@ struct SrsHevcRbspVps {
|
|||
* @doc ITU-T-H.265-2021.pdf, page 55.
|
||||
*/
|
||||
struct SrsHevcRbspSps {
|
||||
uint8_t sps_video_parameter_set_id;
|
||||
uint8_t sps_max_sub_layers_minus1;
|
||||
uint8_t sps_temporal_id_nesting_flag;
|
||||
SrsHevcProfileTierLevel ptl;
|
||||
uint32_t sps_seq_parameter_set_id;
|
||||
uint32_t chroma_format_idc;
|
||||
uint8_t separate_colour_plane_flag;
|
||||
uint32_t pic_width_in_luma_samples;
|
||||
uint32_t pic_height_in_luma_samples;
|
||||
uint32_t conformance_window_flag;
|
||||
uint32_t conf_win_left_offset;
|
||||
uint32_t conf_win_right_offset;
|
||||
uint32_t conf_win_top_offset;
|
||||
uint32_t conf_win_bottom_offset;
|
||||
uint32_t bit_depth_luma_minus8;
|
||||
uint32_t bit_depth_chroma_minus8;
|
||||
uint32_t log2_max_pic_order_cnt_lsb_minus4;
|
||||
uint8_t sps_sub_layer_ordering_info_present_flag;
|
||||
uint32_t sps_max_dec_pic_buffering_minus1[8]; // max u(3)
|
||||
uint32_t sps_max_num_reorder_pics[8];
|
||||
uint32_t sps_max_latency_increase_plus1[8];
|
||||
uint32_t log2_min_luma_coding_block_size_minus3;
|
||||
uint32_t log2_diff_max_min_luma_coding_block_size;
|
||||
uint32_t log2_min_luma_transform_block_size_minus2;
|
||||
uint32_t log2_diff_max_min_luma_transform_block_size;
|
||||
uint32_t max_transform_hierarchy_depth_inter;
|
||||
uint32_t max_transform_hierarchy_depth_intra;
|
||||
uint8_t scaling_list_enabled_flag;
|
||||
uint8_t sps_infer_scaling_list_flag;
|
||||
uint32_t sps_scaling_list_ref_layer_id;
|
||||
uint32_t sps_scaling_list_data_present_flag;
|
||||
SrsHevcScalingListData scaling_list_data;
|
||||
uint8_t amp_enabled_flag;
|
||||
uint8_t sample_adaptive_offset_enabled_flag;
|
||||
uint8_t pcm_enabled_flag;
|
||||
uint8_t pcm_sample_bit_depth_luma_minus1;
|
||||
uint8_t pcm_sample_bit_depth_chroma_minus1;
|
||||
uint32_t log2_min_pcm_luma_coding_block_size_minus3;
|
||||
uint32_t log2_diff_max_min_pcm_luma_coding_block_size;
|
||||
uint8_t pcm_loop_filter_disabled_flag;
|
||||
uint32_t num_short_term_ref_pic_sets;
|
||||
std::vector<SrsHevcStRefPicSet> st_ref_pic_set;
|
||||
uint8_t long_term_ref_pics_present_flag;
|
||||
uint32_t num_long_term_ref_pics_sps;
|
||||
uint32_t lt_ref_pic_poc_lsb_sps_bytes;
|
||||
std::vector<uint32_t> lt_ref_pic_poc_lsb_sps;
|
||||
std::vector<uint8_t> used_by_curr_pic_lt_sps_flag;
|
||||
uint8_t sps_temporal_mvp_enabled_flag;
|
||||
uint8_t strong_intra_smoothing_enabled_flag;
|
||||
uint8_t vui_parameters_present_flag;
|
||||
SrsHevcVuiParameters vui;
|
||||
uint8_t sps_extension_present_flag;
|
||||
uint8_t sps_range_extension_flag;
|
||||
uint8_t sps_multilayer_extension_flag;
|
||||
uint8_t sps_3d_extension_flag;
|
||||
uint8_t sps_extension_5bits;
|
||||
SrsHevcSpsRangeExtension sps_range_extension;
|
||||
uint8_t inter_view_mv_vert_constraint_flag; // sps_multilayer_extension_t sps_multilayer_extension;
|
||||
uint8_t sps_video_parameter_set_id_;
|
||||
uint8_t sps_max_sub_layers_minus1_;
|
||||
uint8_t sps_temporal_id_nesting_flag_;
|
||||
SrsHevcProfileTierLevel ptl_;
|
||||
uint32_t sps_seq_parameter_set_id_;
|
||||
uint32_t chroma_format_idc_;
|
||||
uint8_t separate_colour_plane_flag_;
|
||||
uint32_t pic_width_in_luma_samples_;
|
||||
uint32_t pic_height_in_luma_samples_;
|
||||
uint32_t conformance_window_flag_;
|
||||
uint32_t conf_win_left_offset_;
|
||||
uint32_t conf_win_right_offset_;
|
||||
uint32_t conf_win_top_offset_;
|
||||
uint32_t conf_win_bottom_offset_;
|
||||
uint32_t bit_depth_luma_minus8_;
|
||||
uint32_t bit_depth_chroma_minus8_;
|
||||
uint32_t log2_max_pic_order_cnt_lsb_minus4_;
|
||||
uint8_t sps_sub_layer_ordering_info_present_flag_;
|
||||
uint32_t sps_max_dec_pic_buffering_minus1_[8]; // max u(3)
|
||||
uint32_t sps_max_num_reorder_pics_[8];
|
||||
uint32_t sps_max_latency_increase_plus1_[8];
|
||||
uint32_t log2_min_luma_coding_block_size_minus3_;
|
||||
uint32_t log2_diff_max_min_luma_coding_block_size_;
|
||||
uint32_t log2_min_luma_transform_block_size_minus2_;
|
||||
uint32_t log2_diff_max_min_luma_transform_block_size_;
|
||||
uint32_t max_transform_hierarchy_depth_inter_;
|
||||
uint32_t max_transform_hierarchy_depth_intra_;
|
||||
uint8_t scaling_list_enabled_flag_;
|
||||
uint8_t sps_infer_scaling_list_flag_;
|
||||
uint32_t sps_scaling_list_ref_layer_id_;
|
||||
uint32_t sps_scaling_list_data_present_flag_;
|
||||
SrsHevcScalingListData scaling_list_data_;
|
||||
uint8_t amp_enabled_flag_;
|
||||
uint8_t sample_adaptive_offset_enabled_flag_;
|
||||
uint8_t pcm_enabled_flag_;
|
||||
uint8_t pcm_sample_bit_depth_luma_minus1_;
|
||||
uint8_t pcm_sample_bit_depth_chroma_minus1_;
|
||||
uint32_t log2_min_pcm_luma_coding_block_size_minus3_;
|
||||
uint32_t log2_diff_max_min_pcm_luma_coding_block_size_;
|
||||
uint8_t pcm_loop_filter_disabled_flag_;
|
||||
uint32_t num_short_term_ref_pic_sets_;
|
||||
std::vector<SrsHevcStRefPicSet> st_ref_pic_set_;
|
||||
uint8_t long_term_ref_pics_present_flag_;
|
||||
uint32_t num_long_term_ref_pics_sps_;
|
||||
uint32_t lt_ref_pic_poc_lsb_sps_bytes_;
|
||||
std::vector<uint32_t> lt_ref_pic_poc_lsb_sps_;
|
||||
std::vector<uint8_t> used_by_curr_pic_lt_sps_flag_;
|
||||
uint8_t sps_temporal_mvp_enabled_flag_;
|
||||
uint8_t strong_intra_smoothing_enabled_flag_;
|
||||
uint8_t vui_parameters_present_flag_;
|
||||
SrsHevcVuiParameters vui_;
|
||||
uint8_t sps_extension_present_flag_;
|
||||
uint8_t sps_range_extension_flag_;
|
||||
uint8_t sps_multilayer_extension_flag_;
|
||||
uint8_t sps_3d_extension_flag_;
|
||||
uint8_t sps_extension_5bits_;
|
||||
SrsHevcSpsRangeExtension sps_range_extension_;
|
||||
uint8_t inter_view_mv_vert_constraint_flag_; // sps_multilayer_extension_t sps_multilayer_extension;
|
||||
// sps_3d_extension_t sps_3d_extension;
|
||||
// int sps_extension_data_flag; // no need
|
||||
// rbsp_trailing_bits()...
|
||||
|
|
@ -878,81 +878,81 @@ struct SrsHevcRbspSps {
|
|||
* @doc ITU-T-H.265-2021.pdf, page 57.
|
||||
*/
|
||||
struct SrsHevcRbspPps {
|
||||
uint8_t pps_pic_parameter_set_id;
|
||||
uint8_t pps_seq_parameter_set_id;
|
||||
uint8_t dependent_slice_segments_enabled_flag;
|
||||
uint8_t output_flag_present_flag;
|
||||
uint8_t num_extra_slice_header_bits;
|
||||
uint8_t sign_data_hiding_enabled_flag;
|
||||
uint8_t cabac_init_present_flag;
|
||||
uint32_t num_ref_idx_l0_default_active_minus1;
|
||||
uint32_t num_ref_idx_l1_default_active_minus1;
|
||||
int32_t init_qp_minus26;
|
||||
uint8_t constrained_intra_pred_flag;
|
||||
uint8_t transform_skip_enabled_flag;
|
||||
uint8_t cu_qp_delta_enabled_flag;
|
||||
uint32_t diff_cu_qp_delta_depth;
|
||||
int32_t pps_cb_qp_offset;
|
||||
int32_t pps_cr_qp_offset;
|
||||
uint8_t pps_slice_chroma_qp_offsets_present_flag;
|
||||
uint8_t weighted_pred_flag;
|
||||
uint32_t weighted_bipred_flag;
|
||||
uint8_t transquant_bypass_enabled_flag;
|
||||
uint8_t tiles_enabled_flag;
|
||||
uint8_t entropy_coding_sync_enabled_flag;
|
||||
uint32_t num_tile_columns_minus1;
|
||||
uint32_t num_tile_rows_minus1;
|
||||
uint32_t uniform_spacing_flag;
|
||||
std::vector<uint32_t> column_width_minus1;
|
||||
std::vector<uint32_t> row_height_minus1;
|
||||
uint8_t loop_filter_across_tiles_enabled_flag;
|
||||
uint8_t pps_loop_filter_across_slices_enabled_flag;
|
||||
uint8_t deblocking_filter_control_present_flag;
|
||||
uint8_t deblocking_filter_override_enabled_flag;
|
||||
uint8_t pps_deblocking_filter_disabled_flag;
|
||||
int32_t pps_beta_offset_div2;
|
||||
int32_t pps_tc_offset_div2;
|
||||
uint8_t pps_scaling_list_data_present_flag;
|
||||
SrsHevcScalingListData scaling_list_data;
|
||||
uint8_t lists_modification_present_flag;
|
||||
uint32_t log2_parallel_merge_level_minus2;
|
||||
uint8_t slice_segment_header_extension_present_flag;
|
||||
uint8_t pps_extension_present_flag;
|
||||
uint8_t pps_range_extension_flag;
|
||||
uint8_t pps_multilayer_extension_flag;
|
||||
uint8_t pps_3d_extension_flag;
|
||||
uint8_t pps_scc_extension_flag;
|
||||
uint8_t pps_extension_4bits;
|
||||
SrsHevcPpsRangeExtension pps_range_extension;
|
||||
uint8_t pps_pic_parameter_set_id_;
|
||||
uint8_t pps_seq_parameter_set_id_;
|
||||
uint8_t dependent_slice_segments_enabled_flag_;
|
||||
uint8_t output_flag_present_flag_;
|
||||
uint8_t num_extra_slice_header_bits_;
|
||||
uint8_t sign_data_hiding_enabled_flag_;
|
||||
uint8_t cabac_init_present_flag_;
|
||||
uint32_t num_ref_idx_l0_default_active_minus1_;
|
||||
uint32_t num_ref_idx_l1_default_active_minus1_;
|
||||
int32_t init_qp_minus26_;
|
||||
uint8_t constrained_intra_pred_flag_;
|
||||
uint8_t transform_skip_enabled_flag_;
|
||||
uint8_t cu_qp_delta_enabled_flag_;
|
||||
uint32_t diff_cu_qp_delta_depth_;
|
||||
int32_t pps_cb_qp_offset_;
|
||||
int32_t pps_cr_qp_offset_;
|
||||
uint8_t pps_slice_chroma_qp_offsets_present_flag_;
|
||||
uint8_t weighted_pred_flag_;
|
||||
uint32_t weighted_bipred_flag_;
|
||||
uint8_t transquant_bypass_enabled_flag_;
|
||||
uint8_t tiles_enabled_flag_;
|
||||
uint8_t entropy_coding_sync_enabled_flag_;
|
||||
uint32_t num_tile_columns_minus1_;
|
||||
uint32_t num_tile_rows_minus1_;
|
||||
uint32_t uniform_spacing_flag_;
|
||||
std::vector<uint32_t> column_width_minus1_;
|
||||
std::vector<uint32_t> row_height_minus1_;
|
||||
uint8_t loop_filter_across_tiles_enabled_flag_;
|
||||
uint8_t pps_loop_filter_across_slices_enabled_flag_;
|
||||
uint8_t deblocking_filter_control_present_flag_;
|
||||
uint8_t deblocking_filter_override_enabled_flag_;
|
||||
uint8_t pps_deblocking_filter_disabled_flag_;
|
||||
int32_t pps_beta_offset_div2_;
|
||||
int32_t pps_tc_offset_div2_;
|
||||
uint8_t pps_scaling_list_data_present_flag_;
|
||||
SrsHevcScalingListData scaling_list_data_;
|
||||
uint8_t lists_modification_present_flag_;
|
||||
uint32_t log2_parallel_merge_level_minus2_;
|
||||
uint8_t slice_segment_header_extension_present_flag_;
|
||||
uint8_t pps_extension_present_flag_;
|
||||
uint8_t pps_range_extension_flag_;
|
||||
uint8_t pps_multilayer_extension_flag_;
|
||||
uint8_t pps_3d_extension_flag_;
|
||||
uint8_t pps_scc_extension_flag_;
|
||||
uint8_t pps_extension_4bits_;
|
||||
SrsHevcPpsRangeExtension pps_range_extension_;
|
||||
// pps_multilayer_extension_t pps_multilayer_extension;
|
||||
// pps_3d_extension_t pps_3d_extension;
|
||||
uint8_t pps_extension_data_flag;
|
||||
uint8_t pps_extension_data_flag_;
|
||||
// rbsp_trailing_bits( ) ...
|
||||
};
|
||||
|
||||
struct SrsHevcDecoderConfigurationRecord {
|
||||
uint8_t configuration_version;
|
||||
uint8_t general_profile_space;
|
||||
uint8_t general_tier_flag;
|
||||
uint8_t general_profile_idc;
|
||||
uint32_t general_profile_compatibility_flags;
|
||||
uint64_t general_constraint_indicator_flags;
|
||||
uint8_t general_level_idc;
|
||||
uint16_t min_spatial_segmentation_idc;
|
||||
uint8_t parallelism_type;
|
||||
uint8_t chroma_format;
|
||||
uint8_t bit_depth_luma_minus8;
|
||||
uint8_t bit_depth_chroma_minus8;
|
||||
uint16_t avg_frame_rate;
|
||||
uint8_t constant_frame_rate;
|
||||
uint8_t num_temporal_layers;
|
||||
uint8_t temporal_id_nested;
|
||||
uint8_t length_size_minus_one;
|
||||
std::vector<SrsHevcHvccNalu> nalu_vec;
|
||||
uint8_t configuration_version_;
|
||||
uint8_t general_profile_space_;
|
||||
uint8_t general_tier_flag_;
|
||||
uint8_t general_profile_idc_;
|
||||
uint32_t general_profile_compatibility_flags_;
|
||||
uint64_t general_constraint_indicator_flags_;
|
||||
uint8_t general_level_idc_;
|
||||
uint16_t min_spatial_segmentation_idc_;
|
||||
uint8_t parallelism_type_;
|
||||
uint8_t chroma_format_;
|
||||
uint8_t bit_depth_luma_minus8_;
|
||||
uint8_t bit_depth_chroma_minus8_;
|
||||
uint16_t avg_frame_rate_;
|
||||
uint8_t constant_frame_rate_;
|
||||
uint8_t num_temporal_layers_;
|
||||
uint8_t temporal_id_nested_;
|
||||
uint8_t length_size_minus_one_;
|
||||
std::vector<SrsHevcHvccNalu> nalu_vec_;
|
||||
|
||||
SrsHevcRbspVps vps_table[SrsHevcMax_VPS_COUNT];
|
||||
SrsHevcRbspSps sps_table[SrsHevcMax_SPS_COUNT];
|
||||
SrsHevcRbspPps pps_table[SrsHevcMax_PPS_COUNT];
|
||||
SrsHevcRbspVps vps_table_[SrsHevcMax_VPS_COUNT];
|
||||
SrsHevcRbspSps sps_table_[SrsHevcMax_SPS_COUNT];
|
||||
SrsHevcRbspPps pps_table_[SrsHevcMax_PPS_COUNT];
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -1132,15 +1132,15 @@ class SrsAudioCodecConfig : public SrsCodecConfig
|
|||
// In FLV specification.
|
||||
public:
|
||||
// The audio codec id; for FLV, it's SoundFormat.
|
||||
SrsAudioCodecId id;
|
||||
SrsAudioCodecId id_;
|
||||
// The audio sample rate; for FLV, it's SoundRate.
|
||||
SrsAudioSampleRate sound_rate;
|
||||
SrsAudioSampleRate sound_rate_;
|
||||
// The audio sample size, such as 16 bits; for FLV, it's SoundSize.
|
||||
SrsAudioSampleBits sound_size;
|
||||
SrsAudioSampleBits sound_size_;
|
||||
// The audio number of channels; for FLV, it's SoundType.
|
||||
// TODO: FIXME: Rename to sound_channels.
|
||||
SrsAudioChannels sound_type;
|
||||
int audio_data_rate; // in bps
|
||||
SrsAudioChannels sound_type_;
|
||||
int audio_data_rate_; // in bps
|
||||
// In AAC specification.
|
||||
public:
|
||||
/**
|
||||
|
|
@ -1149,15 +1149,15 @@ public:
|
|||
* 1.5.1.1 Audio object type definition, page 23,
|
||||
* in ISO_IEC_14496-3-AAC-2001.pdf.
|
||||
*/
|
||||
SrsAacObjectType aac_object;
|
||||
SrsAacObjectType aac_object_;
|
||||
/**
|
||||
* samplingFrequencyIndex
|
||||
*/
|
||||
uint8_t aac_sample_rate;
|
||||
uint8_t aac_sample_rate_;
|
||||
/**
|
||||
* channelConfiguration
|
||||
*/
|
||||
uint8_t aac_channels;
|
||||
uint8_t aac_channels_;
|
||||
// Sequence header payload.
|
||||
public:
|
||||
/**
|
||||
|
|
@ -1165,7 +1165,7 @@ public:
|
|||
* without the flv codec header,
|
||||
* @see: ffmpeg, AVCodecContext::extradata
|
||||
*/
|
||||
std::vector<char> aac_extra_data;
|
||||
std::vector<char> aac_extra_data_;
|
||||
|
||||
public:
|
||||
SrsAudioCodecConfig();
|
||||
|
|
@ -1181,12 +1181,12 @@ public:
|
|||
class SrsVideoCodecConfig : public SrsCodecConfig
|
||||
{
|
||||
public:
|
||||
SrsVideoCodecId id;
|
||||
int video_data_rate; // in bps
|
||||
double frame_rate;
|
||||
double duration;
|
||||
int width;
|
||||
int height;
|
||||
SrsVideoCodecId id_;
|
||||
int video_data_rate_; // in bps
|
||||
double frame_rate_;
|
||||
double duration_;
|
||||
int width_;
|
||||
int height_;
|
||||
|
||||
public:
|
||||
/**
|
||||
|
|
@ -1194,29 +1194,29 @@ public:
|
|||
* without the flv codec header,
|
||||
* @see: ffmpeg, AVCodecContext::extradata
|
||||
*/
|
||||
std::vector<char> avc_extra_data;
|
||||
std::vector<char> avc_extra_data_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* video specified
|
||||
*/
|
||||
// profile_idc, ISO_IEC_14496-10-AVC-2003.pdf, page 45.
|
||||
SrsAvcProfile avc_profile;
|
||||
SrsAvcProfile avc_profile_;
|
||||
// level_idc, ISO_IEC_14496-10-AVC-2003.pdf, page 45.
|
||||
SrsAvcLevel avc_level;
|
||||
SrsAvcLevel avc_level_;
|
||||
// The profile_idc, ITU-T-H.265-2021.pdf, page 62.
|
||||
SrsHevcProfile hevc_profile;
|
||||
SrsHevcProfile hevc_profile_;
|
||||
// The level_idc, ITU-T-H.265-2021.pdf, page 63.
|
||||
SrsHevcLevel hevc_level;
|
||||
SrsHevcLevel hevc_level_;
|
||||
// lengthSizeMinusOne, ISO_IEC_14496-15-AVC-format-2012.pdf, page 16
|
||||
int8_t NAL_unit_length;
|
||||
int8_t NAL_unit_length_;
|
||||
// Note that we may resize the vector, so the under-layer bytes may change.
|
||||
std::vector<char> sequenceParameterSetNALUnit;
|
||||
std::vector<char> pictureParameterSetNALUnit;
|
||||
std::vector<char> sequenceParameterSetNALUnit_;
|
||||
std::vector<char> pictureParameterSetNALUnit_;
|
||||
|
||||
public:
|
||||
// the avc payload format.
|
||||
SrsAvcPayloadFormat payload_format;
|
||||
SrsAvcPayloadFormat payload_format_;
|
||||
|
||||
public:
|
||||
SrsHevcDecoderConfigurationRecord hevc_dec_conf_record_;
|
||||
|
|
|
|||
|
|
@ -214,21 +214,21 @@ bool srs_is_server_gracefully_close(srs_error_t err)
|
|||
|
||||
SrsCplxError::SrsCplxError()
|
||||
{
|
||||
code = ERROR_SUCCESS;
|
||||
wrapped = NULL;
|
||||
rerrno = line = 0;
|
||||
code_ = ERROR_SUCCESS;
|
||||
wrapped_ = NULL;
|
||||
rerrno_ = line_ = 0;
|
||||
}
|
||||
|
||||
SrsCplxError::~SrsCplxError()
|
||||
{
|
||||
srs_freep(wrapped);
|
||||
srs_freep(wrapped_);
|
||||
}
|
||||
|
||||
std::string SrsCplxError::description()
|
||||
{
|
||||
if (desc.empty()) {
|
||||
if (desc_.empty()) {
|
||||
stringstream ss;
|
||||
ss << "code=" << code;
|
||||
ss << "code=" << code_;
|
||||
|
||||
string code_str = srs_error_code_str(this);
|
||||
if (!code_str.empty())
|
||||
|
|
@ -240,36 +240,36 @@ std::string SrsCplxError::description()
|
|||
|
||||
SrsCplxError *next = this;
|
||||
while (next) {
|
||||
ss << " : " << next->msg;
|
||||
next = next->wrapped;
|
||||
ss << " : " << next->msg_;
|
||||
next = next->wrapped_;
|
||||
}
|
||||
ss << endl;
|
||||
|
||||
next = this;
|
||||
while (next) {
|
||||
ss << "thread [" << getpid() << "][" << next->cid.c_str() << "]: "
|
||||
<< next->func << "() [" << next->file << ":" << next->line << "]"
|
||||
<< "[errno=" << next->rerrno << "]";
|
||||
ss << "thread [" << getpid() << "][" << next->cid_.c_str() << "]: "
|
||||
<< next->func_ << "() [" << next->file_ << ":" << next->line_ << "]"
|
||||
<< "[errno=" << next->rerrno_ << "]";
|
||||
|
||||
next = next->wrapped;
|
||||
next = next->wrapped_;
|
||||
|
||||
if (next) {
|
||||
ss << endl;
|
||||
}
|
||||
}
|
||||
|
||||
desc = ss.str();
|
||||
desc_ = ss.str();
|
||||
}
|
||||
|
||||
return desc;
|
||||
return desc_;
|
||||
}
|
||||
|
||||
std::string SrsCplxError::summary()
|
||||
{
|
||||
if (_summary.empty()) {
|
||||
if (summary_.empty()) {
|
||||
stringstream ss;
|
||||
|
||||
ss << "code=" << code;
|
||||
ss << "code=" << code_;
|
||||
|
||||
string code_str = srs_error_code_str(this);
|
||||
if (!code_str.empty())
|
||||
|
|
@ -277,14 +277,14 @@ std::string SrsCplxError::summary()
|
|||
|
||||
SrsCplxError *next = this;
|
||||
while (next) {
|
||||
ss << " : " << next->msg;
|
||||
next = next->wrapped;
|
||||
ss << " : " << next->msg_;
|
||||
next = next->wrapped_;
|
||||
}
|
||||
|
||||
_summary = ss.str();
|
||||
summary_ = ss.str();
|
||||
}
|
||||
|
||||
return _summary;
|
||||
return summary_;
|
||||
}
|
||||
|
||||
SrsCplxError *SrsCplxError::create(const char *func, const char *file, int line, int code, const char *fmt, ...)
|
||||
|
|
@ -299,17 +299,17 @@ SrsCplxError *SrsCplxError::create(const char *func, const char *file, int line,
|
|||
|
||||
SrsCplxError *err = new SrsCplxError();
|
||||
|
||||
err->func = func;
|
||||
err->file = file;
|
||||
err->line = line;
|
||||
err->code = code;
|
||||
err->rerrno = rerrno;
|
||||
err->func_ = func;
|
||||
err->file_ = file;
|
||||
err->line_ = line;
|
||||
err->code_ = code;
|
||||
err->rerrno_ = rerrno;
|
||||
if (r0 > 0 && r0 < maxLogBuf) {
|
||||
err->msg = string(buffer, r0);
|
||||
err->msg_ = string(buffer, r0);
|
||||
}
|
||||
err->wrapped = NULL;
|
||||
err->wrapped_ = NULL;
|
||||
if (_srs_context) {
|
||||
err->cid = _srs_context->get_id();
|
||||
err->cid_ = _srs_context->get_id();
|
||||
}
|
||||
|
||||
return err;
|
||||
|
|
@ -327,19 +327,19 @@ SrsCplxError *SrsCplxError::wrap(const char *func, const char *file, int line, S
|
|||
|
||||
SrsCplxError *err = new SrsCplxError();
|
||||
|
||||
err->func = func;
|
||||
err->file = file;
|
||||
err->line = line;
|
||||
err->func_ = func;
|
||||
err->file_ = file;
|
||||
err->line_ = line;
|
||||
if (v) {
|
||||
err->code = v->code;
|
||||
err->code_ = v->code_;
|
||||
}
|
||||
err->rerrno = rerrno;
|
||||
err->rerrno_ = rerrno;
|
||||
if (r0 > 0 && r0 < maxLogBuf) {
|
||||
err->msg = string(buffer, r0);
|
||||
err->msg_ = string(buffer, r0);
|
||||
}
|
||||
err->wrapped = v;
|
||||
err->wrapped_ = v;
|
||||
if (_srs_context) {
|
||||
err->cid = _srs_context->get_id();
|
||||
err->cid_ = _srs_context->get_id();
|
||||
}
|
||||
|
||||
return err;
|
||||
|
|
@ -358,15 +358,15 @@ SrsCplxError *SrsCplxError::copy(SrsCplxError *from)
|
|||
|
||||
SrsCplxError *err = new SrsCplxError();
|
||||
|
||||
err->code = from->code;
|
||||
err->wrapped = srs_error_copy(from->wrapped);
|
||||
err->msg = from->msg;
|
||||
err->func = from->func;
|
||||
err->file = from->file;
|
||||
err->line = from->line;
|
||||
err->cid = from->cid;
|
||||
err->rerrno = from->rerrno;
|
||||
err->desc = from->desc;
|
||||
err->code_ = from->code_;
|
||||
err->wrapped_ = srs_error_copy(from->wrapped_);
|
||||
err->msg_ = from->msg_;
|
||||
err->func_ = from->func_;
|
||||
err->file_ = from->file_;
|
||||
err->line_ = from->line_;
|
||||
err->cid_ = from->cid_;
|
||||
err->rerrno_ = from->rerrno_;
|
||||
err->desc_ = from->desc_;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
@ -383,7 +383,7 @@ string SrsCplxError::summary(SrsCplxError *err)
|
|||
|
||||
int SrsCplxError::error_code(SrsCplxError *err)
|
||||
{
|
||||
return err ? err->code : ERROR_SUCCESS;
|
||||
return err ? err->code_ : ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
#define SRS_STRERRNO_GEN(n, v, m, s) {(SrsErrorCode)v, m, s},
|
||||
|
|
|
|||
|
|
@ -434,19 +434,19 @@ extern bool srs_is_server_gracefully_close(srs_error_t err);
|
|||
class SrsCplxError
|
||||
{
|
||||
private:
|
||||
int code;
|
||||
SrsCplxError *wrapped;
|
||||
std::string msg;
|
||||
int code_;
|
||||
SrsCplxError *wrapped_;
|
||||
std::string msg_;
|
||||
|
||||
std::string func;
|
||||
std::string file;
|
||||
int line;
|
||||
std::string func_;
|
||||
std::string file_;
|
||||
int line_;
|
||||
|
||||
SrsContextId cid;
|
||||
int rerrno;
|
||||
SrsContextId cid_;
|
||||
int rerrno_;
|
||||
|
||||
std::string desc;
|
||||
std::string _summary;
|
||||
std::string desc_;
|
||||
std::string summary_;
|
||||
|
||||
private:
|
||||
SrsCplxError();
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ SrsFileReader *ISrsFileReaderFactory::create_file_reader()
|
|||
|
||||
SrsFileReader::SrsFileReader()
|
||||
{
|
||||
fd = -1;
|
||||
fd_ = -1;
|
||||
}
|
||||
|
||||
SrsFileReader::~SrsFileReader()
|
||||
|
|
@ -213,15 +213,15 @@ srs_error_t SrsFileReader::open(string p)
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
if (fd > 0) {
|
||||
return srs_error_new(ERROR_SYSTEM_FILE_ALREADY_OPENED, "file %s already opened", path.c_str());
|
||||
if (fd_ > 0) {
|
||||
return srs_error_new(ERROR_SYSTEM_FILE_ALREADY_OPENED, "file %s already opened", path_.c_str());
|
||||
}
|
||||
|
||||
if ((fd = _srs_open_fn(p.c_str(), O_RDONLY)) < 0) {
|
||||
if ((fd_ = _srs_open_fn(p.c_str(), O_RDONLY)) < 0) {
|
||||
return srs_error_new(ERROR_SYSTEM_FILE_OPENE, "open file %s failed", p.c_str());
|
||||
}
|
||||
|
||||
path = p;
|
||||
path_ = p;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
@ -230,45 +230,45 @@ void SrsFileReader::close()
|
|||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
if (fd < 0) {
|
||||
if (fd_ < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_srs_close_fn(fd) < 0) {
|
||||
srs_warn("close file %s failed. ret=%d", path.c_str(), ret);
|
||||
if (_srs_close_fn(fd_) < 0) {
|
||||
srs_warn("close file %s failed. ret=%d", path_.c_str(), ret);
|
||||
}
|
||||
fd = -1;
|
||||
fd_ = -1;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bool SrsFileReader::is_open()
|
||||
{
|
||||
return fd > 0;
|
||||
return fd_ > 0;
|
||||
}
|
||||
|
||||
int64_t SrsFileReader::tellg()
|
||||
{
|
||||
return (int64_t)_srs_lseek_fn(fd, 0, SEEK_CUR);
|
||||
return (int64_t)_srs_lseek_fn(fd_, 0, SEEK_CUR);
|
||||
}
|
||||
|
||||
void SrsFileReader::skip(int64_t size)
|
||||
{
|
||||
off_t r0 = _srs_lseek_fn(fd, (off_t)size, SEEK_CUR);
|
||||
off_t r0 = _srs_lseek_fn(fd_, (off_t)size, SEEK_CUR);
|
||||
srs_assert(r0 != -1);
|
||||
}
|
||||
|
||||
int64_t SrsFileReader::seek2(int64_t offset)
|
||||
{
|
||||
return (int64_t)_srs_lseek_fn(fd, (off_t)offset, SEEK_SET);
|
||||
return (int64_t)_srs_lseek_fn(fd_, (off_t)offset, SEEK_SET);
|
||||
}
|
||||
|
||||
int64_t SrsFileReader::filesize()
|
||||
{
|
||||
int64_t cur = tellg();
|
||||
int64_t size = (int64_t)_srs_lseek_fn(fd, 0, SEEK_END);
|
||||
int64_t size = (int64_t)_srs_lseek_fn(fd_, 0, SEEK_END);
|
||||
|
||||
off_t r0 = _srs_lseek_fn(fd, (off_t)cur, SEEK_SET);
|
||||
off_t r0 = _srs_lseek_fn(fd_, (off_t)cur, SEEK_SET);
|
||||
srs_assert(r0 != -1);
|
||||
|
||||
return size;
|
||||
|
|
@ -280,8 +280,8 @@ srs_error_t SrsFileReader::read(void *buf, size_t count, ssize_t *pnread)
|
|||
|
||||
ssize_t nread;
|
||||
// TODO: FIXME: use st_read.
|
||||
if ((nread = _srs_read_fn(fd, buf, count)) < 0) {
|
||||
return srs_error_new(ERROR_SYSTEM_FILE_READ, "read from file %s failed", path.c_str());
|
||||
if ((nread = _srs_read_fn(fd_, buf, count)) < 0) {
|
||||
return srs_error_new(ERROR_SYSTEM_FILE_READ, "read from file %s failed", path_.c_str());
|
||||
}
|
||||
|
||||
if (nread == 0) {
|
||||
|
|
@ -297,7 +297,7 @@ srs_error_t SrsFileReader::read(void *buf, size_t count, ssize_t *pnread)
|
|||
|
||||
srs_error_t SrsFileReader::lseek(off_t offset, int whence, off_t *seeked)
|
||||
{
|
||||
off_t sk = _srs_lseek_fn(fd, offset, whence);
|
||||
off_t sk = _srs_lseek_fn(fd_, offset, whence);
|
||||
if (sk < 0) {
|
||||
return srs_error_new(ERROR_SYSTEM_FILE_SEEK, "seek %d failed", (int)sk);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,8 +83,8 @@ public:
|
|||
class SrsFileReader : public ISrsReadSeeker
|
||||
{
|
||||
private:
|
||||
std::string path;
|
||||
int fd;
|
||||
std::string path_;
|
||||
int fd_;
|
||||
|
||||
public:
|
||||
SrsFileReader();
|
||||
|
|
|
|||
|
|
@ -45,19 +45,19 @@ int srs_rtmp_prefer_cid(SrsFrameType message_type)
|
|||
int srs_rtmp_write_chunk_header(SrsMediaPacket *msg, char *cache, int nb_cache, bool c0)
|
||||
{
|
||||
int payload_length = msg->payload_.get() ? msg->payload_->size() : 0;
|
||||
int chunk_id = srs_rtmp_prefer_cid(msg->message_type);
|
||||
int chunk_id = srs_rtmp_prefer_cid(msg->message_type_);
|
||||
|
||||
if (c0) {
|
||||
return srs_chunk_header_c0(chunk_id,
|
||||
(uint32_t)msg->timestamp,
|
||||
(uint32_t)msg->timestamp_,
|
||||
payload_length,
|
||||
msg->message_type,
|
||||
msg->stream_id,
|
||||
msg->message_type_,
|
||||
msg->stream_id_,
|
||||
cache,
|
||||
nb_cache);
|
||||
} else {
|
||||
return srs_chunk_header_c3(chunk_id,
|
||||
(uint32_t)msg->timestamp,
|
||||
(uint32_t)msg->timestamp_,
|
||||
cache,
|
||||
nb_cache);
|
||||
}
|
||||
|
|
@ -188,12 +188,12 @@ int srs_chunk_header_c3(int prefer_cid, uint32_t timestamp, char *cache, int nb_
|
|||
|
||||
SrsMessageHeader::SrsMessageHeader()
|
||||
{
|
||||
message_type = 0;
|
||||
payload_length = 0;
|
||||
timestamp_delta = 0;
|
||||
stream_id = 0;
|
||||
message_type_ = 0;
|
||||
payload_length_ = 0;
|
||||
timestamp_delta_ = 0;
|
||||
stream_id_ = 0;
|
||||
|
||||
timestamp = 0;
|
||||
timestamp_ = 0;
|
||||
}
|
||||
|
||||
SrsMessageHeader::~SrsMessageHeader()
|
||||
|
|
@ -202,89 +202,89 @@ SrsMessageHeader::~SrsMessageHeader()
|
|||
|
||||
bool SrsMessageHeader::is_audio()
|
||||
{
|
||||
return message_type == RTMP_MSG_AudioMessage;
|
||||
return message_type_ == RTMP_MSG_AudioMessage;
|
||||
}
|
||||
|
||||
bool SrsMessageHeader::is_video()
|
||||
{
|
||||
return message_type == RTMP_MSG_VideoMessage;
|
||||
return message_type_ == RTMP_MSG_VideoMessage;
|
||||
}
|
||||
|
||||
bool SrsMessageHeader::is_amf0_command()
|
||||
{
|
||||
return message_type == RTMP_MSG_AMF0CommandMessage;
|
||||
return message_type_ == RTMP_MSG_AMF0CommandMessage;
|
||||
}
|
||||
|
||||
bool SrsMessageHeader::is_amf0_data()
|
||||
{
|
||||
return message_type == RTMP_MSG_AMF0DataMessage;
|
||||
return message_type_ == RTMP_MSG_AMF0DataMessage;
|
||||
}
|
||||
|
||||
bool SrsMessageHeader::is_amf3_command()
|
||||
{
|
||||
return message_type == RTMP_MSG_AMF3CommandMessage;
|
||||
return message_type_ == RTMP_MSG_AMF3CommandMessage;
|
||||
}
|
||||
|
||||
bool SrsMessageHeader::is_amf3_data()
|
||||
{
|
||||
return message_type == RTMP_MSG_AMF3DataMessage;
|
||||
return message_type_ == RTMP_MSG_AMF3DataMessage;
|
||||
}
|
||||
|
||||
bool SrsMessageHeader::is_window_ackledgement_size()
|
||||
{
|
||||
return message_type == RTMP_MSG_WindowAcknowledgementSize;
|
||||
return message_type_ == RTMP_MSG_WindowAcknowledgementSize;
|
||||
}
|
||||
|
||||
bool SrsMessageHeader::is_ackledgement()
|
||||
{
|
||||
return message_type == RTMP_MSG_Acknowledgement;
|
||||
return message_type_ == RTMP_MSG_Acknowledgement;
|
||||
}
|
||||
|
||||
bool SrsMessageHeader::is_set_chunk_size()
|
||||
{
|
||||
return message_type == RTMP_MSG_SetChunkSize;
|
||||
return message_type_ == RTMP_MSG_SetChunkSize;
|
||||
}
|
||||
|
||||
bool SrsMessageHeader::is_user_control_message()
|
||||
{
|
||||
return message_type == RTMP_MSG_UserControlMessage;
|
||||
return message_type_ == RTMP_MSG_UserControlMessage;
|
||||
}
|
||||
|
||||
bool SrsMessageHeader::is_set_peer_bandwidth()
|
||||
{
|
||||
return message_type == RTMP_MSG_SetPeerBandwidth;
|
||||
return message_type_ == RTMP_MSG_SetPeerBandwidth;
|
||||
}
|
||||
|
||||
bool SrsMessageHeader::is_aggregate()
|
||||
{
|
||||
return message_type == RTMP_MSG_AggregateMessage;
|
||||
return message_type_ == RTMP_MSG_AggregateMessage;
|
||||
}
|
||||
|
||||
void SrsMessageHeader::initialize_amf0_script(int size, int stream)
|
||||
{
|
||||
message_type = RTMP_MSG_AMF0DataMessage;
|
||||
payload_length = (int32_t)size;
|
||||
timestamp_delta = (int32_t)0;
|
||||
timestamp = (int64_t)0;
|
||||
stream_id = (int32_t)stream;
|
||||
message_type_ = RTMP_MSG_AMF0DataMessage;
|
||||
payload_length_ = (int32_t)size;
|
||||
timestamp_delta_ = (int32_t)0;
|
||||
timestamp_ = (int64_t)0;
|
||||
stream_id_ = (int32_t)stream;
|
||||
}
|
||||
|
||||
void SrsMessageHeader::initialize_audio(int size, uint32_t time, int stream)
|
||||
{
|
||||
message_type = RTMP_MSG_AudioMessage;
|
||||
payload_length = (int32_t)size;
|
||||
timestamp_delta = (int32_t)time;
|
||||
timestamp = (int64_t)time;
|
||||
stream_id = (int32_t)stream;
|
||||
message_type_ = RTMP_MSG_AudioMessage;
|
||||
payload_length_ = (int32_t)size;
|
||||
timestamp_delta_ = (int32_t)time;
|
||||
timestamp_ = (int64_t)time;
|
||||
stream_id_ = (int32_t)stream;
|
||||
}
|
||||
|
||||
void SrsMessageHeader::initialize_video(int size, uint32_t time, int stream)
|
||||
{
|
||||
message_type = RTMP_MSG_VideoMessage;
|
||||
payload_length = (int32_t)size;
|
||||
timestamp_delta = (int32_t)time;
|
||||
timestamp = (int64_t)time;
|
||||
stream_id = (int32_t)stream;
|
||||
message_type_ = RTMP_MSG_VideoMessage;
|
||||
payload_length_ = (int32_t)size;
|
||||
timestamp_delta_ = (int32_t)time;
|
||||
timestamp_ = (int64_t)time;
|
||||
stream_id_ = (int32_t)stream;
|
||||
}
|
||||
|
||||
SrsRtmpCommonMessage::SrsRtmpCommonMessage()
|
||||
|
|
@ -317,7 +317,7 @@ srs_error_t SrsRtmpCommonMessage::create(SrsMessageHeader *pheader, char *body,
|
|||
payload_->attach(body, size);
|
||||
|
||||
if (pheader) {
|
||||
this->header = *pheader;
|
||||
this->header_ = *pheader;
|
||||
}
|
||||
|
||||
return err;
|
||||
|
|
@ -326,37 +326,37 @@ srs_error_t SrsRtmpCommonMessage::create(SrsMessageHeader *pheader, char *body,
|
|||
void SrsRtmpCommonMessage::to_msg(SrsMediaPacket *msg)
|
||||
{
|
||||
msg->payload_ = payload_;
|
||||
msg->timestamp = header.timestamp;
|
||||
msg->stream_id = header.stream_id;
|
||||
msg->message_type = (SrsFrameType)header.message_type;
|
||||
msg->timestamp_ = header_.timestamp_;
|
||||
msg->stream_id_ = header_.stream_id_;
|
||||
msg->message_type_ = (SrsFrameType)header_.message_type_;
|
||||
}
|
||||
|
||||
SrsFlvTransmuxer::SrsFlvTransmuxer()
|
||||
{
|
||||
writer = NULL;
|
||||
writer_ = NULL;
|
||||
|
||||
drop_if_not_match_ = true;
|
||||
has_audio_ = true;
|
||||
has_video_ = true;
|
||||
nb_tag_headers = 0;
|
||||
tag_headers = NULL;
|
||||
nb_iovss_cache = 0;
|
||||
iovss_cache = NULL;
|
||||
nb_ppts = 0;
|
||||
ppts = NULL;
|
||||
nb_tag_headers_ = 0;
|
||||
tag_headers_ = NULL;
|
||||
nb_iovss_cache_ = 0;
|
||||
iovss_cache_ = NULL;
|
||||
nb_ppts_ = 0;
|
||||
ppts_ = NULL;
|
||||
}
|
||||
|
||||
SrsFlvTransmuxer::~SrsFlvTransmuxer()
|
||||
{
|
||||
srs_freepa(tag_headers);
|
||||
srs_freepa(iovss_cache);
|
||||
srs_freepa(ppts);
|
||||
srs_freepa(tag_headers_);
|
||||
srs_freepa(iovss_cache_);
|
||||
srs_freepa(ppts_);
|
||||
}
|
||||
|
||||
srs_error_t SrsFlvTransmuxer::initialize(ISrsWriter *fw)
|
||||
{
|
||||
srs_assert(fw);
|
||||
writer = fw;
|
||||
writer_ = fw;
|
||||
return srs_success;
|
||||
}
|
||||
|
||||
|
|
@ -406,13 +406,13 @@ srs_error_t SrsFlvTransmuxer::write_header(char flv_header[9])
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
// write data.
|
||||
if ((err = writer->write(flv_header, 9, NULL)) != srs_success) {
|
||||
if ((err = writer_->write(flv_header, 9, NULL)) != srs_success) {
|
||||
return srs_error_wrap(err, "write flv header failed");
|
||||
}
|
||||
|
||||
// previous tag size.
|
||||
char pts[] = {(char)0x00, (char)0x00, (char)0x00, (char)0x00};
|
||||
if ((err = writer->write(pts, 4, NULL)) != srs_success) {
|
||||
if ((err = writer_->write(pts, 4, NULL)) != srs_success) {
|
||||
return srs_error_wrap(err, "write pts");
|
||||
}
|
||||
|
||||
|
|
@ -424,10 +424,10 @@ srs_error_t SrsFlvTransmuxer::write_metadata(char type, char *data, int size)
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
if (size > 0) {
|
||||
cache_metadata(type, data, size, tag_header);
|
||||
cache_metadata(type, data, size, tag_header_);
|
||||
}
|
||||
|
||||
if ((err = write_tag(tag_header, sizeof(tag_header), data, size)) != srs_success) {
|
||||
if ((err = write_tag(tag_header_, sizeof(tag_header_), data, size)) != srs_success) {
|
||||
return srs_error_wrap(err, "write tag");
|
||||
}
|
||||
|
||||
|
|
@ -442,10 +442,10 @@ srs_error_t SrsFlvTransmuxer::write_audio(int64_t timestamp, char *data, int siz
|
|||
return err;
|
||||
|
||||
if (size > 0) {
|
||||
cache_audio(timestamp, data, size, tag_header);
|
||||
cache_audio(timestamp, data, size, tag_header_);
|
||||
}
|
||||
|
||||
if ((err = write_tag(tag_header, sizeof(tag_header), data, size)) != srs_success) {
|
||||
if ((err = write_tag(tag_header_, sizeof(tag_header_), data, size)) != srs_success) {
|
||||
return srs_error_wrap(err, "write tag");
|
||||
}
|
||||
|
||||
|
|
@ -460,10 +460,10 @@ srs_error_t SrsFlvTransmuxer::write_video(int64_t timestamp, char *data, int siz
|
|||
return err;
|
||||
|
||||
if (size > 0) {
|
||||
cache_video(timestamp, data, size, tag_header);
|
||||
cache_video(timestamp, data, size, tag_header_);
|
||||
}
|
||||
|
||||
if ((err = write_tag(tag_header, sizeof(tag_header), data, size)) != srs_success) {
|
||||
if ((err = write_tag(tag_header_, sizeof(tag_header_), data, size)) != srs_success) {
|
||||
return srs_error_wrap(err, "write flv video tag failed");
|
||||
}
|
||||
|
||||
|
|
@ -481,33 +481,33 @@ srs_error_t SrsFlvTransmuxer::write_tags(SrsMediaPacket **msgs, int count)
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
// Do realloc the iovss if required.
|
||||
iovec *iovss = iovss_cache;
|
||||
iovec *iovss = iovss_cache_;
|
||||
do {
|
||||
int nn_might_iovss = 3 * count;
|
||||
if (nb_iovss_cache < nn_might_iovss) {
|
||||
srs_freepa(iovss_cache);
|
||||
if (nb_iovss_cache_ < nn_might_iovss) {
|
||||
srs_freepa(iovss_cache_);
|
||||
|
||||
nb_iovss_cache = nn_might_iovss;
|
||||
iovss = iovss_cache = new iovec[nn_might_iovss];
|
||||
nb_iovss_cache_ = nn_might_iovss;
|
||||
iovss = iovss_cache_ = new iovec[nn_might_iovss];
|
||||
}
|
||||
} while (false);
|
||||
|
||||
// Do realloc the tag headers if required.
|
||||
char *cache = tag_headers;
|
||||
if (nb_tag_headers < count) {
|
||||
srs_freepa(tag_headers);
|
||||
char *cache = tag_headers_;
|
||||
if (nb_tag_headers_ < count) {
|
||||
srs_freepa(tag_headers_);
|
||||
|
||||
nb_tag_headers = count;
|
||||
cache = tag_headers = new char[SRS_FLV_TAG_HEADER_SIZE * count];
|
||||
nb_tag_headers_ = count;
|
||||
cache = tag_headers_ = new char[SRS_FLV_TAG_HEADER_SIZE * count];
|
||||
}
|
||||
|
||||
// Do realloc the pts if required.
|
||||
char *pts = ppts;
|
||||
if (nb_ppts < count) {
|
||||
srs_freepa(ppts);
|
||||
char *pts = ppts_;
|
||||
if (nb_ppts_ < count) {
|
||||
srs_freepa(ppts_);
|
||||
|
||||
nb_ppts = count;
|
||||
pts = ppts = new char[SRS_FLV_PREVIOUS_TAG_SIZE * count];
|
||||
nb_ppts_ = count;
|
||||
pts = ppts_ = new char[SRS_FLV_PREVIOUS_TAG_SIZE * count];
|
||||
}
|
||||
|
||||
// Now all caches are ok, start to write all messages.
|
||||
|
|
@ -520,11 +520,11 @@ srs_error_t SrsFlvTransmuxer::write_tags(SrsMediaPacket **msgs, int count)
|
|||
if (msg->is_audio()) {
|
||||
if (drop_if_not_match_ && !has_audio_)
|
||||
continue; // Ignore audio packets if no audio stream.
|
||||
cache_audio(msg->timestamp, msg->payload(), msg->size(), cache);
|
||||
cache_audio(msg->timestamp_, msg->payload(), msg->size(), cache);
|
||||
} else if (msg->is_video()) {
|
||||
if (drop_if_not_match_ && !has_video_)
|
||||
continue; // Ignore video packets if no video stream.
|
||||
cache_video(msg->timestamp, msg->payload(), msg->size(), cache);
|
||||
cache_video(msg->timestamp_, msg->payload(), msg->size(), cache);
|
||||
} else {
|
||||
cache_metadata(SrsFrameTypeScript, msg->payload(), msg->size(), cache);
|
||||
}
|
||||
|
|
@ -548,7 +548,7 @@ srs_error_t SrsFlvTransmuxer::write_tags(SrsMediaPacket **msgs, int count)
|
|||
}
|
||||
|
||||
// Send out all data carried by iovec.
|
||||
if ((err = writer->writev(iovss, nn_real_iovss, NULL)) != srs_success) {
|
||||
if ((err = writer_->writev(iovss, nn_real_iovss, NULL)) != srs_success) {
|
||||
return srs_error_wrap(err, "write flv tags failed");
|
||||
}
|
||||
|
||||
|
|
@ -652,7 +652,7 @@ srs_error_t SrsFlvTransmuxer::write_tag(char *header, int header_size, char *tag
|
|||
iovs[2].iov_base = pre_size;
|
||||
iovs[2].iov_len = SRS_FLV_PREVIOUS_TAG_SIZE;
|
||||
|
||||
if ((err = writer->writev(iovs, 3, NULL)) != srs_success) {
|
||||
if ((err = writer_->writev(iovs, 3, NULL)) != srs_success) {
|
||||
return srs_error_wrap(err, "write flv tag failed");
|
||||
}
|
||||
|
||||
|
|
@ -661,7 +661,7 @@ srs_error_t SrsFlvTransmuxer::write_tag(char *header, int header_size, char *tag
|
|||
|
||||
SrsFlvDecoder::SrsFlvDecoder()
|
||||
{
|
||||
reader = NULL;
|
||||
reader_ = NULL;
|
||||
}
|
||||
|
||||
SrsFlvDecoder::~SrsFlvDecoder()
|
||||
|
|
@ -671,7 +671,7 @@ SrsFlvDecoder::~SrsFlvDecoder()
|
|||
srs_error_t SrsFlvDecoder::initialize(ISrsReader *fr)
|
||||
{
|
||||
srs_assert(fr);
|
||||
reader = fr;
|
||||
reader_ = fr;
|
||||
return srs_success;
|
||||
}
|
||||
|
||||
|
|
@ -682,7 +682,7 @@ srs_error_t SrsFlvDecoder::read_header(char header[9])
|
|||
srs_assert(header);
|
||||
|
||||
// TODO: FIXME: Should use readfully.
|
||||
if ((err = reader->read(header, 9, NULL)) != srs_success) {
|
||||
if ((err = reader_->read(header, 9, NULL)) != srs_success) {
|
||||
return srs_error_wrap(err, "read header");
|
||||
}
|
||||
|
||||
|
|
@ -706,7 +706,7 @@ srs_error_t SrsFlvDecoder::read_tag_header(char *ptype, int32_t *pdata_size, uin
|
|||
|
||||
// read tag header
|
||||
// TODO: FIXME: Should use readfully.
|
||||
if ((err = reader->read(th, 11, NULL)) != srs_success) {
|
||||
if ((err = reader_->read(th, 11, NULL)) != srs_success) {
|
||||
return srs_error_wrap(err, "read flv tag header failed");
|
||||
}
|
||||
|
||||
|
|
@ -741,7 +741,7 @@ srs_error_t SrsFlvDecoder::read_tag_data(char *data, int32_t size)
|
|||
srs_assert(data);
|
||||
|
||||
// TODO: FIXME: Should use readfully.
|
||||
if ((err = reader->read(data, size, NULL)) != srs_success) {
|
||||
if ((err = reader_->read(data, size, NULL)) != srs_success) {
|
||||
return srs_error_wrap(err, "read flv tag header failed");
|
||||
}
|
||||
|
||||
|
|
@ -756,7 +756,7 @@ srs_error_t SrsFlvDecoder::read_previous_tag_size(char previous_tag_size[4])
|
|||
|
||||
// ignore 4bytes tag size.
|
||||
// TODO: FIXME: Should use readfully.
|
||||
if ((err = reader->read(previous_tag_size, 4, NULL)) != srs_success) {
|
||||
if ((err = reader_->read(previous_tag_size, 4, NULL)) != srs_success) {
|
||||
return srs_error_wrap(err, "read flv previous tag size failed");
|
||||
}
|
||||
|
||||
|
|
@ -765,7 +765,7 @@ srs_error_t SrsFlvDecoder::read_previous_tag_size(char previous_tag_size[4])
|
|||
|
||||
SrsFlvVodStreamDecoder::SrsFlvVodStreamDecoder()
|
||||
{
|
||||
reader = NULL;
|
||||
reader_ = NULL;
|
||||
}
|
||||
|
||||
SrsFlvVodStreamDecoder::~SrsFlvVodStreamDecoder()
|
||||
|
|
@ -777,12 +777,12 @@ srs_error_t SrsFlvVodStreamDecoder::initialize(ISrsReader *fr)
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
srs_assert(fr);
|
||||
reader = dynamic_cast<SrsFileReader *>(fr);
|
||||
if (!reader) {
|
||||
reader_ = dynamic_cast<SrsFileReader *>(fr);
|
||||
if (!reader_) {
|
||||
return srs_error_new(ERROR_EXPECT_FILE_IO, "stream is not file io");
|
||||
}
|
||||
|
||||
if (!reader->is_open()) {
|
||||
if (!reader_->is_open()) {
|
||||
return srs_error_new(ERROR_KERNEL_FLV_STREAM_CLOSED, "stream is not open for decoder");
|
||||
}
|
||||
|
||||
|
|
@ -801,7 +801,7 @@ srs_error_t SrsFlvVodStreamDecoder::read_header_ext(char header[13])
|
|||
// 9bytes header and 4bytes first previous-tag-size
|
||||
int size = 13;
|
||||
|
||||
if ((err = reader->read(header, size, NULL)) != srs_success) {
|
||||
if ((err = reader_->read(header, size, NULL)) != srs_success) {
|
||||
return srs_error_wrap(err, "read header");
|
||||
}
|
||||
|
||||
|
|
@ -835,7 +835,7 @@ srs_error_t SrsFlvVodStreamDecoder::read_sequence_header_summary(int64_t *pstart
|
|||
int64_t av_sequence_offset_start = -1;
|
||||
int64_t av_sequence_offset_end = -1;
|
||||
for (;;) {
|
||||
if ((err = reader->read(tag_header, SRS_FLV_TAG_HEADER_SIZE, NULL)) != srs_success) {
|
||||
if ((err = reader_->read(tag_header, SRS_FLV_TAG_HEADER_SIZE, NULL)) != srs_success) {
|
||||
return srs_error_wrap(err, "read tag header");
|
||||
}
|
||||
|
||||
|
|
@ -849,7 +849,7 @@ srs_error_t SrsFlvVodStreamDecoder::read_sequence_header_summary(int64_t *pstart
|
|||
bool is_not_av = !is_video && !is_audio;
|
||||
if (is_not_av) {
|
||||
// skip body and tag size.
|
||||
reader->skip(data_size + SRS_FLV_PREVIOUS_TAG_SIZE);
|
||||
reader_->skip(data_size + SRS_FLV_PREVIOUS_TAG_SIZE);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -868,10 +868,10 @@ srs_error_t SrsFlvVodStreamDecoder::read_sequence_header_summary(int64_t *pstart
|
|||
got_video = true;
|
||||
|
||||
if (av_sequence_offset_start < 0) {
|
||||
av_sequence_offset_start = reader->tellg() - SRS_FLV_TAG_HEADER_SIZE;
|
||||
av_sequence_offset_start = reader_->tellg() - SRS_FLV_TAG_HEADER_SIZE;
|
||||
}
|
||||
av_sequence_offset_end = reader->tellg() + data_size + SRS_FLV_PREVIOUS_TAG_SIZE;
|
||||
reader->skip(data_size + SRS_FLV_PREVIOUS_TAG_SIZE);
|
||||
av_sequence_offset_end = reader_->tellg() + data_size + SRS_FLV_PREVIOUS_TAG_SIZE;
|
||||
reader_->skip(data_size + SRS_FLV_PREVIOUS_TAG_SIZE);
|
||||
}
|
||||
|
||||
// audio
|
||||
|
|
@ -880,10 +880,10 @@ srs_error_t SrsFlvVodStreamDecoder::read_sequence_header_summary(int64_t *pstart
|
|||
got_audio = true;
|
||||
|
||||
if (av_sequence_offset_start < 0) {
|
||||
av_sequence_offset_start = reader->tellg() - SRS_FLV_TAG_HEADER_SIZE;
|
||||
av_sequence_offset_start = reader_->tellg() - SRS_FLV_TAG_HEADER_SIZE;
|
||||
}
|
||||
av_sequence_offset_end = reader->tellg() + data_size + SRS_FLV_PREVIOUS_TAG_SIZE;
|
||||
reader->skip(data_size + SRS_FLV_PREVIOUS_TAG_SIZE);
|
||||
av_sequence_offset_end = reader_->tellg() + data_size + SRS_FLV_PREVIOUS_TAG_SIZE;
|
||||
reader_->skip(data_size + SRS_FLV_PREVIOUS_TAG_SIZE);
|
||||
}
|
||||
|
||||
if (got_audio && got_video) {
|
||||
|
|
@ -893,7 +893,7 @@ srs_error_t SrsFlvVodStreamDecoder::read_sequence_header_summary(int64_t *pstart
|
|||
|
||||
// seek to the sequence header start offset.
|
||||
if (av_sequence_offset_start > 0) {
|
||||
reader->seek2(av_sequence_offset_start);
|
||||
reader_->seek2(av_sequence_offset_start);
|
||||
*pstart = av_sequence_offset_start;
|
||||
*psize = (int)(av_sequence_offset_end - av_sequence_offset_start);
|
||||
}
|
||||
|
|
@ -905,12 +905,12 @@ srs_error_t SrsFlvVodStreamDecoder::seek2(int64_t offset)
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
if (offset >= reader->filesize()) {
|
||||
return srs_error_new(ERROR_SYSTEM_FILE_EOF, "flv fast decoder seek overflow file, size=%d, offset=%d", (int)reader->filesize(), (int)offset);
|
||||
if (offset >= reader_->filesize()) {
|
||||
return srs_error_new(ERROR_SYSTEM_FILE_EOF, "flv fast decoder seek overflow file, size=%d, offset=%d", (int)reader_->filesize(), (int)offset);
|
||||
}
|
||||
|
||||
if (reader->seek2(offset) < 0) {
|
||||
return srs_error_new(ERROR_SYSTEM_FILE_SEEK, "flv fast decoder seek error, size=%d, offset=%d", (int)reader->filesize(), (int)offset);
|
||||
if (reader_->seek2(offset) < 0) {
|
||||
return srs_error_new(ERROR_SYSTEM_FILE_SEEK, "flv fast decoder seek error, size=%d, offset=%d", (int)reader_->filesize(), (int)offset);
|
||||
}
|
||||
|
||||
return err;
|
||||
|
|
|
|||
|
|
@ -137,26 +137,26 @@ public:
|
|||
// 3bytes.
|
||||
// Three-byte field that contains a timestamp delta of the message.
|
||||
// @remark, only used for decoding message from chunk stream.
|
||||
int32_t timestamp_delta;
|
||||
int32_t timestamp_delta_;
|
||||
// 3bytes.
|
||||
// Three-byte field that represents the size of the payload in bytes.
|
||||
// It is set in big-endian format.
|
||||
int32_t payload_length;
|
||||
int32_t payload_length_;
|
||||
// 1byte.
|
||||
// One byte field to represent the message type. A range of type IDs
|
||||
// (1-7) are reserved for protocol control messages.
|
||||
// For example, RTMP_MSG_AudioMessage or RTMP_MSG_VideoMessage.
|
||||
int8_t message_type;
|
||||
int8_t message_type_;
|
||||
// 4bytes.
|
||||
// Four-byte field that identifies the stream of the message. These
|
||||
// bytes are set in little-endian format.
|
||||
int32_t stream_id;
|
||||
int32_t stream_id_;
|
||||
|
||||
// Four-byte field that contains a timestamp of the message.
|
||||
// The 4 bytes are packed in the big-endian order.
|
||||
// @remark, used as calc timestamp when decode and encode time.
|
||||
// @remark, we use 64bits for large time for jitter detect and hls.
|
||||
int64_t timestamp;
|
||||
int64_t timestamp_;
|
||||
|
||||
public:
|
||||
SrsMessageHeader();
|
||||
|
|
@ -193,7 +193,7 @@ class SrsRtmpCommonMessage
|
|||
{
|
||||
public:
|
||||
// 4.1. Message Header
|
||||
SrsMessageHeader header;
|
||||
SrsMessageHeader header_;
|
||||
|
||||
public:
|
||||
// 4.2. Message Payload
|
||||
|
|
@ -230,10 +230,10 @@ private:
|
|||
bool has_audio_;
|
||||
bool has_video_;
|
||||
bool drop_if_not_match_;
|
||||
ISrsWriter *writer;
|
||||
ISrsWriter *writer_;
|
||||
|
||||
private:
|
||||
char tag_header[SRS_FLV_TAG_HEADER_SIZE];
|
||||
char tag_header_[SRS_FLV_TAG_HEADER_SIZE];
|
||||
|
||||
public:
|
||||
SrsFlvTransmuxer();
|
||||
|
|
@ -277,14 +277,14 @@ public:
|
|||
|
||||
private:
|
||||
// The cache tag header.
|
||||
int nb_tag_headers;
|
||||
char *tag_headers;
|
||||
int nb_tag_headers_;
|
||||
char *tag_headers_;
|
||||
// The cache pps(previous tag size)
|
||||
int nb_ppts;
|
||||
char *ppts;
|
||||
int nb_ppts_;
|
||||
char *ppts_;
|
||||
// The cache iovss.
|
||||
int nb_iovss_cache;
|
||||
iovec *iovss_cache;
|
||||
int nb_iovss_cache_;
|
||||
iovec *iovss_cache_;
|
||||
|
||||
public:
|
||||
// Write the tags in a time.
|
||||
|
|
@ -302,7 +302,7 @@ private:
|
|||
class SrsFlvDecoder
|
||||
{
|
||||
private:
|
||||
ISrsReader *reader;
|
||||
ISrsReader *reader_;
|
||||
|
||||
public:
|
||||
SrsFlvDecoder();
|
||||
|
|
@ -335,7 +335,7 @@ public:
|
|||
class SrsFlvVodStreamDecoder
|
||||
{
|
||||
private:
|
||||
SrsFileReader *reader;
|
||||
SrsFileReader *reader_;
|
||||
|
||||
public:
|
||||
SrsFlvVodStreamDecoder();
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ using namespace std;
|
|||
|
||||
SrsRateSample::SrsRateSample()
|
||||
{
|
||||
total = time = -1;
|
||||
rate = 0;
|
||||
total_ = time_ = -1;
|
||||
rate_ = 0;
|
||||
}
|
||||
|
||||
SrsRateSample::~SrsRateSample()
|
||||
|
|
@ -25,23 +25,23 @@ SrsRateSample::~SrsRateSample()
|
|||
|
||||
SrsRateSample *SrsRateSample::update(int64_t nn, srs_utime_t t, int k)
|
||||
{
|
||||
total = nn;
|
||||
time = t;
|
||||
rate = k;
|
||||
total_ = nn;
|
||||
time_ = t;
|
||||
rate_ = k;
|
||||
return this;
|
||||
}
|
||||
|
||||
void srs_pps_init(SrsRateSample &sample, int64_t nn, srs_utime_t now)
|
||||
{
|
||||
if (sample.time < 0 || nn < sample.total) {
|
||||
if (sample.time_ < 0 || nn < sample.total_) {
|
||||
sample.update(nn, now, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void srs_pps_update(SrsRateSample &sample, int64_t nn, srs_utime_t now)
|
||||
{
|
||||
int pps = (int)((nn - sample.total) * 1000 / srsu2ms(now - sample.time));
|
||||
if (pps == 0 && nn > sample.total) {
|
||||
int pps = (int)((nn - sample.total_) * 1000 / srsu2ms(now - sample.time_));
|
||||
if (pps == 0 && nn > sample.total_) {
|
||||
pps = 1; // For pps in (0, 1), we set to 1.
|
||||
}
|
||||
sample.update(nn, now, pps);
|
||||
|
|
@ -50,7 +50,7 @@ void srs_pps_update(SrsRateSample &sample, int64_t nn, srs_utime_t now)
|
|||
SrsPps::SrsPps()
|
||||
{
|
||||
clk_ = _srs_clock;
|
||||
sugar = 0;
|
||||
sugar_ = 0;
|
||||
}
|
||||
|
||||
SrsPps::~SrsPps()
|
||||
|
|
@ -59,7 +59,7 @@ SrsPps::~SrsPps()
|
|||
|
||||
void SrsPps::update()
|
||||
{
|
||||
update(sugar);
|
||||
update(sugar_);
|
||||
}
|
||||
|
||||
void SrsPps::update(int64_t nn)
|
||||
|
|
@ -74,31 +74,31 @@ void SrsPps::update(int64_t nn)
|
|||
srs_pps_init(sample_5m_, nn, now);
|
||||
srs_pps_init(sample_60m_, nn, now);
|
||||
|
||||
if (now - sample_10s_.time >= 10 * SRS_UTIME_SECONDS) {
|
||||
if (now - sample_10s_.time_ >= 10 * SRS_UTIME_SECONDS) {
|
||||
srs_pps_update(sample_10s_, nn, now);
|
||||
}
|
||||
if (now - sample_30s_.time >= 30 * SRS_UTIME_SECONDS) {
|
||||
if (now - sample_30s_.time_ >= 30 * SRS_UTIME_SECONDS) {
|
||||
srs_pps_update(sample_30s_, nn, now);
|
||||
}
|
||||
if (now - sample_1m_.time >= 60 * SRS_UTIME_SECONDS) {
|
||||
if (now - sample_1m_.time_ >= 60 * SRS_UTIME_SECONDS) {
|
||||
srs_pps_update(sample_1m_, nn, now);
|
||||
}
|
||||
if (now - sample_5m_.time >= 300 * SRS_UTIME_SECONDS) {
|
||||
if (now - sample_5m_.time_ >= 300 * SRS_UTIME_SECONDS) {
|
||||
srs_pps_update(sample_5m_, nn, now);
|
||||
}
|
||||
if (now - sample_60m_.time >= 3600 * SRS_UTIME_SECONDS) {
|
||||
if (now - sample_60m_.time_ >= 3600 * SRS_UTIME_SECONDS) {
|
||||
srs_pps_update(sample_60m_, nn, now);
|
||||
}
|
||||
}
|
||||
|
||||
int SrsPps::r10s()
|
||||
{
|
||||
return sample_10s_.rate;
|
||||
return sample_10s_.rate_;
|
||||
}
|
||||
|
||||
int SrsPps::r30s()
|
||||
{
|
||||
return sample_30s_.rate;
|
||||
return sample_30s_.rate_;
|
||||
}
|
||||
|
||||
SrsWallClock::SrsWallClock()
|
||||
|
|
@ -344,14 +344,14 @@ void srs_global_kbps_update(SrsKbpsStats *stats)
|
|||
{
|
||||
static char buf[128];
|
||||
|
||||
string &cid_desc = stats->cid_desc;
|
||||
string &cid_desc = stats->cid_desc_;
|
||||
_srs_pps_cids_get->update();
|
||||
_srs_pps_cids_set->update();
|
||||
if (_srs_pps_cids_get->r10s() || _srs_pps_cids_set->r10s()) {
|
||||
snprintf(buf, sizeof(buf), ", cid=%d,%d", _srs_pps_cids_get->r10s(), _srs_pps_cids_set->r10s());
|
||||
cid_desc = buf;
|
||||
}
|
||||
string &timer_desc = stats->timer_desc;
|
||||
string &timer_desc = stats->timer_desc_;
|
||||
_srs_pps_timer->update();
|
||||
_srs_pps_pub->update();
|
||||
_srs_pps_conn->update();
|
||||
|
|
@ -360,14 +360,14 @@ void srs_global_kbps_update(SrsKbpsStats *stats)
|
|||
timer_desc = buf;
|
||||
}
|
||||
|
||||
string &free_desc = stats->free_desc;
|
||||
string &free_desc = stats->free_desc_;
|
||||
_srs_pps_dispose->update();
|
||||
if (_srs_pps_dispose->r10s()) {
|
||||
snprintf(buf, sizeof(buf), ", free=%d", _srs_pps_dispose->r10s());
|
||||
free_desc = buf;
|
||||
}
|
||||
|
||||
string &recvfrom_desc = stats->recvfrom_desc;
|
||||
string &recvfrom_desc = stats->recvfrom_desc_;
|
||||
(void)recvfrom_desc;
|
||||
#if defined(SRS_DEBUG) && defined(SRS_DEBUG_STATS)
|
||||
_srs_pps_recvfrom->update(_st_stat_recvfrom);
|
||||
|
|
@ -380,7 +380,7 @@ void srs_global_kbps_update(SrsKbpsStats *stats)
|
|||
}
|
||||
#endif
|
||||
|
||||
string &io_desc = stats->io_desc;
|
||||
string &io_desc = stats->io_desc_;
|
||||
(void)io_desc;
|
||||
#if defined(SRS_DEBUG) && defined(SRS_DEBUG_STATS)
|
||||
_srs_pps_read->update(_st_stat_read);
|
||||
|
|
@ -395,7 +395,7 @@ void srs_global_kbps_update(SrsKbpsStats *stats)
|
|||
}
|
||||
#endif
|
||||
|
||||
string &msg_desc = stats->msg_desc;
|
||||
string &msg_desc = stats->msg_desc_;
|
||||
(void)msg_desc;
|
||||
#if defined(SRS_DEBUG) && defined(SRS_DEBUG_STATS)
|
||||
_srs_pps_recvmsg->update(_st_stat_recvmsg);
|
||||
|
|
@ -408,7 +408,7 @@ void srs_global_kbps_update(SrsKbpsStats *stats)
|
|||
}
|
||||
#endif
|
||||
|
||||
string &epoll_desc = stats->epoll_desc;
|
||||
string &epoll_desc = stats->epoll_desc_;
|
||||
(void)epoll_desc;
|
||||
#if defined(SRS_DEBUG) && defined(SRS_DEBUG_STATS)
|
||||
_srs_pps_epoll->update(_st_stat_epoll);
|
||||
|
|
@ -421,7 +421,7 @@ void srs_global_kbps_update(SrsKbpsStats *stats)
|
|||
}
|
||||
#endif
|
||||
|
||||
string &sched_desc = stats->sched_desc;
|
||||
string &sched_desc = stats->sched_desc_;
|
||||
(void)sched_desc;
|
||||
#if defined(SRS_DEBUG) && defined(SRS_DEBUG_STATS)
|
||||
_srs_pps_sched_160ms->update(_st_stat_sched_160ms);
|
||||
|
|
@ -439,7 +439,7 @@ void srs_global_kbps_update(SrsKbpsStats *stats)
|
|||
}
|
||||
#endif
|
||||
|
||||
string &clock_desc = stats->clock_desc;
|
||||
string &clock_desc = stats->clock_desc_;
|
||||
_srs_pps_clock_15ms->update();
|
||||
_srs_pps_clock_20ms->update();
|
||||
_srs_pps_clock_25ms->update();
|
||||
|
|
@ -454,7 +454,7 @@ void srs_global_kbps_update(SrsKbpsStats *stats)
|
|||
clock_desc = buf;
|
||||
}
|
||||
|
||||
string &thread_desc = stats->thread_desc;
|
||||
string &thread_desc = stats->thread_desc_;
|
||||
(void)thread_desc;
|
||||
#if defined(SRS_DEBUG) && defined(SRS_DEBUG_STATS)
|
||||
_srs_pps_thread_run->update(_st_stat_thread_run);
|
||||
|
|
@ -467,7 +467,7 @@ void srs_global_kbps_update(SrsKbpsStats *stats)
|
|||
}
|
||||
#endif
|
||||
|
||||
string &objs_desc = stats->objs_desc;
|
||||
string &objs_desc = stats->objs_desc_;
|
||||
_srs_pps_objs_rtps->update();
|
||||
_srs_pps_objs_rraw->update();
|
||||
_srs_pps_objs_rfua->update();
|
||||
|
|
@ -486,7 +486,7 @@ void srs_global_rtc_update(SrsKbsRtcStats *stats)
|
|||
{
|
||||
static char buf[128];
|
||||
|
||||
string &rpkts_desc = stats->rpkts_desc;
|
||||
string &rpkts_desc = stats->rpkts_desc_;
|
||||
_srs_pps_rpkts->update();
|
||||
_srs_pps_rrtps->update();
|
||||
_srs_pps_rstuns->update();
|
||||
|
|
@ -496,7 +496,7 @@ void srs_global_rtc_update(SrsKbsRtcStats *stats)
|
|||
rpkts_desc = buf;
|
||||
}
|
||||
|
||||
string &spkts_desc = stats->spkts_desc;
|
||||
string &spkts_desc = stats->spkts_desc_;
|
||||
_srs_pps_spkts->update();
|
||||
_srs_pps_srtps->update();
|
||||
_srs_pps_sstuns->update();
|
||||
|
|
@ -506,7 +506,7 @@ void srs_global_rtc_update(SrsKbsRtcStats *stats)
|
|||
spkts_desc = buf;
|
||||
}
|
||||
|
||||
string &rtcp_desc = stats->rtcp_desc;
|
||||
string &rtcp_desc = stats->rtcp_desc_;
|
||||
_srs_pps_pli->update();
|
||||
_srs_pps_twcc->update();
|
||||
_srs_pps_rr->update();
|
||||
|
|
@ -515,7 +515,7 @@ void srs_global_rtc_update(SrsKbsRtcStats *stats)
|
|||
rtcp_desc = buf;
|
||||
}
|
||||
|
||||
string &snk_desc = stats->snk_desc;
|
||||
string &snk_desc = stats->snk_desc_;
|
||||
_srs_pps_snack->update();
|
||||
_srs_pps_snack2->update();
|
||||
_srs_pps_sanack->update();
|
||||
|
|
@ -525,7 +525,7 @@ void srs_global_rtc_update(SrsKbsRtcStats *stats)
|
|||
snk_desc = buf;
|
||||
}
|
||||
|
||||
string &rnk_desc = stats->rnk_desc;
|
||||
string &rnk_desc = stats->rnk_desc_;
|
||||
_srs_pps_rnack->update();
|
||||
_srs_pps_rnack2->update();
|
||||
_srs_pps_rhnack->update();
|
||||
|
|
@ -535,7 +535,7 @@ void srs_global_rtc_update(SrsKbsRtcStats *stats)
|
|||
rnk_desc = buf;
|
||||
}
|
||||
|
||||
string &fid_desc = stats->fid_desc;
|
||||
string &fid_desc = stats->fid_desc_;
|
||||
_srs_pps_ids->update();
|
||||
_srs_pps_fids->update();
|
||||
_srs_pps_fids_level0->update();
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@ class SrsWallClock;
|
|||
class SrsRateSample
|
||||
{
|
||||
public:
|
||||
int64_t total;
|
||||
srs_utime_t time;
|
||||
int64_t total_;
|
||||
srs_utime_t time_;
|
||||
// kbps or kps
|
||||
int rate;
|
||||
int rate_;
|
||||
|
||||
public:
|
||||
SrsRateSample();
|
||||
|
|
@ -48,7 +48,7 @@ private:
|
|||
|
||||
public:
|
||||
// Sugar for target to stat.
|
||||
int64_t sugar;
|
||||
int64_t sugar_;
|
||||
|
||||
public:
|
||||
SrsPps();
|
||||
|
|
@ -200,17 +200,17 @@ srs_error_t srs_global_kbps_initialize();
|
|||
class SrsKbpsStats
|
||||
{
|
||||
public:
|
||||
std::string cid_desc;
|
||||
std::string timer_desc;
|
||||
std::string free_desc;
|
||||
std::string recvfrom_desc;
|
||||
std::string io_desc;
|
||||
std::string msg_desc;
|
||||
std::string epoll_desc;
|
||||
std::string sched_desc;
|
||||
std::string clock_desc;
|
||||
std::string thread_desc;
|
||||
std::string objs_desc;
|
||||
std::string cid_desc_;
|
||||
std::string timer_desc_;
|
||||
std::string free_desc_;
|
||||
std::string recvfrom_desc_;
|
||||
std::string io_desc_;
|
||||
std::string msg_desc_;
|
||||
std::string epoll_desc_;
|
||||
std::string sched_desc_;
|
||||
std::string clock_desc_;
|
||||
std::string thread_desc_;
|
||||
std::string objs_desc_;
|
||||
};
|
||||
|
||||
// Update the global kbps statistics variables
|
||||
|
|
@ -219,12 +219,12 @@ void srs_global_kbps_update(SrsKbpsStats *stats);
|
|||
class SrsKbsRtcStats
|
||||
{
|
||||
public:
|
||||
std::string rpkts_desc;
|
||||
std::string spkts_desc;
|
||||
std::string rtcp_desc;
|
||||
std::string snk_desc;
|
||||
std::string rnk_desc;
|
||||
std::string fid_desc;
|
||||
std::string rpkts_desc_;
|
||||
std::string spkts_desc_;
|
||||
std::string rtcp_desc_;
|
||||
std::string snk_desc_;
|
||||
std::string rnk_desc_;
|
||||
std::string fid_desc_;
|
||||
};
|
||||
|
||||
// Update the global rtc statistics variables
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ using namespace std;
|
|||
|
||||
SrsMp3Transmuxer::SrsMp3Transmuxer()
|
||||
{
|
||||
writer = NULL;
|
||||
writer_ = NULL;
|
||||
}
|
||||
|
||||
SrsMp3Transmuxer::~SrsMp3Transmuxer()
|
||||
|
|
@ -40,7 +40,7 @@ srs_error_t SrsMp3Transmuxer::initialize(SrsFileWriter *fw)
|
|||
return srs_error_new(ERROR_KERNEL_MP3_STREAM_CLOSED, "stream is not open");
|
||||
}
|
||||
|
||||
writer = fw;
|
||||
writer_ = fw;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
@ -60,7 +60,7 @@ srs_error_t SrsMp3Transmuxer::write_header()
|
|||
(char)0x00, (char)0x00 // Flags
|
||||
};
|
||||
|
||||
if ((err = writer->write(id3, sizeof(id3), NULL)) != srs_success) {
|
||||
if ((err = writer_->write(id3, sizeof(id3), NULL)) != srs_success) {
|
||||
return srs_error_wrap(err, "write id3");
|
||||
}
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ srs_error_t SrsMp3Transmuxer::write_audio(int64_t timestamp, char *data, int siz
|
|||
return srs_error_new(ERROR_MP3_DECODE_ERROR, "mp3 decode aac_packet_type failed");
|
||||
}
|
||||
|
||||
if ((err = writer->write(data + stream->pos(), size - stream->pos(), NULL)) != srs_success) {
|
||||
if ((err = writer_->write(data + stream->pos(), size - stream->pos(), NULL)) != srs_success) {
|
||||
return srs_error_wrap(err, "write audio");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class SrsFileWriter;
|
|||
class SrsMp3Transmuxer
|
||||
{
|
||||
private:
|
||||
SrsFileWriter *writer;
|
||||
SrsFileWriter *writer_;
|
||||
|
||||
public:
|
||||
SrsMp3Transmuxer();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -21,9 +21,9 @@ class SrsNaluSample
|
|||
{
|
||||
public:
|
||||
// The size of unit.
|
||||
int size;
|
||||
int size_;
|
||||
// The ptr of unit, user must free it.
|
||||
char *bytes;
|
||||
char *bytes_;
|
||||
|
||||
public:
|
||||
SrsNaluSample();
|
||||
|
|
@ -42,14 +42,14 @@ class SrsMediaPacket
|
|||
{
|
||||
public:
|
||||
// Timestamp of the media packet. The timebase is defined by context.
|
||||
int64_t timestamp;
|
||||
int64_t timestamp_;
|
||||
// Type of the media packet (audio, video, or script).
|
||||
SrsFrameType message_type;
|
||||
SrsFrameType message_type_;
|
||||
|
||||
public:
|
||||
// Stream identifier for the packet. It's optional, so only used for some
|
||||
// protocols, for example, RTMP.
|
||||
int32_t stream_id;
|
||||
int32_t stream_id_;
|
||||
|
||||
public:
|
||||
// Raw payload data of the media packet.
|
||||
|
|
@ -88,17 +88,17 @@ class SrsParsedPacket
|
|||
{
|
||||
public:
|
||||
// The DTS/PTS in milliseconds, which is TBN=1000.
|
||||
int64_t dts;
|
||||
int64_t dts_;
|
||||
// PTS = DTS + CTS.
|
||||
int32_t cts;
|
||||
int32_t cts_;
|
||||
|
||||
public:
|
||||
// The codec info of frame.
|
||||
SrsCodecConfig *codec;
|
||||
SrsCodecConfig *codec_;
|
||||
// The actual parsed number of samples.
|
||||
int nb_samples;
|
||||
int nb_samples_;
|
||||
// The sampels cache.
|
||||
SrsNaluSample samples[SrsMaxNbSamples];
|
||||
SrsNaluSample samples_[SrsMaxNbSamples];
|
||||
|
||||
public:
|
||||
SrsParsedPacket();
|
||||
|
|
@ -115,7 +115,7 @@ public:
|
|||
class SrsParsedAudioPacket : public SrsParsedPacket
|
||||
{
|
||||
public:
|
||||
SrsAudioAacFrameTrait aac_packet_type;
|
||||
SrsAudioAacFrameTrait aac_packet_type_;
|
||||
|
||||
public:
|
||||
SrsParsedAudioPacket();
|
||||
|
|
@ -130,16 +130,16 @@ class SrsParsedVideoPacket : public SrsParsedPacket
|
|||
{
|
||||
public:
|
||||
// video specified
|
||||
SrsVideoAvcFrameType frame_type;
|
||||
SrsVideoAvcFrameTrait avc_packet_type;
|
||||
SrsVideoAvcFrameType frame_type_;
|
||||
SrsVideoAvcFrameTrait avc_packet_type_;
|
||||
// whether sample_units contains IDR frame.
|
||||
bool has_idr;
|
||||
bool has_idr_;
|
||||
// Whether exists AUD NALU.
|
||||
bool has_aud;
|
||||
bool has_aud_;
|
||||
// Whether exists SPS/PPS NALU.
|
||||
bool has_sps_pps;
|
||||
bool has_sps_pps_;
|
||||
// The first nalu type.
|
||||
SrsAvcNaluType first_nalu_type;
|
||||
SrsAvcNaluType first_nalu_type_;
|
||||
|
||||
public:
|
||||
SrsParsedVideoPacket();
|
||||
|
|
@ -169,21 +169,21 @@ public:
|
|||
class SrsFormat
|
||||
{
|
||||
public:
|
||||
SrsParsedAudioPacket *audio;
|
||||
SrsAudioCodecConfig *acodec;
|
||||
SrsParsedVideoPacket *video;
|
||||
SrsVideoCodecConfig *vcodec;
|
||||
SrsParsedAudioPacket *audio_;
|
||||
SrsAudioCodecConfig *acodec_;
|
||||
SrsParsedVideoPacket *video_;
|
||||
SrsVideoCodecConfig *vcodec_;
|
||||
|
||||
public:
|
||||
char *raw;
|
||||
int nb_raw;
|
||||
char *raw_;
|
||||
int nb_raw_;
|
||||
|
||||
public:
|
||||
// for sequence header, whether parse the h.264 sps.
|
||||
// TODO: FIXME: Refine it.
|
||||
bool avc_parse_sps;
|
||||
bool avc_parse_sps_;
|
||||
// Whether try to parse in ANNEXB, then by IBMF.
|
||||
bool try_annexb_first;
|
||||
bool try_annexb_first_;
|
||||
|
||||
public:
|
||||
SrsFormat();
|
||||
|
|
|
|||
|
|
@ -110,13 +110,13 @@ srs_error_t SrsPsContext::decode(SrsBuffer *stream, ISrsPsMessageHandler *handle
|
|||
// Reap the last completed PS message.
|
||||
SrsUniquePtr<SrsTsMessage> msg(reap());
|
||||
|
||||
if (msg->sid == SrsTsPESStreamIdProgramStreamMap) {
|
||||
if (!msg->payload || !msg->payload->length()) {
|
||||
if (msg->sid_ == SrsTsPESStreamIdProgramStreamMap) {
|
||||
if (!msg->payload_ || !msg->payload_->length()) {
|
||||
return srs_error_new(ERROR_GB_PS_HEADER, "empty PSM payload");
|
||||
}
|
||||
|
||||
// Decode PSM(Program Stream map) from PES packet payload.
|
||||
SrsBuffer buf(msg->payload->bytes(), msg->payload->length());
|
||||
SrsBuffer buf(msg->payload_->bytes(), msg->payload_->length());
|
||||
|
||||
SrsPsPsmPacket psm;
|
||||
if ((err = psm.decode(&buf)) != srs_success) {
|
||||
|
|
@ -277,19 +277,19 @@ srs_error_t SrsPsPacket::decode(SrsBuffer *stream)
|
|||
SrsTsMessage *lm = context_->last();
|
||||
|
||||
// The stream id should never change for PS stream.
|
||||
if (lm->sid != (SrsTsPESStreamId)0 && lm->sid != (SrsTsPESStreamId)pes.stream_id) {
|
||||
return srs_error_new(ERROR_GB_PS_PSE, "PS stream id change from %#x to %#x", lm->sid, pes.stream_id);
|
||||
if (lm->sid_ != (SrsTsPESStreamId)0 && lm->sid_ != (SrsTsPESStreamId)pes.stream_id_) {
|
||||
return srs_error_new(ERROR_GB_PS_PSE, "PS stream id change from %#x to %#x", lm->sid_, pes.stream_id_);
|
||||
}
|
||||
lm->sid = (SrsTsPESStreamId)pes.stream_id;
|
||||
lm->sid_ = (SrsTsPESStreamId)pes.stream_id_;
|
||||
|
||||
if (pes.PTS_DTS_flags == 0x02 || pes.PTS_DTS_flags == 0x03) {
|
||||
lm->dts = pes.dts;
|
||||
lm->pts = pes.pts;
|
||||
if (pes.PTS_DTS_flags_ == 0x02 || pes.PTS_DTS_flags_ == 0x03) {
|
||||
lm->dts_ = pes.dts_;
|
||||
lm->pts_ = pes.pts_;
|
||||
}
|
||||
if (pes.has_payload_) {
|
||||
// The size of PS message, should be always a positive value.
|
||||
lm->PES_packet_length = pes.nb_payload_;
|
||||
if ((err = lm->dump(stream, &pes.nb_bytes)) != srs_success) {
|
||||
lm->PES_packet_length_ = pes.nb_payload_;
|
||||
if ((err = lm->dump(stream, &pes.nb_bytes_)) != srs_success) {
|
||||
return srs_error_wrap(err, "dump pes");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -487,78 +487,78 @@ uint8_t SrsRtcpRR::type() const
|
|||
|
||||
uint32_t SrsRtcpRR::get_rb_ssrc() const
|
||||
{
|
||||
return rb_.ssrc;
|
||||
return rb_.ssrc_;
|
||||
}
|
||||
|
||||
float SrsRtcpRR::get_lost_rate() const
|
||||
{
|
||||
return rb_.fraction_lost / 256;
|
||||
return rb_.fraction_lost_ / 256;
|
||||
}
|
||||
|
||||
uint32_t SrsRtcpRR::get_lost_packets() const
|
||||
{
|
||||
return rb_.lost_packets;
|
||||
return rb_.lost_packets_;
|
||||
}
|
||||
|
||||
uint32_t SrsRtcpRR::get_highest_sn() const
|
||||
{
|
||||
return rb_.highest_sn;
|
||||
return rb_.highest_sn_;
|
||||
}
|
||||
|
||||
uint32_t SrsRtcpRR::get_jitter() const
|
||||
{
|
||||
return rb_.jitter;
|
||||
return rb_.jitter_;
|
||||
}
|
||||
|
||||
uint32_t SrsRtcpRR::get_lsr() const
|
||||
{
|
||||
return rb_.lsr;
|
||||
return rb_.lsr_;
|
||||
}
|
||||
|
||||
uint32_t SrsRtcpRR::get_dlsr() const
|
||||
{
|
||||
return rb_.dlsr;
|
||||
return rb_.dlsr_;
|
||||
}
|
||||
|
||||
void SrsRtcpRR::set_rb_ssrc(uint32_t ssrc)
|
||||
{
|
||||
rb_.ssrc = ssrc;
|
||||
rb_.ssrc_ = ssrc;
|
||||
}
|
||||
|
||||
void SrsRtcpRR::set_lost_rate(float rate)
|
||||
{
|
||||
rb_.fraction_lost = rate * 256;
|
||||
rb_.fraction_lost_ = rate * 256;
|
||||
}
|
||||
|
||||
void SrsRtcpRR::set_lost_packets(uint32_t count)
|
||||
{
|
||||
rb_.lost_packets = count;
|
||||
rb_.lost_packets_ = count;
|
||||
}
|
||||
|
||||
void SrsRtcpRR::set_highest_sn(uint32_t sn)
|
||||
{
|
||||
rb_.highest_sn = sn;
|
||||
rb_.highest_sn_ = sn;
|
||||
}
|
||||
|
||||
void SrsRtcpRR::set_jitter(uint32_t jitter)
|
||||
{
|
||||
rb_.jitter = jitter;
|
||||
rb_.jitter_ = jitter;
|
||||
}
|
||||
|
||||
void SrsRtcpRR::set_lsr(uint32_t lsr)
|
||||
{
|
||||
rb_.lsr = lsr;
|
||||
rb_.lsr_ = lsr;
|
||||
}
|
||||
|
||||
void SrsRtcpRR::set_dlsr(uint32_t dlsr)
|
||||
{
|
||||
rb_.dlsr = dlsr;
|
||||
rb_.dlsr_ = dlsr;
|
||||
}
|
||||
|
||||
void SrsRtcpRR::set_sender_ntp(uint64_t ntp)
|
||||
{
|
||||
uint32_t lsr = (uint32_t)((ntp >> 16) & 0x00000000FFFFFFFF);
|
||||
rb_.lsr = lsr;
|
||||
rb_.lsr_ = lsr;
|
||||
}
|
||||
|
||||
srs_error_t SrsRtcpRR::decode(SrsBuffer *buffer)
|
||||
|
|
@ -609,13 +609,13 @@ block +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|||
}
|
||||
|
||||
// TODO: FIXME: Security check for read.
|
||||
rb_.ssrc = buffer->read_4bytes();
|
||||
rb_.fraction_lost = buffer->read_1bytes();
|
||||
rb_.lost_packets = buffer->read_3bytes();
|
||||
rb_.highest_sn = buffer->read_4bytes();
|
||||
rb_.jitter = buffer->read_4bytes();
|
||||
rb_.lsr = buffer->read_4bytes();
|
||||
rb_.dlsr = buffer->read_4bytes();
|
||||
rb_.ssrc_ = buffer->read_4bytes();
|
||||
rb_.fraction_lost_ = buffer->read_1bytes();
|
||||
rb_.lost_packets_ = buffer->read_3bytes();
|
||||
rb_.highest_sn_ = buffer->read_4bytes();
|
||||
rb_.jitter_ = buffer->read_4bytes();
|
||||
rb_.lsr_ = buffer->read_4bytes();
|
||||
rb_.dlsr_ = buffer->read_4bytes();
|
||||
|
||||
// TODO: FIXME: Security check for read.
|
||||
if (header_.rc > 1) {
|
||||
|
|
@ -673,23 +673,23 @@ block +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|||
return srs_error_wrap(err, "encode header");
|
||||
}
|
||||
|
||||
buffer->write_4bytes(rb_.ssrc);
|
||||
buffer->write_1bytes(rb_.fraction_lost);
|
||||
buffer->write_3bytes(rb_.lost_packets);
|
||||
buffer->write_4bytes(rb_.highest_sn);
|
||||
buffer->write_4bytes(rb_.jitter);
|
||||
buffer->write_4bytes(rb_.lsr);
|
||||
buffer->write_4bytes(rb_.dlsr);
|
||||
buffer->write_4bytes(rb_.ssrc_);
|
||||
buffer->write_1bytes(rb_.fraction_lost_);
|
||||
buffer->write_3bytes(rb_.lost_packets_);
|
||||
buffer->write_4bytes(rb_.highest_sn_);
|
||||
buffer->write_4bytes(rb_.jitter_);
|
||||
buffer->write_4bytes(rb_.lsr_);
|
||||
buffer->write_4bytes(rb_.dlsr_);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
SrsRtcpTWCC::SrsRtcpTWCCChunk::SrsRtcpTWCCChunk()
|
||||
: size(0), all_same(true), has_large_delta(false)
|
||||
: size_(0), all_same_(true), has_large_delta_(false)
|
||||
{
|
||||
}
|
||||
|
||||
SrsRtcpTWCC::SrsRtcpTWCC(uint32_t sender_ssrc) : pkt_len(0)
|
||||
SrsRtcpTWCC::SrsRtcpTWCC(uint32_t sender_ssrc) : pkt_len_(0)
|
||||
{
|
||||
header_.padding = 0;
|
||||
header_.type = SrsRtcpType_rtpfb;
|
||||
|
|
@ -850,21 +850,21 @@ srs_utime_t SrsRtcpTWCC::calculate_delta_us(srs_utime_t ts, srs_utime_t last)
|
|||
bool SrsRtcpTWCC::can_add_to_chunk(SrsRtcpTWCC::SrsRtcpTWCCChunk &chunk, int delta_size)
|
||||
{
|
||||
srs_verbose("can_add %d chunk->size %u delta_sizes %d %d %d %d %d %d %d %d %d %d %d %d %d %d all_same %d has_large_delta %d",
|
||||
delta_size, chunk.size, chunk.delta_sizes[0], chunk.delta_sizes[1], chunk.delta_sizes[2], chunk.delta_sizes[3],
|
||||
chunk.delta_sizes[4], chunk.delta_sizes[5], chunk.delta_sizes[6], chunk.delta_sizes[7], chunk.delta_sizes[8],
|
||||
chunk.delta_sizes[9], chunk.delta_sizes[10], chunk.delta_sizes[11], chunk.delta_sizes[12], chunk.delta_sizes[13],
|
||||
(int)chunk.all_same, (int)chunk.has_large_delta);
|
||||
delta_size, chunk.size_, chunk.delta_sizes_[0], chunk.delta_sizes_[1], chunk.delta_sizes_[2], chunk.delta_sizes_[3],
|
||||
chunk.delta_sizes_[4], chunk.delta_sizes_[5], chunk.delta_sizes_[6], chunk.delta_sizes_[7], chunk.delta_sizes_[8],
|
||||
chunk.delta_sizes_[9], chunk.delta_sizes_[10], chunk.delta_sizes_[11], chunk.delta_sizes_[12], chunk.delta_sizes_[13],
|
||||
(int)chunk.all_same_, (int)chunk.has_large_delta_);
|
||||
|
||||
if (chunk.size < kTwccFbTwoBitElements) {
|
||||
if (chunk.size_ < kTwccFbTwoBitElements) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (chunk.size < kTwccFbOneBitElements && !chunk.has_large_delta && delta_size != kTwccFbLargeRecvDeltaBytes) {
|
||||
if (chunk.size_ < kTwccFbOneBitElements && !chunk.has_large_delta_ && delta_size != kTwccFbLargeRecvDeltaBytes) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (chunk.size < kTwccFbMaxRunLength && chunk.all_same && chunk.delta_sizes[0] == delta_size) {
|
||||
srs_verbose("< %d && all_same && delta_size[0] %d == %d", kTwccFbMaxRunLength, chunk.delta_sizes[0], delta_size);
|
||||
if (chunk.size_ < kTwccFbMaxRunLength && chunk.all_same_ && chunk.delta_sizes_[0] == delta_size) {
|
||||
srs_verbose("< %d && all_same && delta_size[0] %d == %d", kTwccFbMaxRunLength, chunk.delta_sizes_[0], delta_size);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -873,25 +873,25 @@ bool SrsRtcpTWCC::can_add_to_chunk(SrsRtcpTWCC::SrsRtcpTWCCChunk &chunk, int del
|
|||
|
||||
void SrsRtcpTWCC::add_to_chunk(SrsRtcpTWCC::SrsRtcpTWCCChunk &chunk, int delta_size)
|
||||
{
|
||||
if (chunk.size < kTwccFbMaxBitElements) {
|
||||
chunk.delta_sizes[chunk.size] = delta_size;
|
||||
if (chunk.size_ < kTwccFbMaxBitElements) {
|
||||
chunk.delta_sizes_[chunk.size_] = delta_size;
|
||||
}
|
||||
|
||||
chunk.size += 1;
|
||||
chunk.all_same = chunk.all_same && delta_size == chunk.delta_sizes[0];
|
||||
chunk.has_large_delta = chunk.has_large_delta || delta_size >= kTwccFbLargeRecvDeltaBytes;
|
||||
chunk.size_ += 1;
|
||||
chunk.all_same_ = chunk.all_same_ && delta_size == chunk.delta_sizes_[0];
|
||||
chunk.has_large_delta_ = chunk.has_large_delta_ || delta_size >= kTwccFbLargeRecvDeltaBytes;
|
||||
}
|
||||
|
||||
srs_error_t SrsRtcpTWCC::encode_chunk_run_length(SrsRtcpTWCC::SrsRtcpTWCCChunk &chunk)
|
||||
{
|
||||
if (!chunk.all_same || chunk.size > kTwccFbMaxRunLength) {
|
||||
return srs_error_new(ERROR_RTC_RTCP, "invalid run all_same:%d, size:%d", chunk.all_same, chunk.size);
|
||||
if (!chunk.all_same_ || chunk.size_ > kTwccFbMaxRunLength) {
|
||||
return srs_error_new(ERROR_RTC_RTCP, "invalid run all_same:%d, size:%d", chunk.all_same_, chunk.size_);
|
||||
}
|
||||
|
||||
uint16_t encoded_chunk = (chunk.delta_sizes[0] << 13) | chunk.size;
|
||||
uint16_t encoded_chunk = (chunk.delta_sizes_[0] << 13) | chunk.size_;
|
||||
|
||||
encoded_chucks_.push_back(encoded_chunk);
|
||||
pkt_len += sizeof(encoded_chunk);
|
||||
pkt_len_ += sizeof(encoded_chunk);
|
||||
|
||||
return srs_success;
|
||||
}
|
||||
|
|
@ -899,17 +899,17 @@ srs_error_t SrsRtcpTWCC::encode_chunk_run_length(SrsRtcpTWCC::SrsRtcpTWCCChunk &
|
|||
srs_error_t SrsRtcpTWCC::encode_chunk_one_bit(SrsRtcpTWCC::SrsRtcpTWCCChunk &chunk)
|
||||
{
|
||||
int i = 0;
|
||||
if (chunk.has_large_delta) {
|
||||
if (chunk.has_large_delta_) {
|
||||
return srs_error_new(ERROR_RTC_RTCP, "invalid large delta");
|
||||
}
|
||||
|
||||
uint16_t encoded_chunk = 0x8000;
|
||||
for (i = 0; i < chunk.size; ++i) {
|
||||
encoded_chunk |= (chunk.delta_sizes[i] << (kTwccFbOneBitElements - 1 - i));
|
||||
for (i = 0; i < chunk.size_; ++i) {
|
||||
encoded_chunk |= (chunk.delta_sizes_[i] << (kTwccFbOneBitElements - 1 - i));
|
||||
}
|
||||
|
||||
encoded_chucks_.push_back(encoded_chunk);
|
||||
pkt_len += sizeof(encoded_chunk);
|
||||
pkt_len_ += sizeof(encoded_chunk);
|
||||
|
||||
// 1 0 symbol_list
|
||||
return srs_success;
|
||||
|
|
@ -923,20 +923,20 @@ srs_error_t SrsRtcpTWCC::encode_chunk_two_bit(SrsRtcpTWCC::SrsRtcpTWCCChunk &chu
|
|||
uint16_t encoded_chunk = 0xc000;
|
||||
// 1 1 symbol_list
|
||||
for (i = 0; i < size; ++i) {
|
||||
encoded_chunk |= (chunk.delta_sizes[i] << (2 * (kTwccFbTwoBitElements - 1 - i)));
|
||||
encoded_chunk |= (chunk.delta_sizes_[i] << (2 * (kTwccFbTwoBitElements - 1 - i)));
|
||||
}
|
||||
encoded_chucks_.push_back(encoded_chunk);
|
||||
pkt_len += sizeof(encoded_chunk);
|
||||
pkt_len_ += sizeof(encoded_chunk);
|
||||
|
||||
if (shift) {
|
||||
chunk.size -= size;
|
||||
chunk.all_same = true;
|
||||
chunk.has_large_delta = false;
|
||||
for (i = 0; i < chunk.size; ++i) {
|
||||
delta_size = chunk.delta_sizes[i + size];
|
||||
chunk.delta_sizes[i] = delta_size;
|
||||
chunk.all_same = (chunk.all_same && delta_size == chunk.delta_sizes[0]);
|
||||
chunk.has_large_delta = chunk.has_large_delta || delta_size == kTwccFbLargeRecvDeltaBytes;
|
||||
chunk.size_ -= size;
|
||||
chunk.all_same_ = true;
|
||||
chunk.has_large_delta_ = false;
|
||||
for (i = 0; i < chunk.size_; ++i) {
|
||||
delta_size = chunk.delta_sizes_[i + size];
|
||||
chunk.delta_sizes_[i] = delta_size;
|
||||
chunk.all_same_ = (chunk.all_same_ && delta_size == chunk.delta_sizes_[0]);
|
||||
chunk.has_large_delta_ = chunk.has_large_delta_ || delta_size == kTwccFbLargeRecvDeltaBytes;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -945,10 +945,10 @@ srs_error_t SrsRtcpTWCC::encode_chunk_two_bit(SrsRtcpTWCC::SrsRtcpTWCCChunk &chu
|
|||
|
||||
void SrsRtcpTWCC::reset_chunk(SrsRtcpTWCC::SrsRtcpTWCCChunk &chunk)
|
||||
{
|
||||
chunk.size = 0;
|
||||
chunk.size_ = 0;
|
||||
|
||||
chunk.all_same = true;
|
||||
chunk.has_large_delta = false;
|
||||
chunk.all_same_ = true;
|
||||
chunk.has_large_delta_ = false;
|
||||
}
|
||||
|
||||
srs_error_t SrsRtcpTWCC::encode_chunk(SrsRtcpTWCC::SrsRtcpTWCCChunk &chunk)
|
||||
|
|
@ -959,7 +959,7 @@ srs_error_t SrsRtcpTWCC::encode_chunk(SrsRtcpTWCC::SrsRtcpTWCCChunk &chunk)
|
|||
return srs_error_new(ERROR_RTC_RTCP, "TWCC chunk");
|
||||
}
|
||||
|
||||
if (chunk.all_same) {
|
||||
if (chunk.all_same_) {
|
||||
if ((err = encode_chunk_run_length(chunk)) != srs_success) {
|
||||
return srs_error_wrap(err, "encode run");
|
||||
}
|
||||
|
|
@ -967,7 +967,7 @@ srs_error_t SrsRtcpTWCC::encode_chunk(SrsRtcpTWCC::SrsRtcpTWCCChunk &chunk)
|
|||
return err;
|
||||
}
|
||||
|
||||
if (chunk.size == kTwccFbOneBitElements) {
|
||||
if (chunk.size_ == kTwccFbOneBitElements) {
|
||||
if ((err = encode_chunk_one_bit(chunk)) != srs_success) {
|
||||
return srs_error_wrap(err, "encode chunk");
|
||||
}
|
||||
|
|
@ -984,11 +984,11 @@ srs_error_t SrsRtcpTWCC::encode_chunk(SrsRtcpTWCC::SrsRtcpTWCCChunk &chunk)
|
|||
|
||||
srs_error_t SrsRtcpTWCC::encode_remaining_chunk(SrsRtcpTWCC::SrsRtcpTWCCChunk &chunk)
|
||||
{
|
||||
if (chunk.all_same) {
|
||||
if (chunk.all_same_) {
|
||||
return encode_chunk_run_length(chunk);
|
||||
} else if (chunk.size <= kTwccFbTwoBitElements) {
|
||||
} else if (chunk.size_ <= kTwccFbTwoBitElements) {
|
||||
// FIXME, TRUE or FALSE
|
||||
return encode_chunk_two_bit(chunk, chunk.size, false);
|
||||
return encode_chunk_two_bit(chunk, chunk.size_, false);
|
||||
}
|
||||
return encode_chunk_one_bit(chunk);
|
||||
}
|
||||
|
|
@ -997,15 +997,15 @@ srs_error_t SrsRtcpTWCC::process_pkt_chunk(SrsRtcpTWCC::SrsRtcpTWCCChunk &chunk,
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
size_t needed_chunk_size = chunk.size == 0 ? kTwccFbChunkBytes : 0;
|
||||
size_t needed_chunk_size = chunk.size_ == 0 ? kTwccFbChunkBytes : 0;
|
||||
|
||||
size_t might_occupied = pkt_len + needed_chunk_size + delta_size;
|
||||
size_t might_occupied = pkt_len_ + needed_chunk_size + delta_size;
|
||||
if (might_occupied > (size_t)kRtcpPacketSize) {
|
||||
return srs_error_new(ERROR_RTC_RTCP, "might_occupied %zu", might_occupied);
|
||||
}
|
||||
|
||||
if (can_add_to_chunk(chunk, delta_size)) {
|
||||
// pkt_len += needed_chunk_size;
|
||||
// pkt_len_ += needed_chunk_size;
|
||||
add_to_chunk(chunk, delta_size);
|
||||
return err;
|
||||
}
|
||||
|
|
@ -1065,7 +1065,7 @@ srs_error_t SrsRtcpTWCC::do_encode(SrsBuffer *buffer)
|
|||
return srs_error_new(ERROR_RTC_RTCP, "requires %d bytes", nb_bytes());
|
||||
}
|
||||
|
||||
pkt_len = kTwccFbPktHeaderSize;
|
||||
pkt_len_ = kTwccFbPktHeaderSize;
|
||||
|
||||
set<uint16_t, SrsSeqCompareLess>::iterator it_sn = recv_sns_.begin();
|
||||
if (!next_base_sn_) {
|
||||
|
|
@ -1089,7 +1089,7 @@ srs_error_t SrsRtcpTWCC::do_encode(SrsBuffer *buffer)
|
|||
for (; it_sn != recv_sns_.end(); ++it_sn) {
|
||||
// check whether exceed buffer len
|
||||
// max recv_delta_size = 2
|
||||
if (pkt_len + 2 >= buffer->left()) {
|
||||
if (pkt_len_ + 2 >= buffer->left()) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1123,7 +1123,7 @@ srs_error_t SrsRtcpTWCC::do_encode(SrsBuffer *buffer)
|
|||
|
||||
pkt_deltas_.push_back(delta);
|
||||
last_ts += delta * kTwccFbDeltaUnit;
|
||||
pkt_len += recv_delta_size;
|
||||
pkt_len_ += recv_delta_size;
|
||||
last_sn = current_sn;
|
||||
|
||||
recv_packets_.erase(it_ts);
|
||||
|
|
@ -1134,17 +1134,17 @@ srs_error_t SrsRtcpTWCC::do_encode(SrsBuffer *buffer)
|
|||
next_base_sn_ = *it_sn;
|
||||
}
|
||||
|
||||
if (0 < chunk.size) {
|
||||
if (0 < chunk.size_) {
|
||||
if ((err = encode_remaining_chunk(chunk)) != srs_success) {
|
||||
return srs_error_wrap(err, "encode chunk");
|
||||
}
|
||||
}
|
||||
|
||||
// encode rtcp twcc packet
|
||||
if ((pkt_len % 4) == 0) {
|
||||
header_.length = pkt_len / 4;
|
||||
if ((pkt_len_ % 4) == 0) {
|
||||
header_.length = pkt_len_ / 4;
|
||||
} else {
|
||||
header_.length = (pkt_len + 4 - (pkt_len % 4)) / 4;
|
||||
header_.length = (pkt_len_ + 4 - (pkt_len_ % 4)) / 4;
|
||||
}
|
||||
header_.length -= 1;
|
||||
|
||||
|
|
@ -1183,9 +1183,9 @@ srs_error_t SrsRtcpTWCC::do_encode(SrsBuffer *buffer)
|
|||
}
|
||||
}
|
||||
|
||||
while ((pkt_len % 4) != 0) {
|
||||
while ((pkt_len_ % 4) != 0) {
|
||||
buffer->write_1bytes(0);
|
||||
pkt_len++;
|
||||
pkt_len_++;
|
||||
}
|
||||
|
||||
encoded_chucks_.clear();
|
||||
|
|
@ -1312,14 +1312,14 @@ srs_error_t SrsRtcpNack::encode(SrsBuffer *buffer)
|
|||
vector<SrsPidBlp> chunks;
|
||||
do {
|
||||
SrsPidBlp chunk;
|
||||
chunk.in_use = false;
|
||||
chunk.in_use_ = false;
|
||||
uint16_t pid = 0;
|
||||
for (set<uint16_t, SrsSeqCompareLess>::iterator it = lost_sns_.begin(); it != lost_sns_.end(); ++it) {
|
||||
uint16_t sn = *it;
|
||||
if (!chunk.in_use) {
|
||||
chunk.pid = sn;
|
||||
chunk.blp = 0;
|
||||
chunk.in_use = true;
|
||||
if (!chunk.in_use_) {
|
||||
chunk.pid_ = sn;
|
||||
chunk.blp_ = 0;
|
||||
chunk.in_use_ = true;
|
||||
pid = sn;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1330,15 +1330,15 @@ srs_error_t SrsRtcpNack::encode(SrsBuffer *buffer)
|
|||
chunks.push_back(chunk);
|
||||
|
||||
// start new chunk
|
||||
chunk.pid = sn;
|
||||
chunk.blp = 0;
|
||||
chunk.in_use = true;
|
||||
chunk.pid_ = sn;
|
||||
chunk.blp_ = 0;
|
||||
chunk.in_use_ = true;
|
||||
pid = sn;
|
||||
} else {
|
||||
chunk.blp |= 1 << (sn - pid - 1);
|
||||
chunk.blp_ |= 1 << (sn - pid - 1);
|
||||
}
|
||||
}
|
||||
if (chunk.in_use) {
|
||||
if (chunk.in_use_) {
|
||||
chunks.push_back(chunk);
|
||||
}
|
||||
|
||||
|
|
@ -1350,8 +1350,8 @@ srs_error_t SrsRtcpNack::encode(SrsBuffer *buffer)
|
|||
|
||||
buffer->write_4bytes(media_ssrc_);
|
||||
for (vector<SrsPidBlp>::iterator it_chunk = chunks.begin(); it_chunk != chunks.end(); it_chunk++) {
|
||||
buffer->write_2bytes(it_chunk->pid);
|
||||
buffer->write_2bytes(it_chunk->blp);
|
||||
buffer->write_2bytes(it_chunk->pid_);
|
||||
buffer->write_2bytes(it_chunk->blp_);
|
||||
}
|
||||
} while (0);
|
||||
|
||||
|
|
|
|||
|
|
@ -122,23 +122,23 @@ public:
|
|||
};
|
||||
|
||||
struct SrsRtcpRB {
|
||||
uint32_t ssrc;
|
||||
uint8_t fraction_lost;
|
||||
uint32_t lost_packets;
|
||||
uint32_t highest_sn;
|
||||
uint32_t jitter;
|
||||
uint32_t lsr;
|
||||
uint32_t dlsr;
|
||||
uint32_t ssrc_;
|
||||
uint8_t fraction_lost_;
|
||||
uint32_t lost_packets_;
|
||||
uint32_t highest_sn_;
|
||||
uint32_t jitter_;
|
||||
uint32_t lsr_;
|
||||
uint32_t dlsr_;
|
||||
|
||||
SrsRtcpRB()
|
||||
{
|
||||
ssrc = 0;
|
||||
fraction_lost = 0;
|
||||
lost_packets = 0;
|
||||
highest_sn = 0;
|
||||
jitter = 0;
|
||||
lsr = 0;
|
||||
dlsr = 0;
|
||||
ssrc_ = 0;
|
||||
fraction_lost_ = 0;
|
||||
lost_packets_ = 0;
|
||||
highest_sn_ = 0;
|
||||
jitter_ = 0;
|
||||
lsr_ = 0;
|
||||
dlsr_ = 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -284,14 +284,14 @@ private:
|
|||
std::set<uint16_t, SrsSeqCompareLess> recv_sns_;
|
||||
|
||||
struct SrsRtcpTWCCChunk {
|
||||
uint8_t delta_sizes[kTwccFbMaxBitElements];
|
||||
uint16_t size;
|
||||
bool all_same;
|
||||
bool has_large_delta;
|
||||
uint8_t delta_sizes_[kTwccFbMaxBitElements];
|
||||
uint16_t size_;
|
||||
bool all_same_;
|
||||
bool has_large_delta_;
|
||||
SrsRtcpTWCCChunk();
|
||||
};
|
||||
|
||||
int pkt_len;
|
||||
int pkt_len_;
|
||||
uint16_t next_base_sn_;
|
||||
|
||||
private:
|
||||
|
|
@ -340,9 +340,9 @@ class SrsRtcpNack : public SrsRtcpFbCommon
|
|||
{
|
||||
private:
|
||||
struct SrsPidBlp {
|
||||
uint16_t pid;
|
||||
uint16_t blp;
|
||||
bool in_use;
|
||||
uint16_t pid_;
|
||||
uint16_t blp_;
|
||||
bool in_use_;
|
||||
};
|
||||
|
||||
std::set<uint16_t, SrsSeqCompareLess> lost_sns_;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -239,14 +239,14 @@ public:
|
|||
class SrsRtpHeader // : public ISrsCodec
|
||||
{
|
||||
private:
|
||||
uint8_t padding_length;
|
||||
uint8_t cc;
|
||||
bool marker;
|
||||
uint8_t payload_type;
|
||||
uint16_t sequence;
|
||||
uint32_t timestamp;
|
||||
uint32_t ssrc;
|
||||
uint32_t csrc[15];
|
||||
uint8_t padding_length_;
|
||||
uint8_t cc_;
|
||||
bool marker_;
|
||||
uint8_t payload_type_;
|
||||
uint16_t sequence_;
|
||||
uint32_t timestamp_;
|
||||
uint32_t ssrc_;
|
||||
uint32_t csrc_[15];
|
||||
SrsRtpExtensions extensions_;
|
||||
bool ignore_padding_;
|
||||
|
||||
|
|
@ -275,7 +275,7 @@ public:
|
|||
void set_timestamp(uint32_t v);
|
||||
uint32_t get_timestamp() const;
|
||||
void set_ssrc(uint32_t v);
|
||||
inline uint32_t get_ssrc() const { return ssrc; } // SrsRtpHeader::get_ssrc
|
||||
inline uint32_t get_ssrc() const { return ssrc_; } // SrsRtpHeader::get_ssrc
|
||||
void set_padding(uint8_t v);
|
||||
uint8_t get_padding() const;
|
||||
void set_extensions(SrsRtpExtensionTypes *extmap);
|
||||
|
|
@ -341,15 +341,15 @@ private:
|
|||
// Helper fields.
|
||||
public:
|
||||
// The first byte as nalu type, for video decoder only.
|
||||
uint8_t nalu_type;
|
||||
uint8_t nalu_type_;
|
||||
// The frame type, for RTMP bridge or SFU source.
|
||||
SrsFrameType frame_type;
|
||||
SrsFrameType frame_type_;
|
||||
// Fast cache for performance.
|
||||
private:
|
||||
// The cached payload size for packet.
|
||||
int cached_payload_size;
|
||||
int cached_payload_size_;
|
||||
// The helper handler for decoder, use RAW payload if NULL.
|
||||
ISrsRtpPacketDecodeHandler *decode_handler;
|
||||
ISrsRtpPacketDecodeHandler *decode_handler_;
|
||||
|
||||
private:
|
||||
int64_t avsync_time_;
|
||||
|
|
@ -407,8 +407,8 @@ class SrsRtpRawPayload : public ISrsRtpPayloader
|
|||
public:
|
||||
// The RAW payload, directly point to the shared memory.
|
||||
// @remark We only refer to the memory, user must free its bytes.
|
||||
char *payload;
|
||||
int nn_payload;
|
||||
char *payload_;
|
||||
int nn_payload_;
|
||||
|
||||
public:
|
||||
// Use the whole RAW RTP payload as a sample.
|
||||
|
|
@ -430,9 +430,9 @@ class SrsRtpRawNALUs : public ISrsRtpPayloader
|
|||
{
|
||||
private:
|
||||
// We will manage the samples, but the sample itself point to the shared memory.
|
||||
std::vector<SrsNaluSample *> nalus;
|
||||
int nn_bytes;
|
||||
int cursor;
|
||||
std::vector<SrsNaluSample *> nalus_;
|
||||
int nn_bytes_;
|
||||
int cursor_;
|
||||
|
||||
public:
|
||||
SrsRtpRawNALUs();
|
||||
|
|
@ -458,10 +458,10 @@ class SrsRtpSTAPPayload : public ISrsRtpPayloader
|
|||
{
|
||||
public:
|
||||
// The NRI in NALU type.
|
||||
SrsAvcNaluType nri;
|
||||
SrsAvcNaluType nri_;
|
||||
// The NALU samples, we will manage the samples.
|
||||
// @remark We only refer to the memory, user must free its bytes.
|
||||
std::vector<SrsNaluSample *> nalus;
|
||||
std::vector<SrsNaluSample *> nalus_;
|
||||
|
||||
public:
|
||||
SrsRtpSTAPPayload();
|
||||
|
|
@ -484,14 +484,14 @@ class SrsRtpFUAPayload : public ISrsRtpPayloader
|
|||
{
|
||||
public:
|
||||
// The NRI in NALU type.
|
||||
SrsAvcNaluType nri;
|
||||
SrsAvcNaluType nri_;
|
||||
// The FUA header.
|
||||
bool start;
|
||||
bool end;
|
||||
SrsAvcNaluType nalu_type;
|
||||
bool start_;
|
||||
bool end_;
|
||||
SrsAvcNaluType nalu_type_;
|
||||
// The NALU samples, we manage the samples.
|
||||
// @remark We only refer to the memory, user must free its bytes.
|
||||
std::vector<SrsNaluSample *> nalus;
|
||||
std::vector<SrsNaluSample *> nalus_;
|
||||
|
||||
public:
|
||||
SrsRtpFUAPayload();
|
||||
|
|
@ -510,14 +510,14 @@ class SrsRtpFUAPayload2 : public ISrsRtpPayloader
|
|||
{
|
||||
public:
|
||||
// The NRI in NALU type.
|
||||
SrsAvcNaluType nri;
|
||||
SrsAvcNaluType nri_;
|
||||
// The FUA header.
|
||||
bool start;
|
||||
bool end;
|
||||
SrsAvcNaluType nalu_type;
|
||||
bool start_;
|
||||
bool end_;
|
||||
SrsAvcNaluType nalu_type_;
|
||||
// The payload and size,
|
||||
char *payload;
|
||||
int size;
|
||||
char *payload_;
|
||||
int size_;
|
||||
|
||||
public:
|
||||
SrsRtpFUAPayload2();
|
||||
|
|
@ -535,7 +535,7 @@ class SrsRtpSTAPPayloadHevc : public ISrsRtpPayloader
|
|||
public:
|
||||
// The NALU samples, we will manage the samples.
|
||||
// @remark We only refer to the memory, user must free its bytes.
|
||||
std::vector<SrsNaluSample *> nalus;
|
||||
std::vector<SrsNaluSample *> nalus_;
|
||||
|
||||
public:
|
||||
SrsRtpSTAPPayloadHevc();
|
||||
|
|
@ -559,12 +559,12 @@ class SrsRtpFUAPayloadHevc : public ISrsRtpPayloader
|
|||
{
|
||||
public:
|
||||
// The FUA header.
|
||||
bool start;
|
||||
bool end;
|
||||
SrsHevcNaluType nalu_type;
|
||||
bool start_;
|
||||
bool end_;
|
||||
SrsHevcNaluType nalu_type_;
|
||||
// The NALU samples, we manage the samples.
|
||||
// @remark We only refer to the memory, user must free its bytes.
|
||||
std::vector<SrsNaluSample *> nalus;
|
||||
std::vector<SrsNaluSample *> nalus_;
|
||||
|
||||
public:
|
||||
SrsRtpFUAPayloadHevc();
|
||||
|
|
@ -582,11 +582,11 @@ public:
|
|||
class SrsRtpFUAPayloadHevc2 : public ISrsRtpPayloader
|
||||
{
|
||||
public:
|
||||
bool start;
|
||||
bool end;
|
||||
SrsHevcNaluType nalu_type;
|
||||
char *payload;
|
||||
int size;
|
||||
bool start_;
|
||||
bool end_;
|
||||
SrsHevcNaluType nalu_type_;
|
||||
char *payload_;
|
||||
int size_;
|
||||
|
||||
public:
|
||||
SrsRtpFUAPayloadHevc2();
|
||||
|
|
|
|||
|
|
@ -21,14 +21,14 @@ SrsSimpleStream::~SrsSimpleStream()
|
|||
|
||||
int SrsSimpleStream::length()
|
||||
{
|
||||
int len = (int)data.size();
|
||||
int len = (int)data_.size();
|
||||
srs_assert(len >= 0);
|
||||
return len;
|
||||
}
|
||||
|
||||
char *SrsSimpleStream::bytes()
|
||||
{
|
||||
return (length() == 0) ? NULL : &data.at(0);
|
||||
return (length() == 0) ? NULL : &data_.at(0);
|
||||
}
|
||||
|
||||
void SrsSimpleStream::erase(int size)
|
||||
|
|
@ -38,17 +38,17 @@ void SrsSimpleStream::erase(int size)
|
|||
}
|
||||
|
||||
if (size >= length()) {
|
||||
data.clear();
|
||||
data_.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
data.erase(data.begin(), data.begin() + size);
|
||||
data_.erase(data_.begin(), data_.begin() + size);
|
||||
}
|
||||
|
||||
void SrsSimpleStream::append(const char *bytes, int size)
|
||||
{
|
||||
if (size > 0) {
|
||||
data.insert(data.end(), bytes, bytes + size);
|
||||
data_.insert(data_.end(), bytes, bytes + size);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
class SrsSimpleStream
|
||||
{
|
||||
private:
|
||||
std::vector<char> data;
|
||||
std::vector<char> data_;
|
||||
|
||||
public:
|
||||
SrsSimpleStream();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -138,13 +138,13 @@ std::string srs_ts_stream2string(SrsTsStream stream);
|
|||
|
||||
// The ts channel.
|
||||
struct SrsTsChannel {
|
||||
int pid;
|
||||
SrsTsPidApply apply;
|
||||
SrsTsStream stream;
|
||||
SrsTsMessage *msg;
|
||||
SrsTsContext *context;
|
||||
int pid_;
|
||||
SrsTsPidApply apply_;
|
||||
SrsTsStream stream_;
|
||||
SrsTsMessage *msg_;
|
||||
SrsTsContext *context_;
|
||||
// for encoder.
|
||||
uint8_t continuity_counter;
|
||||
uint8_t continuity_counter_;
|
||||
|
||||
SrsTsChannel();
|
||||
virtual ~SrsTsChannel();
|
||||
|
|
@ -213,36 +213,36 @@ class SrsTsMessage
|
|||
{
|
||||
public:
|
||||
// For decoder only, the ts message does not use them, for user to get the channel and packet.
|
||||
SrsTsChannel *channel;
|
||||
SrsTsPacket *packet;
|
||||
SrsTsChannel *channel_;
|
||||
SrsTsPacket *packet_;
|
||||
// For decoder only, the ts message does not use them, to get the RTP packet source.
|
||||
void *ps_helper_;
|
||||
|
||||
public:
|
||||
// The audio cache buffer start pts, to flush audio if full.
|
||||
// @remark the pts is not the adjust one, it's the orignal pts.
|
||||
int64_t start_pts;
|
||||
int64_t start_pts_;
|
||||
// Whether this message with pcr info,
|
||||
// generally, the video IDR(I frame, the keyframe of h.264) carray the pcr info.
|
||||
bool write_pcr;
|
||||
bool write_pcr_;
|
||||
// Whether got discontinuity ts, for example, sequence header changed.
|
||||
bool is_discontinuity;
|
||||
bool is_discontinuity_;
|
||||
|
||||
public:
|
||||
// The chunk id of TS packet.
|
||||
uint8_t continuity_counter;
|
||||
uint8_t continuity_counter_;
|
||||
|
||||
public:
|
||||
// The timestamp in 90khz
|
||||
int64_t dts;
|
||||
int64_t pts;
|
||||
int64_t dts_;
|
||||
int64_t pts_;
|
||||
// The id of pes stream to indicates the payload codec.
|
||||
// @remark use is_audio() and is_video() to check it, and stream_number() to finger it out.
|
||||
SrsTsPESStreamId sid;
|
||||
SrsTsPESStreamId sid_;
|
||||
// The size of payload, 0 indicates the length() of payload.
|
||||
uint16_t PES_packet_length;
|
||||
uint16_t PES_packet_length_;
|
||||
// The payload bytes.
|
||||
SrsSimpleStream *payload;
|
||||
SrsSimpleStream *payload_;
|
||||
|
||||
public:
|
||||
SrsTsMessage(SrsTsChannel *c = NULL, SrsTsPacket *p = NULL);
|
||||
|
|
@ -298,17 +298,17 @@ private:
|
|||
// Whether context is ready, failed if try to write data when not ready.
|
||||
// When PAT and PMT writen, the context is ready.
|
||||
// @see https://github.com/ossrs/srs/issues/834
|
||||
bool ready;
|
||||
bool ready_;
|
||||
|
||||
private:
|
||||
std::map<int, SrsTsChannel *> pids;
|
||||
bool pure_audio;
|
||||
int8_t sync_byte;
|
||||
std::map<int, SrsTsChannel *> pids_;
|
||||
bool pure_audio_;
|
||||
int8_t sync_byte_;
|
||||
|
||||
private:
|
||||
// when any codec changed, write the PAT/PMT.
|
||||
SrsVideoCodecId vcodec;
|
||||
SrsAudioCodecId acodec;
|
||||
SrsVideoCodecId vcodec_;
|
||||
SrsAudioCodecId acodec_;
|
||||
|
||||
public:
|
||||
SrsTsContext();
|
||||
|
|
@ -361,13 +361,13 @@ public:
|
|||
// 1B
|
||||
// The sync_byte is a fixed 8-bit field whose value is '0100 0111' (0x47). Sync_byte emulation in the choice of
|
||||
// values for other regularly occurring fields, such as PID, should be avoided.
|
||||
int8_t sync_byte; // 8bits
|
||||
int8_t sync_byte_; // 8bits
|
||||
|
||||
// 2B
|
||||
// The transport_error_indicator is a 1-bit flag. When set to '1' it indicates that at least
|
||||
// 1 uncorrectable bit error exists in the associated Transport Stream packet. This bit may be set to '1' by entities external to
|
||||
// the transport layer. When set to '1' this bit shall not be reset to '0' unless the bit value(s) in error have been corrected.
|
||||
int8_t transport_error_indicator; // 1bit
|
||||
int8_t transport_error_indicator_; // 1bit
|
||||
// The payload_unit_start_indicator is a 1-bit flag which has normative meaning for
|
||||
// Transport Stream packets that carry PES packets (refer to 2.4.3.6) or PSI data (refer to 2.4.4).
|
||||
//
|
||||
|
|
@ -387,31 +387,31 @@ public:
|
|||
// For null packets the payload_unit_start_indicator shall be set to '0'.
|
||||
//
|
||||
// The meaning of this bit for Transport Stream packets carrying only private data is not defined in this Specification.
|
||||
int8_t payload_unit_start_indicator; // 1bit
|
||||
int8_t payload_unit_start_indicator_; // 1bit
|
||||
// The transport_priority is a 1-bit indicator. When set to '1' it indicates that the associated packet is
|
||||
// of greater priority than other packets having the same PID which do not have the bit set to '1'. The transport mechanism
|
||||
// can use this to prioritize its data within an elementary stream. Depending on the application the transport_priority field
|
||||
// may be coded regardless of the PID or within one PID only. This field may be changed by channel specific encoders or
|
||||
// decoders.
|
||||
int8_t transport_priority; // 1bit
|
||||
int8_t transport_priority_; // 1bit
|
||||
// The PID is a 13-bit field, indicating the type of the data stored in the packet payload. PID value 0x0000 is
|
||||
// reserved for the Program Association Table (see Table 2-25). PID value 0x0001 is reserved for the Conditional Access
|
||||
// Table (see Table 2-27). PID values 0x0002 - 0x000F are reserved. PID value 0x1FFF is reserved for null packets (see
|
||||
// Table 2-3).
|
||||
SrsTsPid pid; // 13bits
|
||||
SrsTsPid pid_; // 13bits
|
||||
|
||||
// 1B
|
||||
// This 2-bit field indicates the scrambling mode of the Transport Stream packet payload.
|
||||
// The Transport Stream packet header, and the adaptation field when present, shall not be scrambled. In the case of a null
|
||||
// packet the value of the transport_scrambling_control field shall be set to '00' (see Table 2-4).
|
||||
SrsTsScrambled transport_scrambling_control; // 2bits
|
||||
SrsTsScrambled transport_scrambling_control_; // 2bits
|
||||
// This 2-bit field indicates whether this Transport Stream packet header is followed by an
|
||||
// adaptation field and/or payload (see Table 2-5).
|
||||
//
|
||||
// ITU-T Rec. H.222.0 | ISO/IEC 13818-1 decoders shall discard Transport Stream packets with the
|
||||
// adaptation_field_control field set to a value of '00'. In the case of a null packet the value of the adaptation_field_control
|
||||
// shall be set to '01'.
|
||||
SrsTsAdaptationFieldType adaption_field_control; // 2bits
|
||||
SrsTsAdaptationFieldType adaption_field_control_; // 2bits
|
||||
// The continuity_counter is a 4-bit field incrementing with each Transport Stream packet with the
|
||||
// same PID. The continuity_counter wraps around to 0 after its maximum value. The continuity_counter shall not be
|
||||
// incremented when the adaptation_field_control of the packet equals '00'(reseverd) or '10'(adaptation field only).
|
||||
|
|
@ -426,13 +426,13 @@ public:
|
|||
// conditions (adaptation_field_control set to '00' or '10', or duplicate packets as described above) are met.
|
||||
// The continuity counter may be discontinuous when the discontinuity_indicator is set to '1' (refer to 2.4.3.4). In the case of
|
||||
// a null packet the value of the continuity_counter is undefined.
|
||||
uint8_t continuity_counter; // 4bits
|
||||
uint8_t continuity_counter_; // 4bits
|
||||
private:
|
||||
SrsTsAdaptationField *adaptation_field;
|
||||
SrsTsPayload *payload;
|
||||
SrsTsAdaptationField *adaptation_field_;
|
||||
SrsTsPayload *payload_;
|
||||
|
||||
public:
|
||||
SrsTsContext *context;
|
||||
SrsTsContext *context_;
|
||||
|
||||
public:
|
||||
SrsTsPacket(SrsTsContext *c);
|
||||
|
|
@ -474,7 +474,7 @@ public:
|
|||
//
|
||||
// This is the only method of stuffing allowed for Transport Stream packets carrying PES packets. For Transport Stream
|
||||
// packets carrying PSI, an alternative stuffing method is described in 2.4.4.
|
||||
uint8_t adaption_field_length; // 8bits
|
||||
uint8_t adaption_field_length_; // 8bits
|
||||
// 1B
|
||||
// This is a 1-bit field which when set to '1' indicates that the discontinuity state is true for the
|
||||
// current Transport Stream packet. When the discontinuity_indicator is set to '0' or is not present, the discontinuity state is
|
||||
|
|
@ -535,7 +535,7 @@ public:
|
|||
// then be followed by a version of the TS_program_map_section for each affected program with the version_number
|
||||
// incremented by one and the current_next_indicator = = 1, containing a complete program definition. This indicates a
|
||||
// version change in PSI data.
|
||||
int8_t discontinuity_indicator; // 1bit
|
||||
int8_t discontinuity_indicator_; // 1bit
|
||||
// The random_access_indicator is a 1-bit field that indicates that the current Transport
|
||||
// Stream packet, and possibly subsequent Transport Stream packets with the same PID, contain some information to aid
|
||||
// random access at this point. Specifically, when the bit is set to '1', the next PES packet to start in the payload of Transport
|
||||
|
|
@ -545,31 +545,31 @@ public:
|
|||
// sequence header. In the case of audio, the presentation timestamp shall be present in the PES packet containing the first
|
||||
// byte of the audio frame. In the PCR_PID the random_access_indicator may only be set to '1' in Transport Stream packet
|
||||
// containing the PCR fields.
|
||||
int8_t random_access_indicator; // 1bit
|
||||
int8_t random_access_indicator_; // 1bit
|
||||
// The elementary_stream_priority_indicator is a 1-bit field. It indicates, among
|
||||
// packets with the same PID, the priority of the elementary stream data carried within the payload of this Transport Stream
|
||||
// packet. A '1' indicates that the payload has a higher priority than the payloads of other Transport Stream packets. In the
|
||||
// case of video, this field may be set to '1' only if the payload contains one or more bytes from an intra-coded slice. A
|
||||
// value of '0' indicates that the payload has the same priority as all other packets which do not have this bit set to '1'.
|
||||
int8_t elementary_stream_priority_indicator; // 1bit
|
||||
int8_t elementary_stream_priority_indicator_; // 1bit
|
||||
// The PCR_flag is a 1-bit flag. A value of '1' indicates that the adaptation_field contains a PCR field coded in
|
||||
// two parts. A value of '0' indicates that the adaptation field does not contain any PCR field.
|
||||
int8_t PCR_flag; // 1bit
|
||||
int8_t PCR_flag_; // 1bit
|
||||
// The OPCR_flag is a 1-bit flag. A value of '1' indicates that the adaptation_field contains an OPCR field
|
||||
// coded in two parts. A value of '0' indicates that the adaptation field does not contain any OPCR field.
|
||||
int8_t OPCR_flag; // 1bit
|
||||
int8_t OPCR_flag_; // 1bit
|
||||
// The splicing_point_flag is a 1-bit flag. When set to '1', it indicates that a splice_countdown field
|
||||
// shall be present in the associated adaptation field, specifying the occurrence of a splicing point. A value of '0' indicates
|
||||
// that a splice_countdown field is not present in the adaptation field.
|
||||
int8_t splicing_point_flag; // 1bit
|
||||
int8_t splicing_point_flag_; // 1bit
|
||||
// The transport_private_data_flag is a 1-bit flag. A value of '1' indicates that the
|
||||
// adaptation field contains one or more private_data bytes. A value of '0' indicates the adaptation field does not contain any
|
||||
// private_data bytes.
|
||||
int8_t transport_private_data_flag; // 1bit
|
||||
int8_t transport_private_data_flag_; // 1bit
|
||||
// The adaptation_field_extension_flag is a 1-bit field which when set to '1' indicates
|
||||
// the presence of an adaptation field extension. A value of '0' indicates that an adaptation field extension is not present in
|
||||
// the adaptation field.
|
||||
int8_t adaptation_field_extension_flag; // 1bit
|
||||
int8_t adaptation_field_extension_flag_; // 1bit
|
||||
|
||||
// If PCR_flag, 6B
|
||||
// The program_clock_reference (PCR) is a
|
||||
|
|
@ -577,10 +577,10 @@ public:
|
|||
// PCR_base(i), as given in equation 2-2. The second part, program_clock_reference_extension, is a 9-bit field whose value
|
||||
// is given by PCR_ext(i), as given in equation 2-3. The PCR indicates the intended time of arrival of the byte containing
|
||||
// the last bit of the program_clock_reference_base at the input of the system target decoder.
|
||||
int64_t program_clock_reference_base; // 33bits
|
||||
int64_t program_clock_reference_base_; // 33bits
|
||||
// 6bits reserved, must be '1'
|
||||
int8_t const1_value0; // 6bits
|
||||
int16_t program_clock_reference_extension; // 9bits
|
||||
int8_t const1_value0_; // 6bits
|
||||
int16_t program_clock_reference_extension_; // 9bits
|
||||
|
||||
// If OPCR_flag, 6B
|
||||
// The optional original
|
||||
|
|
@ -595,10 +595,10 @@ public:
|
|||
// would include at least any PSI and private data packets which were present in the original Transport Stream and would
|
||||
// possibly require other private arrangements. It also means that the OPCR must be an identical copy of its associated PCR
|
||||
// in the original single program Transport Stream.
|
||||
int64_t original_program_clock_reference_base; // 33bits
|
||||
int64_t original_program_clock_reference_base_; // 33bits
|
||||
// 6bits reserved, must be '1'
|
||||
int8_t const1_value2; // 6bits
|
||||
int16_t original_program_clock_reference_extension; // 9bits
|
||||
int8_t const1_value2_; // 6bits
|
||||
int16_t original_program_clock_reference_extension_; // 9bits
|
||||
|
||||
// If splicing_point_flag, 1B
|
||||
// The splice_countdown is an 8-bit field, representing a value which may be positive or negative. A
|
||||
|
|
@ -623,20 +623,20 @@ public:
|
|||
// For the purposes of this subclause, an access point is defined as follows:
|
||||
// Video - The first byte of a video_sequence_header.
|
||||
// Audio - The first byte of an audio frame.
|
||||
int8_t splice_countdown; // 8bits
|
||||
int8_t splice_countdown_; // 8bits
|
||||
|
||||
// If transport_private_data_flag, 1+p[0] B
|
||||
std::vector<char> transport_private_data; //[transport_private_data_length]bytes
|
||||
std::vector<char> transport_private_data_; //[transport_private_data_length]bytes
|
||||
|
||||
// If adaptation_field_extension_flag, 2+x B
|
||||
// The adaptation_field_extension_length is an 8-bit field. It indicates the number of
|
||||
// bytes of the extended adaptation field data immediately following this field, including reserved bytes if present.
|
||||
uint8_t adaptation_field_extension_length; // 8bits
|
||||
uint8_t adaptation_field_extension_length_; // 8bits
|
||||
// This is a 1-bit field which when set to '1' indicates the presence of the ltw_offset
|
||||
// field.
|
||||
int8_t ltw_flag; // 1bit
|
||||
int8_t ltw_flag_; // 1bit
|
||||
// This is a 1-bit field which when set to '1' indicates the presence of the piecewise_rate field.
|
||||
int8_t piecewise_rate_flag; // 1bit
|
||||
int8_t piecewise_rate_flag_; // 1bit
|
||||
// This is a 1-bit flag which when set to '1' indicates that the splice_type and DTS_next_AU fields
|
||||
// are present. A value of '0' indicates that neither splice_type nor DTS_next_AU fields are present. This field shall not be
|
||||
// set to '1' in Transport Stream packets in which the splicing_point_flag is not set to '1'. Once it is set to '1' in a Transport
|
||||
|
|
@ -645,13 +645,13 @@ public:
|
|||
// reaches zero (including this packet). When this flag is set, if the elementary stream carried in this PID is an audio stream,
|
||||
// the splice_type field shall be set to '0000'. If the elementary stream carried in this PID is a video stream, it shall fulfil the
|
||||
// constraints indicated by the splice_type value.
|
||||
int8_t seamless_splice_flag; // 1bit
|
||||
int8_t seamless_splice_flag_; // 1bit
|
||||
// reserved 5bits, must be '1'
|
||||
int8_t const1_value1; // 5bits
|
||||
int8_t const1_value1_; // 5bits
|
||||
// if ltw_flag, 2B
|
||||
// (legal time window_valid_flag) - This is a 1-bit field which when set to '1' indicates that the value of the
|
||||
// ltw_offset shall be valid. A value of '0' indicates that the value in the ltw_offset field is undefined.
|
||||
int8_t ltw_valid_flag; // 1bit
|
||||
int8_t ltw_valid_flag_; // 1bit
|
||||
// (legal time window offset) - This is a 15-bit field, the value of which is defined only if the ltw_valid flag has
|
||||
// a value of '1'. When defined, the legal time window offset is in units of (300/fs) seconds, where fs is the system clock
|
||||
// frequency of the program that this PID belongs to, and fulfils:
|
||||
|
|
@ -660,14 +660,14 @@ public:
|
|||
// where i is the index of the first byte of this Transport Stream packet, offset is the value encoded in this field, t(i) is the
|
||||
// arrival time of byte i in the T-STD, and t1(i) is the upper bound in time of a time interval called the Legal Time Window
|
||||
// which is associated with this Transport Stream packet.
|
||||
int16_t ltw_offset; // 15bits
|
||||
int16_t ltw_offset_; // 15bits
|
||||
// if piecewise_rate_flag, 3B
|
||||
// 2bits reserved
|
||||
// The meaning of this 22-bit field is only defined when both the ltw_flag and the ltw_valid_flag are set
|
||||
// to '1'. When defined, it is a positive integer specifying a hypothetical bitrate R which is used to define the end times of
|
||||
// the Legal Time Windows of Transport Stream packets of the same PID that follow this packet but do not include the
|
||||
// legal_time_window_offset field.
|
||||
int32_t piecewise_rate; // 22bits
|
||||
int32_t piecewise_rate_; // 22bits
|
||||
// if seamless_splice_flag, 5B
|
||||
// This is a 4-bit field. From the first occurrence of this field onwards, it shall have the same value in all the
|
||||
// subsequent Transport Stream packets of the same PID in which it is present, until the packet in which the
|
||||
|
|
@ -675,31 +675,31 @@ public:
|
|||
// this field shall have the value '0000'. If the elementary stream carried in that PID is a video stream, this field indicates the
|
||||
// conditions that shall be respected by this elementary stream for splicing purposes. These conditions are defined as a
|
||||
// function of profile, level and splice_type in Table 2-7 through Table 2-16.
|
||||
int8_t splice_type; // 4bits
|
||||
int8_t splice_type_; // 4bits
|
||||
// (decoding time stamp next access unit) - This is a 33-bit field, coded in three parts. In the case of
|
||||
// continuous and periodic decoding through this splicing point it indicates the decoding time of the first access unit
|
||||
// following the splicing point. This decoding time is expressed in the time base which is valid in the Transport Stream
|
||||
// packet in which the splice_countdown reaches zero. From the first occurrence of this field onwards, it shall have the
|
||||
// same value in all the subsequent Transport Stream packets of the same PID in which it is present, until the packet in
|
||||
// which the splice_countdown reaches zero (including this packet).
|
||||
int8_t DTS_next_AU0; // 3bits
|
||||
int8_t marker_bit0; // 1bit
|
||||
int16_t DTS_next_AU1; // 15bits
|
||||
int8_t marker_bit1; // 1bit
|
||||
int16_t DTS_next_AU2; // 15bits
|
||||
int8_t marker_bit2; // 1bit
|
||||
int8_t DTS_next_AU0_; // 3bits
|
||||
int8_t marker_bit0_; // 1bit
|
||||
int16_t DTS_next_AU1_; // 15bits
|
||||
int8_t marker_bit1_; // 1bit
|
||||
int16_t DTS_next_AU2_; // 15bits
|
||||
int8_t marker_bit2_; // 1bit
|
||||
// left bytes.
|
||||
// This is a fixed 8-bit value equal to '1111 1111' that can be inserted by the encoder. It is discarded by the
|
||||
// decoder.
|
||||
int nb_af_ext_reserved;
|
||||
int nb_af_ext_reserved_;
|
||||
|
||||
// left bytes.
|
||||
// This is a fixed 8-bit value equal to '1111 1111' that can be inserted by the encoder. It is discarded by the
|
||||
// decoder.
|
||||
int nb_af_reserved;
|
||||
int nb_af_reserved_;
|
||||
|
||||
private:
|
||||
SrsTsPacket *packet;
|
||||
SrsTsPacket *packet_;
|
||||
|
||||
public:
|
||||
SrsTsAdaptationField(SrsTsPacket *pkt);
|
||||
|
|
@ -745,7 +745,7 @@ enum SrsTsPsiId {
|
|||
class SrsTsPayload
|
||||
{
|
||||
protected:
|
||||
SrsTsPacket *packet;
|
||||
SrsTsPacket *packet_;
|
||||
|
||||
public:
|
||||
SrsTsPayload(SrsTsPacket *p);
|
||||
|
|
@ -767,77 +767,77 @@ public:
|
|||
// The packet_start_code_prefix is a 24-bit code. Together with the stream_id that follows it
|
||||
// constitutes a packet start code that identifies the beginning of a packet. The packet_start_code_prefix is the bit string
|
||||
// '0000 0000 0000 0000 0000 0001' (0x000001).
|
||||
int32_t packet_start_code_prefix; // 24bits
|
||||
int32_t packet_start_code_prefix_; // 24bits
|
||||
// 1B
|
||||
// In Program Streams, the stream_id specifies the type and number of the elementary stream as defined by the
|
||||
// stream_id Table 2-18. In Transport Streams, the stream_id may be set to any valid value which correctly describes the
|
||||
// elementary stream type as defined in Table 2-18. In Transport Streams, the elementary stream type is specified in the
|
||||
// Program Specific Information as specified in 2.4.4.
|
||||
// @see SrsTsPESStreamId, value can be SrsTsPESStreamIdAudioCommon or SrsTsPESStreamIdVideoCommon.
|
||||
uint8_t stream_id; // 8bits
|
||||
uint8_t stream_id_; // 8bits
|
||||
// 2B
|
||||
// A 16-bit field specifying the number of bytes in the PES packet following the last byte of the
|
||||
// field. A value of 0 indicates that the PES packet length is neither specified nor bounded and is allowed only in
|
||||
// PES packets whose payload consists of bytes from a video elementary stream contained in Transport Stream packets.
|
||||
uint16_t PES_packet_length; // 16bits
|
||||
uint16_t PES_packet_length_; // 16bits
|
||||
|
||||
// 1B
|
||||
// 2bits const '10'
|
||||
int8_t const2bits; // 2bits
|
||||
int8_t const2bits_; // 2bits
|
||||
// The 2-bit PES_scrambling_control field indicates the scrambling mode of the PES packet
|
||||
// payload. When scrambling is performed at the PES level, the PES packet header, including the optional fields when
|
||||
// present, shall not be scrambled (see Table 2-19).
|
||||
int8_t PES_scrambling_control; // 2bits
|
||||
int8_t PES_scrambling_control_; // 2bits
|
||||
// This is a 1-bit field indicating the priority of the payload in this PES packet. A '1' indicates a higher
|
||||
// priority of the payload of the PES packet payload than a PES packet payload with this field set to '0'. A multiplexor can
|
||||
// use the PES_priority bit to prioritize its data within an elementary stream. This field shall not be changed by the transport
|
||||
// mechanism.
|
||||
int8_t PES_priority; // 1bit
|
||||
int8_t PES_priority_; // 1bit
|
||||
// This is a 1-bit flag. When set to a value of '1' it indicates that the PES packet header is
|
||||
// immediately followed by the video start code or audio syncword indicated in the data_stream_alignment_descriptor
|
||||
// in 2.6.10 if this descriptor is present. If set to a value of '1' and the descriptor is not present, alignment as indicated in
|
||||
// alignment_type '01' in Table 2-47 and Table 2-48 is required. When set to a value of '0' it is not defined whether any such
|
||||
// alignment occurs or not.
|
||||
int8_t data_alignment_indicator; // 1bit
|
||||
int8_t data_alignment_indicator_; // 1bit
|
||||
// This is a 1-bit field. When set to '1' it indicates that the material of the associated PES packet payload is
|
||||
// protected by copyright. When set to '0' it is not defined whether the material is protected by copyright. A copyright
|
||||
// descriptor described in 2.6.24 is associated with the elementary stream which contains this PES packet and the copyright
|
||||
// flag is set to '1' if the descriptor applies to the material contained in this PES packet
|
||||
int8_t copyright; // 1bit
|
||||
int8_t copyright_; // 1bit
|
||||
// This is a 1-bit field. When set to '1' the contents of the associated PES packet payload is an original.
|
||||
// When set to '0' it indicates that the contents of the associated PES packet payload is a copy.
|
||||
int8_t original_or_copy; // 1bit
|
||||
int8_t original_or_copy_; // 1bit
|
||||
|
||||
// 1B
|
||||
// This is a 2-bit field. When the PTS_DTS_flags field is set to '10', the PTS fields shall be present in
|
||||
// the PES packet header. When the PTS_DTS_flags field is set to '11', both the PTS fields and DTS fields shall be present
|
||||
// in the PES packet header. When the PTS_DTS_flags field is set to '00' no PTS or DTS fields shall be present in the PES
|
||||
// packet header. The value '01' is forbidden.
|
||||
int8_t PTS_DTS_flags; // 2bits
|
||||
int8_t PTS_DTS_flags_; // 2bits
|
||||
// A 1-bit flag, which when set to '1' indicates that ESCR base and extension fields are present in the PES
|
||||
// packet header. When set to '0' it indicates that no ESCR fields are present.
|
||||
int8_t ESCR_flag; // 1bit
|
||||
int8_t ESCR_flag_; // 1bit
|
||||
// A 1-bit flag, which when set to '1' indicates that the ES_rate field is present in the PES packet header.
|
||||
// When set to '0' it indicates that no ES_rate field is present.
|
||||
int8_t ES_rate_flag; // 1bit
|
||||
int8_t ES_rate_flag_; // 1bit
|
||||
// A 1-bit flag, which when set to '1' it indicates the presence of an 8-bit trick mode field. When
|
||||
// set to '0' it indicates that this field is not present.
|
||||
int8_t DSM_trick_mode_flag; // 1bit
|
||||
int8_t DSM_trick_mode_flag_; // 1bit
|
||||
// A 1-bit flag, which when set to '1' indicates the presence of the additional_copy_info field.
|
||||
// When set to '0' it indicates that this field is not present.
|
||||
int8_t additional_copy_info_flag; // 1bit
|
||||
int8_t additional_copy_info_flag_; // 1bit
|
||||
// A 1-bit flag, which when set to '1' indicates that a CRC field is present in the PES packet. When set to
|
||||
// '0' it indicates that this field is not present.
|
||||
int8_t PES_CRC_flag; // 1bit
|
||||
int8_t PES_CRC_flag_; // 1bit
|
||||
// A 1-bit flag, which when set to '1' indicates that an extension field exists in this PES packet
|
||||
// header. When set to '0' it indicates that this field is not present.
|
||||
int8_t PES_extension_flag; // 1bit
|
||||
int8_t PES_extension_flag_; // 1bit
|
||||
|
||||
// 1B
|
||||
// An 8-bit field specifying the total number of bytes occupied by the optional fields and any
|
||||
// stuffing bytes contained in this PES packet header. The presence of optional fields is indicated in the byte that precedes
|
||||
// the PES_header_data_length field.
|
||||
uint8_t PES_header_data_length; // 8bits
|
||||
uint8_t PES_header_data_length_; // 8bits
|
||||
|
||||
// 5B
|
||||
// Presentation times shall be related to decoding times as follows: The PTS is a 33-bit
|
||||
|
|
@ -855,7 +855,7 @@ public:
|
|||
// --------------2B
|
||||
// 15bits PTS [14..0]
|
||||
// 1bit const '1'
|
||||
int64_t pts; // 33bits
|
||||
int64_t pts_; // 33bits
|
||||
|
||||
// 5B
|
||||
// The DTS is a 33-bit number coded in three separate fields. It indicates the decoding time,
|
||||
|
|
@ -871,7 +871,7 @@ public:
|
|||
// --------------2B
|
||||
// 15bits DTS [14..0]
|
||||
// 1bit const '1'
|
||||
int64_t dts; // 33bits
|
||||
int64_t dts_; // 33bits
|
||||
|
||||
// 6B
|
||||
// The elementary stream clock reference is a 42-bit field coded in two parts. The first
|
||||
|
|
@ -888,8 +888,8 @@ public:
|
|||
// 1bit const '1'
|
||||
// 9bits ESCR_extension
|
||||
// 1bit const '1'
|
||||
int64_t ESCR_base; // 33bits
|
||||
int16_t ESCR_extension; // 9bits
|
||||
int64_t ESCR_base_; // 33bits
|
||||
int16_t ESCR_extension_; // 9bits
|
||||
|
||||
// 3B
|
||||
// The ES_rate field is a 22-bit unsigned integer specifying the rate at which the
|
||||
|
|
@ -901,56 +901,56 @@ public:
|
|||
// 1bit const '1'
|
||||
// 22bits ES_rate
|
||||
// 1bit const '1'
|
||||
int32_t ES_rate; // 22bits
|
||||
int32_t ES_rate_; // 22bits
|
||||
|
||||
// 1B
|
||||
// A 3-bit field that indicates which trick mode is applied to the associated video stream. In cases of
|
||||
// other types of elementary streams, the meanings of this field and those defined by the following five bits are undefined.
|
||||
// For the definition of trick_mode status, refer to the trick mode section of 2.4.2.3.
|
||||
int8_t trick_mode_control; // 3bits
|
||||
int8_t trick_mode_value; // 5bits
|
||||
int8_t trick_mode_control_; // 3bits
|
||||
int8_t trick_mode_value_; // 5bits
|
||||
|
||||
// 1B
|
||||
// 1bit const '1'
|
||||
// This 7-bit field contains private data relating to copyright information.
|
||||
int8_t additional_copy_info; // 7bits
|
||||
int8_t additional_copy_info_; // 7bits
|
||||
|
||||
// 2B
|
||||
// The previous_PES_packet_CRC is a 16-bit field that contains the CRC value that yields
|
||||
// a zero output of the 16 registers in the decoder similar to the one defined in Annex A,
|
||||
int16_t previous_PES_packet_CRC; // 16bits
|
||||
int16_t previous_PES_packet_CRC_; // 16bits
|
||||
|
||||
// 1B
|
||||
// A 1-bit flag which when set to '1' indicates that the PES packet header contains private data.
|
||||
// When set to a value of '0' it indicates that private data is not present in the PES header.
|
||||
int8_t PES_private_data_flag; // 1bit
|
||||
int8_t PES_private_data_flag_; // 1bit
|
||||
// A 1-bit flag which when set to '1' indicates that an ISO/IEC 11172-1 pack header or a
|
||||
// Program Stream pack header is stored in this PES packet header. If this field is in a PES packet that is contained in a
|
||||
// Program Stream, then this field shall be set to '0'. In a Transport Stream, when set to the value '0' it indicates that no pack
|
||||
// header is present in the PES header.
|
||||
int8_t pack_header_field_flag; // 1bit
|
||||
int8_t pack_header_field_flag_; // 1bit
|
||||
// A 1-bit flag which when set to '1' indicates that the
|
||||
// program_packet_sequence_counter, MPEG1_MPEG2_identifier, and original_stuff_length fields are present in this
|
||||
// PES packet. When set to a value of '0' it indicates that these fields are not present in the PES header.
|
||||
int8_t program_packet_sequence_counter_flag; // 1bit
|
||||
int8_t program_packet_sequence_counter_flag_; // 1bit
|
||||
// A 1-bit flag which when set to '1' indicates that the P-STD_buffer_scale and P-STD_buffer_size
|
||||
// are present in the PES packet header. When set to a value of '0' it indicates that these fields are not present in the
|
||||
// PES header.
|
||||
int8_t P_STD_buffer_flag; // 1bit
|
||||
int8_t P_STD_buffer_flag_; // 1bit
|
||||
// reverved value, must be '1'
|
||||
int8_t const1_value0; // 3bits
|
||||
int8_t const1_value0_; // 3bits
|
||||
// A 1-bit field which when set to '1' indicates the presence of the PES_extension_field_length
|
||||
// field and associated fields. When set to a value of '0' this indicates that the PES_extension_field_length field and any
|
||||
// associated fields are not present.
|
||||
int8_t PES_extension_flag_2; // 1bit
|
||||
int8_t PES_extension_flag_2_; // 1bit
|
||||
|
||||
// 16B
|
||||
// This is a 16-byte field which contains private data. This data, combined with the fields before and
|
||||
// after, shall not emulate the packet_start_code_prefix (0x000001).
|
||||
std::vector<char> PES_private_data; // 128bits
|
||||
std::vector<char> PES_private_data_; // 128bits
|
||||
|
||||
// (1+x)B
|
||||
std::vector<char> pack_field; //[pack_field_length] bytes
|
||||
std::vector<char> pack_field_; //[pack_field_length] bytes
|
||||
|
||||
// 2B
|
||||
// 1bit const '1'
|
||||
|
|
@ -961,14 +961,14 @@ public:
|
|||
// Stream or the original packet sequence of the original ISO/IEC 11172-1 stream. The counter will wrap around to 0 after
|
||||
// its maximum value. Repetition of PES packets shall not occur. Consequently, no two consecutive PES packets in the
|
||||
// program multiplex shall have identical program_packet_sequence_counter values.
|
||||
int8_t program_packet_sequence_counter; // 7bits
|
||||
int8_t program_packet_sequence_counter_; // 7bits
|
||||
// 1bit const '1'
|
||||
// A 1-bit flag which when set to '1' indicates that this PES packet carries information from
|
||||
// an ISO/IEC 11172-1 stream. When set to '0' it indicates that this PES packet carries information from a Program Stream.
|
||||
int8_t MPEG1_MPEG2_identifier; // 1bit
|
||||
int8_t MPEG1_MPEG2_identifier_; // 1bit
|
||||
// This 6-bit field specifies the number of stuffing bytes used in the original ITU-T
|
||||
// Rec. H.222.0 | ISO/IEC 13818-1 PES packet header or in the original ISO/IEC 11172-1 packet header.
|
||||
int8_t original_stuff_length; // 6bits
|
||||
int8_t original_stuff_length_; // 6bits
|
||||
|
||||
// 2B
|
||||
// 2bits const '01'
|
||||
|
|
@ -977,22 +977,22 @@ public:
|
|||
// If the preceding stream_id indicates an audio stream, P-STD_buffer_scale shall have the value '0'. If the preceding
|
||||
// stream_id indicates a video stream, P-STD_buffer_scale shall have the value '1'. For all other stream types, the value
|
||||
// may be either '1' or '0'.
|
||||
int8_t P_STD_buffer_scale; // 1bit
|
||||
int8_t P_STD_buffer_scale_; // 1bit
|
||||
// The P-STD_buffer_size is a 13-bit unsigned integer, the meaning of which is only defined if this
|
||||
// PES packet is contained in a Program Stream. It defines the size of the input buffer, BS n , in the P-STD. If
|
||||
// P-STD_buffer_scale has the value '0', then the P-STD_buffer_size measures the buffer size in units of 128 bytes. If
|
||||
// P-STD_buffer_scale has the value '1', then the P-STD_buffer_size measures the buffer size in units of 1024 bytes.
|
||||
int16_t P_STD_buffer_size; // 13bits
|
||||
int16_t P_STD_buffer_size_; // 13bits
|
||||
|
||||
// (1+x)B
|
||||
// 1bit const '1'
|
||||
std::vector<char> PES_extension_field; //[PES_extension_field_length] bytes
|
||||
std::vector<char> PES_extension_field_; //[PES_extension_field_length] bytes
|
||||
|
||||
// NB
|
||||
// This is a fixed 8-bit value equal to '1111 1111' that can be inserted by the encoder, for example to meet
|
||||
// the requirements of the channel. It is discarded by the decoder. No more than 32 stuffing bytes shall be present in one
|
||||
// PES packet header.
|
||||
int nb_stuffings;
|
||||
int nb_stuffings_;
|
||||
|
||||
// NB
|
||||
// PES_packet_data_bytes shall be contiguous bytes of data from the elementary stream
|
||||
|
|
@ -1005,11 +1005,11 @@ public:
|
|||
//
|
||||
// In the case of a private_stream_1, private_stream_2, ECM_stream, or EMM_stream, the contents of the
|
||||
// PES_packet_data_byte field are user definable and will not be specified by ITU-T | ISO/IEC in the future.
|
||||
int nb_bytes;
|
||||
int nb_bytes_;
|
||||
|
||||
// NB
|
||||
// This is a fixed 8-bit value equal to '1111 1111'. It is discarded by the decoder.
|
||||
int nb_paddings;
|
||||
int nb_paddings_;
|
||||
|
||||
public:
|
||||
// Whether contains payload to dump to message.
|
||||
|
|
@ -1037,7 +1037,7 @@ private:
|
|||
class SrsTsPayloadPES : public SrsTsPayload
|
||||
{
|
||||
public:
|
||||
SrsMpegPES pes;
|
||||
SrsMpegPES pes_;
|
||||
|
||||
public:
|
||||
SrsTsPayloadPES(SrsTsPacket *p);
|
||||
|
|
@ -1304,9 +1304,9 @@ private:
|
|||
SrsAudioCodecId acodec_;
|
||||
|
||||
private:
|
||||
SrsTsContext *context;
|
||||
ISrsStreamWriter *writer;
|
||||
std::string path;
|
||||
SrsTsContext *context_;
|
||||
ISrsStreamWriter *writer_;
|
||||
std::string path_;
|
||||
|
||||
public:
|
||||
SrsTsContextWriter(ISrsStreamWriter *w, SrsTsContext *c, SrsAudioCodecId ac, SrsVideoCodecId vc);
|
||||
|
|
@ -1358,8 +1358,8 @@ class SrsTsMessageCache
|
|||
{
|
||||
public:
|
||||
// The current ts message.
|
||||
SrsTsMessage *audio;
|
||||
SrsTsMessage *video;
|
||||
SrsTsMessage *audio_;
|
||||
SrsTsMessage *video_;
|
||||
|
||||
public:
|
||||
SrsTsMessageCache();
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ srs_error_t SrsRtmpFormat::on_audio(SrsMediaPacket *shared_audio)
|
|||
char *data = msg->payload();
|
||||
int size = msg->size();
|
||||
|
||||
return SrsFormat::on_audio(msg->timestamp, data, size);
|
||||
return SrsFormat::on_audio(msg->timestamp_, data, size);
|
||||
}
|
||||
|
||||
srs_error_t SrsRtmpFormat::on_audio(int64_t timestamp, char *data, int size)
|
||||
|
|
@ -47,7 +47,7 @@ srs_error_t SrsRtmpFormat::on_video(SrsMediaPacket *shared_video)
|
|||
char *data = msg->payload();
|
||||
int size = msg->size();
|
||||
|
||||
return SrsFormat::on_video(msg->timestamp, data, size);
|
||||
return SrsFormat::on_video(msg->timestamp_, data, size);
|
||||
}
|
||||
|
||||
srs_error_t SrsRtmpFormat::on_video(int64_t timestamp, char *data, int size)
|
||||
|
|
|
|||
|
|
@ -23,33 +23,33 @@ void SrsKbpsSlice::sample()
|
|||
{
|
||||
srs_utime_t now = clk->now();
|
||||
|
||||
if (sample_30s.time < 0) {
|
||||
if (sample_30s.time_ < 0) {
|
||||
sample_30s.update(bytes, now, 0);
|
||||
}
|
||||
if (sample_1m.time < 0) {
|
||||
if (sample_1m.time_ < 0) {
|
||||
sample_1m.update(bytes, now, 0);
|
||||
}
|
||||
if (sample_5m.time < 0) {
|
||||
if (sample_5m.time_ < 0) {
|
||||
sample_5m.update(bytes, now, 0);
|
||||
}
|
||||
if (sample_60m.time < 0) {
|
||||
if (sample_60m.time_ < 0) {
|
||||
sample_60m.update(bytes, now, 0);
|
||||
}
|
||||
|
||||
if (now - sample_30s.time >= 30 * SRS_UTIME_SECONDS) {
|
||||
int kbps = (int)((bytes - sample_30s.total) * 8 / srsu2ms(now - sample_30s.time));
|
||||
if (now - sample_30s.time_ >= 30 * SRS_UTIME_SECONDS) {
|
||||
int kbps = (int)((bytes - sample_30s.total_) * 8 / srsu2ms(now - sample_30s.time_));
|
||||
sample_30s.update(bytes, now, kbps);
|
||||
}
|
||||
if (now - sample_1m.time >= 60 * SRS_UTIME_SECONDS) {
|
||||
int kbps = (int)((bytes - sample_1m.total) * 8 / srsu2ms(now - sample_1m.time));
|
||||
if (now - sample_1m.time_ >= 60 * SRS_UTIME_SECONDS) {
|
||||
int kbps = (int)((bytes - sample_1m.total_) * 8 / srsu2ms(now - sample_1m.time_));
|
||||
sample_1m.update(bytes, now, kbps);
|
||||
}
|
||||
if (now - sample_5m.time >= 300 * SRS_UTIME_SECONDS) {
|
||||
int kbps = (int)((bytes - sample_5m.total) * 8 / srsu2ms(now - sample_5m.time));
|
||||
if (now - sample_5m.time_ >= 300 * SRS_UTIME_SECONDS) {
|
||||
int kbps = (int)((bytes - sample_5m.total_) * 8 / srsu2ms(now - sample_5m.time_));
|
||||
sample_5m.update(bytes, now, kbps);
|
||||
}
|
||||
if (now - sample_60m.time >= 3600 * SRS_UTIME_SECONDS) {
|
||||
int kbps = (int)((bytes - sample_60m.total) * 8 / srsu2ms(now - sample_60m.time));
|
||||
if (now - sample_60m.time_ >= 3600 * SRS_UTIME_SECONDS) {
|
||||
int kbps = (int)((bytes - sample_60m.total_) * 8 / srsu2ms(now - sample_60m.time_));
|
||||
sample_60m.update(bytes, now, kbps);
|
||||
}
|
||||
}
|
||||
|
|
@ -171,22 +171,22 @@ int SrsKbps::get_recv_kbps()
|
|||
|
||||
int SrsKbps::get_send_kbps_30s()
|
||||
{
|
||||
return os->sample_30s.rate;
|
||||
return os->sample_30s.rate_;
|
||||
}
|
||||
|
||||
int SrsKbps::get_recv_kbps_30s()
|
||||
{
|
||||
return is->sample_30s.rate;
|
||||
return is->sample_30s.rate_;
|
||||
}
|
||||
|
||||
int SrsKbps::get_send_kbps_5m()
|
||||
{
|
||||
return os->sample_5m.rate;
|
||||
return os->sample_5m.rate_;
|
||||
}
|
||||
|
||||
int SrsKbps::get_recv_kbps_5m()
|
||||
{
|
||||
return is->sample_5m.rate;
|
||||
return is->sample_5m.rate_;
|
||||
}
|
||||
|
||||
void SrsKbps::add_delta(ISrsKbpsDelta *delta)
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ void _srs_context_destructor(void *arg)
|
|||
|
||||
const SrsContextId &SrsThreadContext::get_id()
|
||||
{
|
||||
++_srs_pps_cids_get->sugar;
|
||||
++_srs_pps_cids_get->sugar_;
|
||||
|
||||
if (!srs_thread_self()) {
|
||||
return _srs_context_default;
|
||||
|
|
@ -72,7 +72,7 @@ void SrsThreadContext::clear_cid()
|
|||
|
||||
const SrsContextId &srs_context_set_cid_of(srs_thread_t trd, const SrsContextId &v)
|
||||
{
|
||||
++_srs_pps_cids_set->sugar;
|
||||
++_srs_pps_cids_set->sugar_;
|
||||
|
||||
if (!trd) {
|
||||
_srs_context_default = v;
|
||||
|
|
|
|||
|
|
@ -435,7 +435,7 @@ srs_error_t SrsRawHEVCStream::mux_sequence_header(std::string vps, std::string s
|
|||
return srs_error_wrap(err, "format failed");
|
||||
}
|
||||
// hevc_dec_conf_record
|
||||
SrsHevcDecoderConfigurationRecord *hevc_info = &format.vcodec->hevc_dec_conf_record_;
|
||||
SrsHevcDecoderConfigurationRecord *hevc_info = &format.vcodec_->hevc_dec_conf_record_;
|
||||
|
||||
if (true) {
|
||||
// H265 VPS (video_parameter_set_rbsp()) NAL Unit.
|
||||
|
|
@ -460,31 +460,31 @@ srs_error_t SrsRawHEVCStream::mux_sequence_header(std::string vps, std::string s
|
|||
|
||||
uint8_t temp8bits = 0;
|
||||
// general_profile_space(2bits), general_tier_flag(1bit), general_profile_idc(5bits)
|
||||
temp8bits |= ((hevc_info->general_profile_space & 0x03) << 6);
|
||||
temp8bits |= ((hevc_info->general_tier_flag & 0x01) << 5);
|
||||
temp8bits |= (hevc_info->general_profile_idc & 0x1f);
|
||||
temp8bits |= ((hevc_info->general_profile_space_ & 0x03) << 6);
|
||||
temp8bits |= ((hevc_info->general_tier_flag_ & 0x01) << 5);
|
||||
temp8bits |= (hevc_info->general_profile_idc_ & 0x1f);
|
||||
stream.write_1bytes(temp8bits);
|
||||
|
||||
stream.write_4bytes(hevc_info->general_profile_compatibility_flags);
|
||||
stream.write_2bytes((hevc_info->general_constraint_indicator_flags >> 32) & 0xffff);
|
||||
stream.write_4bytes(hevc_info->general_constraint_indicator_flags & 0xffffffff);
|
||||
stream.write_1bytes(hevc_info->general_level_idc);
|
||||
stream.write_2bytes(0xf000 | (hevc_info->min_spatial_segmentation_idc & 0x0fff));
|
||||
stream.write_1bytes(0xfc | (hevc_info->parallelism_type & 0x03));
|
||||
stream.write_1bytes(0xfc | (hevc_info->chroma_format & 0x03));
|
||||
stream.write_1bytes(0xf8 | (hevc_info->bit_depth_luma_minus8 & 0x07));
|
||||
stream.write_1bytes(0xf8 | (hevc_info->bit_depth_chroma_minus8 & 0x07));
|
||||
stream.write_2bytes(hevc_info->avg_frame_rate);
|
||||
stream.write_4bytes(hevc_info->general_profile_compatibility_flags_);
|
||||
stream.write_2bytes((hevc_info->general_constraint_indicator_flags_ >> 32) & 0xffff);
|
||||
stream.write_4bytes(hevc_info->general_constraint_indicator_flags_ & 0xffffffff);
|
||||
stream.write_1bytes(hevc_info->general_level_idc_);
|
||||
stream.write_2bytes(0xf000 | (hevc_info->min_spatial_segmentation_idc_ & 0x0fff));
|
||||
stream.write_1bytes(0xfc | (hevc_info->parallelism_type_ & 0x03));
|
||||
stream.write_1bytes(0xfc | (hevc_info->chroma_format_ & 0x03));
|
||||
stream.write_1bytes(0xf8 | (hevc_info->bit_depth_luma_minus8_ & 0x07));
|
||||
stream.write_1bytes(0xf8 | (hevc_info->bit_depth_chroma_minus8_ & 0x07));
|
||||
stream.write_2bytes(hevc_info->avg_frame_rate_);
|
||||
|
||||
hevc_info->length_size_minus_one = 3;
|
||||
hevc_info->length_size_minus_one_ = 3;
|
||||
temp8bits = 0;
|
||||
|
||||
// 8bits: constant_frame_rate(2bits), num_temporal_layers(3bits),
|
||||
// temporal_id_nested(1bit), length_size_minus_one(2bits)
|
||||
temp8bits |= (hevc_info->constant_frame_rate << 6) | 0xc0;
|
||||
temp8bits |= (hevc_info->num_temporal_layers << 3) | 0x38;
|
||||
temp8bits |= (hevc_info->temporal_id_nested << 2) | 0x04;
|
||||
temp8bits |= (hevc_info->length_size_minus_one & 0x03);
|
||||
temp8bits |= (hevc_info->constant_frame_rate_ << 6) | 0xc0;
|
||||
temp8bits |= (hevc_info->num_temporal_layers_ << 3) | 0x38;
|
||||
temp8bits |= (hevc_info->temporal_id_nested_ << 2) | 0x04;
|
||||
temp8bits |= (hevc_info->length_size_minus_one_ & 0x03);
|
||||
stream.write_1bytes(temp8bits);
|
||||
|
||||
// numOfArrays, default 3
|
||||
|
|
|
|||
|
|
@ -105,9 +105,9 @@ srs_error_t SrsRtmpCommand::to_msg(SrsRtmpCommonMessage *msg, int stream_id)
|
|||
|
||||
// to message
|
||||
SrsMessageHeader header;
|
||||
header.payload_length = size;
|
||||
header.message_type = get_message_type();
|
||||
header.stream_id = stream_id;
|
||||
header.payload_length_ = size;
|
||||
header.message_type_ = get_message_type();
|
||||
header.stream_id_ = stream_id;
|
||||
|
||||
if ((err = msg->create(&header, payload, size)) != srs_success) {
|
||||
return srs_error_wrap(err, "create %dB message", size);
|
||||
|
|
@ -331,10 +331,10 @@ srs_error_t SrsProtocol::recv_message(SrsRtmpCommonMessage **pmsg)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (msg->size() <= 0 || msg->header.payload_length <= 0) {
|
||||
if (msg->size() <= 0 || msg->header_.payload_length_ <= 0) {
|
||||
srs_trace("ignore empty message(type=%d, size=%d, time=%" PRId64 ", sid=%d).",
|
||||
msg->header.message_type, msg->header.payload_length,
|
||||
msg->header.timestamp, msg->header.stream_id);
|
||||
msg->header_.message_type_, msg->header_.payload_length_,
|
||||
msg->header_.timestamp_, msg->header_.stream_id_);
|
||||
srs_freep(msg);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -365,7 +365,7 @@ srs_error_t SrsProtocol::decode_message(SrsRtmpCommonMessage *msg, SrsRtmpComman
|
|||
|
||||
// decode the packet.
|
||||
SrsRtmpCommand *packet = NULL;
|
||||
if ((err = do_decode_message(msg->header, &stream, &packet)) != srs_success) {
|
||||
if ((err = do_decode_message(msg->header_, &stream, &packet)) != srs_success) {
|
||||
srs_freep(packet);
|
||||
return srs_error_wrap(err, "decode message");
|
||||
}
|
||||
|
|
@ -561,7 +561,7 @@ srs_error_t SrsProtocol::do_send_and_free_packet(SrsRtmpCommand *packet_raw, int
|
|||
return srs_error_wrap(err, "send packet");
|
||||
}
|
||||
|
||||
if ((err = on_send_packet(&msg->header, packet.get())) != srs_success) {
|
||||
if ((err = on_send_packet(&msg->header_, packet.get())) != srs_success) {
|
||||
return srs_error_wrap(err, "on send packet");
|
||||
}
|
||||
|
||||
|
|
@ -695,7 +695,7 @@ srs_error_t SrsProtocol::do_decode_message(SrsMessageHeader &header, SrsBuffer *
|
|||
return packet->decode(stream);
|
||||
} else {
|
||||
if (!header.is_set_peer_bandwidth() && !header.is_ackledgement()) {
|
||||
srs_trace("drop unknown message, type=%d", header.message_type);
|
||||
srs_trace("drop unknown message, type=%d", header.message_type_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -996,7 +996,7 @@ srs_error_t SrsProtocol::read_message_header(SrsChunkStream *chunk, char fmt)
|
|||
if (fmt <= RTMP_FMT_TYPE2) {
|
||||
char *p = in_buffer->read_slice(mh_size);
|
||||
|
||||
char *pp = (char *)&chunk->header.timestamp_delta;
|
||||
char *pp = (char *)&chunk->header.timestamp_delta_;
|
||||
pp[2] = *p++;
|
||||
pp[1] = *p++;
|
||||
pp[0] = *p++;
|
||||
|
|
@ -1015,7 +1015,7 @@ srs_error_t SrsProtocol::read_message_header(SrsChunkStream *chunk, char fmt)
|
|||
// 0x00ffffff), this value MUST be 16777215, and the 'extended
|
||||
// timestamp header' MUST be present. Otherwise, this value SHOULD be
|
||||
// the entire delta.
|
||||
chunk->has_extended_timestamp = (chunk->header.timestamp_delta >= RTMP_EXTENDED_TIMESTAMP);
|
||||
chunk->has_extended_timestamp = (chunk->header.timestamp_delta_ >= RTMP_EXTENDED_TIMESTAMP);
|
||||
|
||||
if (fmt <= RTMP_FMT_TYPE1) {
|
||||
int32_t payload_length = 0;
|
||||
|
|
@ -1029,15 +1029,15 @@ srs_error_t SrsProtocol::read_message_header(SrsChunkStream *chunk, char fmt)
|
|||
// always use the actual msg size to compare, for the cache payload length can changed,
|
||||
// for the fmt type1(stream_id not changed), user can change the payload
|
||||
// length(it's not allowed in the continue chunks).
|
||||
if (!is_first_chunk_of_msg && chunk->header.payload_length != payload_length) {
|
||||
return srs_error_new(ERROR_RTMP_PACKET_SIZE, "msg in chunk cache, size=%d cannot change to %d", chunk->header.payload_length, payload_length);
|
||||
if (!is_first_chunk_of_msg && chunk->header.payload_length_ != payload_length) {
|
||||
return srs_error_new(ERROR_RTMP_PACKET_SIZE, "msg in chunk cache, size=%d cannot change to %d", chunk->header.payload_length_, payload_length);
|
||||
}
|
||||
|
||||
chunk->header.payload_length = payload_length;
|
||||
chunk->header.message_type = *p++;
|
||||
chunk->header.payload_length_ = payload_length;
|
||||
chunk->header.message_type_ = *p++;
|
||||
|
||||
if (fmt == RTMP_FMT_TYPE0) {
|
||||
pp = (char *)&chunk->header.stream_id;
|
||||
pp = (char *)&chunk->header.stream_id_;
|
||||
pp[0] = *p++;
|
||||
pp[1] = *p++;
|
||||
pp[2] = *p++;
|
||||
|
|
@ -1125,18 +1125,18 @@ srs_error_t SrsProtocol::read_message_header(SrsChunkStream *chunk, char fmt)
|
|||
// 0x00ffffff), this value MUST be 16777215, and the 'extended
|
||||
// timestamp header' MUST be present. Otherwise, this value SHOULD be
|
||||
// the entire delta.
|
||||
uint32_t timestamp = chunk->has_extended_timestamp ? chunk->extended_timestamp : chunk->header.timestamp_delta;
|
||||
uint32_t timestamp = chunk->has_extended_timestamp ? chunk->extended_timestamp : chunk->header.timestamp_delta_;
|
||||
if (fmt == RTMP_FMT_TYPE0) {
|
||||
// 6.1.2.1. Type 0
|
||||
// For a type-0 chunk, the absolute timestamp of the message is sent
|
||||
// here.
|
||||
chunk->header.timestamp = timestamp;
|
||||
chunk->header.timestamp_ = timestamp;
|
||||
} else if (is_first_chunk_of_msg) {
|
||||
// 6.1.2.2. Type 1
|
||||
// 6.1.2.3. Type 2
|
||||
// For a type-1 or type-2 chunk, the difference between the previous
|
||||
// chunk's timestamp and the current chunk's timestamp is sent here.
|
||||
chunk->header.timestamp += timestamp;
|
||||
chunk->header.timestamp_ += timestamp;
|
||||
}
|
||||
|
||||
// the extended-timestamp must be unsigned-int,
|
||||
|
|
@ -1159,14 +1159,14 @@ srs_error_t SrsProtocol::read_message_header(SrsChunkStream *chunk, char fmt)
|
|||
// milliseconds.
|
||||
// in a word, 31bits timestamp is ok.
|
||||
// convert extended timestamp to 31bits.
|
||||
chunk->header.timestamp &= 0x7fffffff;
|
||||
chunk->header.timestamp_ &= 0x7fffffff;
|
||||
|
||||
// valid message, the payload_length is 24bits,
|
||||
// so it should never be negative.
|
||||
srs_assert(chunk->header.payload_length >= 0);
|
||||
srs_assert(chunk->header.payload_length_ >= 0);
|
||||
|
||||
// copy header to msg
|
||||
chunk->msg->header = chunk->header;
|
||||
chunk->msg->header_ = chunk->header;
|
||||
|
||||
// increase the msg count, the chunk stream can accept fmt=1/2/3 message now.
|
||||
chunk->msg_count++;
|
||||
|
|
@ -1179,9 +1179,9 @@ srs_error_t SrsProtocol::read_message_payload(SrsChunkStream *chunk, SrsRtmpComm
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
// empty message
|
||||
if (chunk->header.payload_length <= 0) {
|
||||
srs_trace("get an empty RTMP message(type=%d, size=%d, time=%" PRId64 ", sid=%d)", chunk->header.message_type,
|
||||
chunk->header.payload_length, chunk->header.timestamp, chunk->header.stream_id);
|
||||
if (chunk->header.payload_length_ <= 0) {
|
||||
srs_trace("get an empty RTMP message(type=%d, size=%d, time=%" PRId64 ", sid=%d)", chunk->header.message_type_,
|
||||
chunk->header.payload_length_, chunk->header.timestamp_, chunk->header.stream_id_);
|
||||
|
||||
*pmsg = chunk->msg;
|
||||
|
||||
|
|
@ -1190,16 +1190,16 @@ srs_error_t SrsProtocol::read_message_payload(SrsChunkStream *chunk, SrsRtmpComm
|
|||
|
||||
return err;
|
||||
}
|
||||
srs_assert(chunk->header.payload_length > 0);
|
||||
srs_assert(chunk->header.payload_length_ > 0);
|
||||
|
||||
// the chunk payload size.
|
||||
int nn_written = (int)(chunk->writing_pos_ - chunk->msg->payload());
|
||||
int payload_size = chunk->header.payload_length - nn_written; // Left bytes to read.
|
||||
payload_size = srs_min(payload_size, in_chunk_size); // Restrict to chunk size.
|
||||
int payload_size = chunk->header.payload_length_ - nn_written; // Left bytes to read.
|
||||
payload_size = srs_min(payload_size, in_chunk_size); // Restrict to chunk size.
|
||||
|
||||
// create msg payload if not initialized
|
||||
if (!chunk->msg->payload()) {
|
||||
chunk->msg->create_payload(chunk->header.payload_length);
|
||||
chunk->msg->create_payload(chunk->header.payload_length_);
|
||||
chunk->writing_pos_ = chunk->msg->payload();
|
||||
}
|
||||
|
||||
|
|
@ -1212,7 +1212,7 @@ srs_error_t SrsProtocol::read_message_payload(SrsChunkStream *chunk, SrsRtmpComm
|
|||
|
||||
// got entire RTMP message?
|
||||
nn_written = (int)(chunk->writing_pos_ - chunk->msg->payload());
|
||||
if (nn_written == chunk->header.payload_length) {
|
||||
if (nn_written == chunk->header.payload_length_) {
|
||||
*pmsg = chunk->msg;
|
||||
|
||||
chunk->msg = NULL;
|
||||
|
|
@ -1235,7 +1235,7 @@ srs_error_t SrsProtocol::on_recv_message(SrsRtmpCommonMessage *msg)
|
|||
}
|
||||
|
||||
SrsRtmpCommand *packet_raw = NULL;
|
||||
switch (msg->header.message_type) {
|
||||
switch (msg->header_.message_type_) {
|
||||
case RTMP_MSG_SetChunkSize:
|
||||
case RTMP_MSG_UserControlMessage:
|
||||
case RTMP_MSG_WindowAcknowledgementSize:
|
||||
|
|
@ -1254,7 +1254,7 @@ srs_error_t SrsProtocol::on_recv_message(SrsRtmpCommonMessage *msg)
|
|||
srs_assert(packet_raw);
|
||||
SrsUniquePtr<SrsRtmpCommand> packet(packet_raw);
|
||||
|
||||
switch (msg->header.message_type) {
|
||||
switch (msg->header_.message_type_) {
|
||||
case RTMP_MSG_WindowAcknowledgementSize: {
|
||||
SrsSetWindowAckSizePacket *pkt = dynamic_cast<SrsSetWindowAckSizePacket *>(packet.get());
|
||||
srs_assert(pkt != NULL);
|
||||
|
|
@ -1317,7 +1317,7 @@ srs_error_t SrsProtocol::on_send_packet(SrsMessageHeader *mh, SrsRtmpCommand *pa
|
|||
return err;
|
||||
}
|
||||
|
||||
switch (mh->message_type) {
|
||||
switch (mh->message_type_) {
|
||||
case RTMP_MSG_SetChunkSize: {
|
||||
SrsSetChunkSizePacket *pkt = dynamic_cast<SrsSetChunkSizePacket *>(packet);
|
||||
out_chunk_size = pkt->chunk_size;
|
||||
|
|
@ -2469,14 +2469,14 @@ srs_error_t SrsRtmpServer::identify_client(int stream_id, SrsRtmpConnType &type,
|
|||
}
|
||||
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
SrsMessageHeader &h = msg->header;
|
||||
SrsMessageHeader &h = msg->header_;
|
||||
|
||||
if (h.is_ackledgement() || h.is_set_chunk_size() || h.is_window_ackledgement_size() || h.is_user_control_message()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!h.is_amf0_command() && !h.is_amf3_command()) {
|
||||
srs_trace("ignore message type=%#x", h.message_type);
|
||||
srs_trace("ignore message type=%#x", h.message_type_);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -2860,14 +2860,14 @@ srs_error_t SrsRtmpServer::identify_create_stream_client(SrsCreateStreamPacket *
|
|||
}
|
||||
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
SrsMessageHeader &h = msg->header;
|
||||
SrsMessageHeader &h = msg->header_;
|
||||
|
||||
if (h.is_ackledgement() || h.is_set_chunk_size() || h.is_window_ackledgement_size() || h.is_user_control_message()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!h.is_amf0_command() && !h.is_amf3_command()) {
|
||||
srs_trace("ignore message type=%#x", h.message_type);
|
||||
srs_trace("ignore message type=%#x", h.message_type_);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,42 +41,42 @@ srs_error_t SrsRtpVideoBuilder::package_stap_a(SrsMediaPacket *msg, SrsRtpPacket
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
SrsFormat *format = format_;
|
||||
if (!format || !format->vcodec) {
|
||||
if (!format || !format->vcodec_) {
|
||||
return err;
|
||||
}
|
||||
|
||||
pkt->header.set_payload_type(video_payload_type_);
|
||||
pkt->header.set_ssrc(video_ssrc_);
|
||||
pkt->frame_type = SrsFrameTypeVideo;
|
||||
pkt->frame_type_ = SrsFrameTypeVideo;
|
||||
pkt->header.set_marker(false);
|
||||
pkt->header.set_sequence(video_sequence_++);
|
||||
pkt->header.set_timestamp(msg->timestamp * 90);
|
||||
pkt->header.set_timestamp(msg->timestamp_ * 90);
|
||||
|
||||
ISrsRtpPayloader *stap = NULL;
|
||||
vector<vector<char> *> params;
|
||||
int size = 0;
|
||||
|
||||
if (format->vcodec->id == SrsVideoCodecIdHEVC) {
|
||||
for (size_t i = 0; i < format->vcodec->hevc_dec_conf_record_.nalu_vec.size(); i++) {
|
||||
const SrsHevcHvccNalu &nalu = format->vcodec->hevc_dec_conf_record_.nalu_vec[i];
|
||||
if (nalu.nal_unit_type == SrsHevcNaluType_VPS || nalu.nal_unit_type == SrsHevcNaluType_SPS || nalu.nal_unit_type == SrsHevcNaluType_PPS) {
|
||||
const SrsHevcNalData &nal_data = nalu.nal_data_vec[0];
|
||||
params.push_back(&(vector<char> &)nal_data.nal_unit_data);
|
||||
size += nal_data.nal_unit_length;
|
||||
if (format->vcodec_->id_ == SrsVideoCodecIdHEVC) {
|
||||
for (size_t i = 0; i < format->vcodec_->hevc_dec_conf_record_.nalu_vec_.size(); i++) {
|
||||
const SrsHevcHvccNalu &nalu = format->vcodec_->hevc_dec_conf_record_.nalu_vec_[i];
|
||||
if (nalu.nal_unit_type_ == SrsHevcNaluType_VPS || nalu.nal_unit_type_ == SrsHevcNaluType_SPS || nalu.nal_unit_type_ == SrsHevcNaluType_PPS) {
|
||||
const SrsHevcNalData &nal_data = nalu.nal_data_vec_[0];
|
||||
params.push_back(&(vector<char> &)nal_data.nal_unit_data_);
|
||||
size += nal_data.nal_unit_length_;
|
||||
}
|
||||
}
|
||||
|
||||
stap = new SrsRtpSTAPPayloadHevc();
|
||||
pkt->set_payload(stap, SrsRtpPacketPayloadTypeSTAPHevc);
|
||||
pkt->nalu_type = kStapHevc;
|
||||
} else if (format->vcodec->id == SrsVideoCodecIdAVC) {
|
||||
params.push_back(&format->vcodec->sequenceParameterSetNALUnit);
|
||||
params.push_back(&format->vcodec->pictureParameterSetNALUnit);
|
||||
size = format->vcodec->sequenceParameterSetNALUnit.size() + format->vcodec->pictureParameterSetNALUnit.size();
|
||||
pkt->nalu_type_ = kStapHevc;
|
||||
} else if (format->vcodec_->id_ == SrsVideoCodecIdAVC) {
|
||||
params.push_back(&format->vcodec_->sequenceParameterSetNALUnit_);
|
||||
params.push_back(&format->vcodec_->pictureParameterSetNALUnit_);
|
||||
size = format->vcodec_->sequenceParameterSetNALUnit_.size() + format->vcodec_->pictureParameterSetNALUnit_.size();
|
||||
|
||||
stap = new SrsRtpSTAPPayload();
|
||||
pkt->set_payload(stap, SrsRtpPacketPayloadTypeSTAP);
|
||||
pkt->nalu_type = kStapA;
|
||||
pkt->nalu_type_ = kStapA;
|
||||
}
|
||||
|
||||
if (size == 0) {
|
||||
|
|
@ -87,12 +87,12 @@ srs_error_t SrsRtpVideoBuilder::package_stap_a(SrsMediaPacket *msg, SrsRtpPacket
|
|||
for (vector<vector<char> *>::iterator it = params.begin(); it != params.end(); ++it) {
|
||||
vector<char> *param = *it;
|
||||
SrsNaluSample *sample = new SrsNaluSample();
|
||||
sample->bytes = payload;
|
||||
sample->size = param->size();
|
||||
if (format->vcodec->id == SrsVideoCodecIdHEVC) {
|
||||
static_cast<SrsRtpSTAPPayloadHevc *>(stap)->nalus.push_back(sample);
|
||||
sample->bytes_ = payload;
|
||||
sample->size_ = param->size();
|
||||
if (format->vcodec_->id_ == SrsVideoCodecIdHEVC) {
|
||||
static_cast<SrsRtpSTAPPayloadHevc *>(stap)->nalus_.push_back(sample);
|
||||
} else {
|
||||
static_cast<SrsRtpSTAPPayload *>(stap)->nalus.push_back(sample);
|
||||
static_cast<SrsRtpSTAPPayload *>(stap)->nalus_.push_back(sample);
|
||||
}
|
||||
|
||||
memcpy(payload, (char *)param->data(), param->size());
|
||||
|
|
@ -107,10 +107,10 @@ srs_error_t SrsRtpVideoBuilder::package_nalus(SrsMediaPacket *msg, const vector<
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
SrsFormat *format = format_;
|
||||
if (!format || !format->vcodec) {
|
||||
if (!format || !format->vcodec_) {
|
||||
return err;
|
||||
}
|
||||
bool is_hevc = format->vcodec->id == SrsVideoCodecIdHEVC;
|
||||
bool is_hevc = format->vcodec_->id_ == SrsVideoCodecIdHEVC;
|
||||
|
||||
SrsRtpRawNALUs *raw_raw = new SrsRtpRawNALUs();
|
||||
uint8_t first_nalu_type = 0;
|
||||
|
|
@ -118,12 +118,12 @@ srs_error_t SrsRtpVideoBuilder::package_nalus(SrsMediaPacket *msg, const vector<
|
|||
for (int i = 0; i < (int)samples.size(); i++) {
|
||||
SrsNaluSample *sample = samples[i];
|
||||
|
||||
if (!sample->size) {
|
||||
if (!sample->size_) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (first_nalu_type == 0) {
|
||||
first_nalu_type = is_hevc ? uint8_t(SrsHevcNaluTypeParse(sample->bytes[0])) : uint8_t(SrsAvcNaluTypeParse(sample->bytes[0]));
|
||||
first_nalu_type = is_hevc ? uint8_t(SrsHevcNaluTypeParse(sample->bytes_[0])) : uint8_t(SrsAvcNaluTypeParse(sample->bytes_[0]));
|
||||
}
|
||||
|
||||
raw_raw->push_back(sample->copy());
|
||||
|
|
@ -143,10 +143,10 @@ srs_error_t SrsRtpVideoBuilder::package_nalus(SrsMediaPacket *msg, const vector<
|
|||
|
||||
pkt->header.set_payload_type(video_payload_type_);
|
||||
pkt->header.set_ssrc(video_ssrc_);
|
||||
pkt->frame_type = SrsFrameTypeVideo;
|
||||
pkt->nalu_type = first_nalu_type;
|
||||
pkt->frame_type_ = SrsFrameTypeVideo;
|
||||
pkt->nalu_type_ = first_nalu_type;
|
||||
pkt->header.set_sequence(video_sequence_++);
|
||||
pkt->header.set_timestamp(msg->timestamp * 90);
|
||||
pkt->header.set_timestamp(msg->timestamp_ * 90);
|
||||
pkt->set_payload(raw_raw, SrsRtpPacketPayloadTypeNALU);
|
||||
pkt->wrap(msg->payload_);
|
||||
} else {
|
||||
|
|
@ -173,31 +173,31 @@ srs_error_t SrsRtpVideoBuilder::package_nalus(SrsMediaPacket *msg, const vector<
|
|||
|
||||
pkt->header.set_payload_type(video_payload_type_);
|
||||
pkt->header.set_ssrc(video_ssrc_);
|
||||
pkt->frame_type = SrsFrameTypeVideo;
|
||||
pkt->nalu_type = kFuA;
|
||||
pkt->frame_type_ = SrsFrameTypeVideo;
|
||||
pkt->nalu_type_ = kFuA;
|
||||
pkt->header.set_sequence(video_sequence_++);
|
||||
pkt->header.set_timestamp(msg->timestamp * 90);
|
||||
pkt->header.set_timestamp(msg->timestamp_ * 90);
|
||||
|
||||
if (is_hevc) {
|
||||
SrsRtpFUAPayloadHevc *fua = new SrsRtpFUAPayloadHevc();
|
||||
if ((err = raw->read_samples(fua->nalus, packet_size)) != srs_success) {
|
||||
if ((err = raw->read_samples(fua->nalus_, packet_size)) != srs_success) {
|
||||
srs_freep(fua);
|
||||
return srs_error_wrap(err, "read hevc samples %d bytes, left %d, total %d", packet_size, nb_left, nn_bytes);
|
||||
}
|
||||
fua->nalu_type = SrsHevcNaluTypeParse(header);
|
||||
fua->start = bool(i == 0);
|
||||
fua->end = bool(i == num_of_packet - 1);
|
||||
fua->nalu_type_ = SrsHevcNaluTypeParse(header);
|
||||
fua->start_ = bool(i == 0);
|
||||
fua->end_ = bool(i == num_of_packet - 1);
|
||||
|
||||
pkt->set_payload(fua, SrsRtpPacketPayloadTypeFUAHevc);
|
||||
} else {
|
||||
SrsRtpFUAPayload *fua = new SrsRtpFUAPayload();
|
||||
if ((err = raw->read_samples(fua->nalus, packet_size)) != srs_success) {
|
||||
if ((err = raw->read_samples(fua->nalus_, packet_size)) != srs_success) {
|
||||
srs_freep(fua);
|
||||
return srs_error_wrap(err, "read samples %d bytes, left %d, total %d", packet_size, nb_left, nn_bytes);
|
||||
}
|
||||
fua->nalu_type = SrsAvcNaluTypeParse(header);
|
||||
fua->start = bool(i == 0);
|
||||
fua->end = bool(i == num_of_packet - 1);
|
||||
fua->nalu_type_ = SrsAvcNaluTypeParse(header);
|
||||
fua->start_ = bool(i == 0);
|
||||
fua->end_ = bool(i == num_of_packet - 1);
|
||||
|
||||
pkt->set_payload(fua, SrsRtpPacketPayloadTypeFUA);
|
||||
}
|
||||
|
|
@ -221,15 +221,15 @@ srs_error_t SrsRtpVideoBuilder::package_single_nalu(SrsMediaPacket *msg, SrsNalu
|
|||
|
||||
pkt->header.set_payload_type(video_payload_type_);
|
||||
pkt->header.set_ssrc(video_ssrc_);
|
||||
pkt->frame_type = SrsFrameTypeVideo;
|
||||
pkt->frame_type_ = SrsFrameTypeVideo;
|
||||
pkt->header.set_sequence(video_sequence_++);
|
||||
pkt->header.set_timestamp(msg->timestamp * 90);
|
||||
pkt->header.set_timestamp(msg->timestamp_ * 90);
|
||||
|
||||
SrsRtpRawPayload *raw = new SrsRtpRawPayload();
|
||||
pkt->set_payload(raw, SrsRtpPacketPayloadTypeRaw);
|
||||
|
||||
raw->payload = sample->bytes;
|
||||
raw->nn_payload = sample->size;
|
||||
raw->payload_ = sample->bytes_;
|
||||
raw->nn_payload_ = sample->size_;
|
||||
|
||||
pkt->wrap(msg->payload_);
|
||||
|
||||
|
|
@ -241,17 +241,17 @@ srs_error_t SrsRtpVideoBuilder::package_fu_a(SrsMediaPacket *msg, SrsNaluSample
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
SrsFormat *format = format_;
|
||||
if (!format || !format->vcodec) {
|
||||
if (!format || !format->vcodec_) {
|
||||
return err;
|
||||
}
|
||||
|
||||
bool is_hevc = format->vcodec->id == SrsVideoCodecIdHEVC;
|
||||
bool is_hevc = format->vcodec_->id_ == SrsVideoCodecIdHEVC;
|
||||
int header_size = is_hevc ? SrsHevcNaluHeaderSize : SrsAvcNaluHeaderSize;
|
||||
srs_assert(sample->size >= header_size);
|
||||
srs_assert(sample->size_ >= header_size);
|
||||
|
||||
char *p = sample->bytes + header_size;
|
||||
int nb_left = sample->size - header_size;
|
||||
uint8_t header = sample->bytes[0];
|
||||
char *p = sample->bytes_ + header_size;
|
||||
int nb_left = sample->size_ - header_size;
|
||||
uint8_t header = sample->bytes_[0];
|
||||
|
||||
int num_of_packet = 1 + (nb_left - 1) / fu_payload_size;
|
||||
for (int i = 0; i < num_of_packet; ++i) {
|
||||
|
|
@ -262,34 +262,34 @@ srs_error_t SrsRtpVideoBuilder::package_fu_a(SrsMediaPacket *msg, SrsNaluSample
|
|||
|
||||
pkt->header.set_payload_type(video_payload_type_);
|
||||
pkt->header.set_ssrc(video_ssrc_);
|
||||
pkt->frame_type = SrsFrameTypeVideo;
|
||||
pkt->frame_type_ = SrsFrameTypeVideo;
|
||||
pkt->header.set_sequence(video_sequence_++);
|
||||
pkt->header.set_timestamp(msg->timestamp * 90);
|
||||
pkt->nalu_type = is_hevc ? kFuHevc : kFuA;
|
||||
pkt->header.set_timestamp(msg->timestamp_ * 90);
|
||||
pkt->nalu_type_ = is_hevc ? kFuHevc : kFuA;
|
||||
|
||||
if (is_hevc) {
|
||||
// H265 FU-A header
|
||||
SrsRtpFUAPayloadHevc2 *fua = new SrsRtpFUAPayloadHevc2();
|
||||
pkt->set_payload(fua, SrsRtpPacketPayloadTypeFUAHevc2);
|
||||
|
||||
fua->nalu_type = SrsHevcNaluTypeParse(header);
|
||||
fua->start = bool(i == 0);
|
||||
fua->end = bool(i == num_of_packet - 1);
|
||||
fua->nalu_type_ = SrsHevcNaluTypeParse(header);
|
||||
fua->start_ = bool(i == 0);
|
||||
fua->end_ = bool(i == num_of_packet - 1);
|
||||
|
||||
fua->payload = p;
|
||||
fua->size = packet_size;
|
||||
fua->payload_ = p;
|
||||
fua->size_ = packet_size;
|
||||
} else {
|
||||
// H264 FU-A header
|
||||
SrsRtpFUAPayload2 *fua = new SrsRtpFUAPayload2();
|
||||
pkt->set_payload(fua, SrsRtpPacketPayloadTypeFUA2);
|
||||
|
||||
fua->nri = (SrsAvcNaluType)header;
|
||||
fua->nalu_type = SrsAvcNaluTypeParse(header);
|
||||
fua->start = bool(i == 0);
|
||||
fua->end = bool(i == num_of_packet - 1);
|
||||
fua->nri_ = (SrsAvcNaluType)header;
|
||||
fua->nalu_type_ = SrsAvcNaluTypeParse(header);
|
||||
fua->start_ = bool(i == 0);
|
||||
fua->end_ = bool(i == num_of_packet - 1);
|
||||
|
||||
fua->payload = p;
|
||||
fua->size = packet_size;
|
||||
fua->payload_ = p;
|
||||
fua->size_ = packet_size;
|
||||
}
|
||||
|
||||
pkt->wrap(msg->payload_);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class MockSrsMediaPacket : public SrsMediaPacket
|
|||
public:
|
||||
MockSrsMediaPacket(bool is_video_msg, uint32_t ts)
|
||||
{
|
||||
timestamp = ts;
|
||||
timestamp_ = ts;
|
||||
|
||||
// Create sample payload
|
||||
char *payload = new char[1024];
|
||||
|
|
@ -67,9 +67,9 @@ public:
|
|||
SrsMediaPacket::wrap(payload, 1024);
|
||||
|
||||
if (is_video_msg) {
|
||||
message_type = SrsFrameTypeVideo;
|
||||
message_type_ = SrsFrameTypeVideo;
|
||||
} else {
|
||||
message_type = SrsFrameTypeAudio;
|
||||
message_type_ = SrsFrameTypeAudio;
|
||||
}
|
||||
}
|
||||
virtual ~MockSrsMediaPacket() {}
|
||||
|
|
@ -411,17 +411,17 @@ VOID TEST(Fmp4Test, SrsMp4TrackEncryptionBox_CBCS)
|
|||
SrsMp4TrackEncryptionBox tenc;
|
||||
|
||||
// Configure for CBCS video encryption (1:9 pattern)
|
||||
tenc.version = 1;
|
||||
tenc.default_crypt_byte_block = 1; // Encrypt 1 block
|
||||
tenc.default_skip_byte_block = 9; // Skip 9 blocks
|
||||
tenc.default_is_protected = 1;
|
||||
tenc.default_per_sample_IV_size = 0; // Use constant IV
|
||||
tenc.default_constant_IV_size = 16;
|
||||
tenc.version_ = 1;
|
||||
tenc.default_crypt_byte_block_ = 1; // Encrypt 1 block
|
||||
tenc.default_skip_byte_block_ = 9; // Skip 9 blocks
|
||||
tenc.default_is_protected_ = 1;
|
||||
tenc.default_per_sample_IV_size_ = 0; // Use constant IV
|
||||
tenc.default_constant_IV_size_ = 16;
|
||||
|
||||
// Set Key ID
|
||||
unsigned char kid[16] = {0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
|
||||
0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70};
|
||||
memcpy(tenc.default_KID, kid, 16);
|
||||
memcpy(tenc.default_KID_, kid, 16);
|
||||
|
||||
// Set constant IV
|
||||
unsigned char iv[16] = {0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
|
||||
|
|
@ -429,16 +429,16 @@ VOID TEST(Fmp4Test, SrsMp4TrackEncryptionBox_CBCS)
|
|||
tenc.set_default_constant_IV(iv, 16);
|
||||
|
||||
// Verify configuration
|
||||
EXPECT_EQ(1, tenc.version);
|
||||
EXPECT_EQ(1, tenc.default_crypt_byte_block);
|
||||
EXPECT_EQ(9, tenc.default_skip_byte_block);
|
||||
EXPECT_EQ(1, tenc.default_is_protected);
|
||||
EXPECT_EQ(0, tenc.default_per_sample_IV_size);
|
||||
EXPECT_EQ(16, tenc.default_constant_IV_size);
|
||||
EXPECT_EQ(0x61, tenc.default_KID[0]);
|
||||
EXPECT_EQ(0x70, tenc.default_KID[15]);
|
||||
EXPECT_EQ(0x71, tenc.default_constant_IV[0]);
|
||||
EXPECT_EQ(0x80, tenc.default_constant_IV[15]);
|
||||
EXPECT_EQ(1, tenc.version_);
|
||||
EXPECT_EQ(1, tenc.default_crypt_byte_block_);
|
||||
EXPECT_EQ(9, tenc.default_skip_byte_block_);
|
||||
EXPECT_EQ(1, tenc.default_is_protected_);
|
||||
EXPECT_EQ(0, tenc.default_per_sample_IV_size_);
|
||||
EXPECT_EQ(16, tenc.default_constant_IV_size_);
|
||||
EXPECT_EQ(0x61, tenc.default_KID_[0]);
|
||||
EXPECT_EQ(0x70, tenc.default_KID_[15]);
|
||||
EXPECT_EQ(0x71, tenc.default_constant_IV_[0]);
|
||||
EXPECT_EQ(0x80, tenc.default_constant_IV_[15]);
|
||||
|
||||
// Test encoding/decoding
|
||||
char buffer_data[1024];
|
||||
|
|
@ -459,17 +459,17 @@ VOID TEST(Fmp4Test, SrsMp4TrackEncryptionBox_AudioFullSample)
|
|||
SrsMp4TrackEncryptionBox tenc;
|
||||
|
||||
// Configure for audio full-sample encryption
|
||||
tenc.version = 1;
|
||||
tenc.default_crypt_byte_block = 0; // No pattern (full encryption)
|
||||
tenc.default_skip_byte_block = 0; // No skip
|
||||
tenc.default_is_protected = 1;
|
||||
tenc.default_per_sample_IV_size = 0; // Use constant IV
|
||||
tenc.default_constant_IV_size = 16;
|
||||
tenc.version_ = 1;
|
||||
tenc.default_crypt_byte_block_ = 0; // No pattern (full encryption)
|
||||
tenc.default_skip_byte_block_ = 0; // No skip
|
||||
tenc.default_is_protected_ = 1;
|
||||
tenc.default_per_sample_IV_size_ = 0; // Use constant IV
|
||||
tenc.default_constant_IV_size_ = 16;
|
||||
|
||||
// Verify audio encryption configuration
|
||||
EXPECT_EQ(0, tenc.default_crypt_byte_block);
|
||||
EXPECT_EQ(0, tenc.default_skip_byte_block);
|
||||
EXPECT_EQ(1, tenc.default_is_protected);
|
||||
EXPECT_EQ(0, tenc.default_crypt_byte_block_);
|
||||
EXPECT_EQ(0, tenc.default_skip_byte_block_);
|
||||
EXPECT_EQ(1, tenc.default_is_protected_);
|
||||
}
|
||||
|
||||
VOID TEST(Fmp4Test, SrsMp4SampleEncryptionBox_Basic)
|
||||
|
|
@ -479,8 +479,8 @@ VOID TEST(Fmp4Test, SrsMp4SampleEncryptionBox_Basic)
|
|||
SrsMp4SampleEncryptionBox senc(16); // 16-byte IV size
|
||||
|
||||
// Test basic properties - flags may be set by constructor
|
||||
EXPECT_EQ(0, senc.version);
|
||||
EXPECT_EQ(0, (int)senc.entries.size());
|
||||
EXPECT_EQ(0, senc.version_);
|
||||
EXPECT_EQ(0, (int)senc.entries_.size());
|
||||
|
||||
// Test encoding empty box
|
||||
char buffer_data[1024];
|
||||
|
|
@ -503,10 +503,10 @@ VOID TEST(Fmp4Test, SrsMp4SampleAuxiliaryInfoSizeBox_Basic)
|
|||
SrsMp4SampleAuxiliaryInfoSizeBox saiz;
|
||||
|
||||
// Configure SAIZ box
|
||||
saiz.version = 0;
|
||||
saiz.flags = 0;
|
||||
saiz.default_sample_info_size = 16; // 16-byte IV
|
||||
saiz.sample_count = 0;
|
||||
saiz.version_ = 0;
|
||||
saiz.flags_ = 0;
|
||||
saiz.default_sample_info_size_ = 16; // 16-byte IV
|
||||
saiz.sample_count_ = 0;
|
||||
|
||||
// Test encoding
|
||||
char buffer_data[1024];
|
||||
|
|
@ -529,9 +529,9 @@ VOID TEST(Fmp4Test, SrsMp4SampleAuxiliaryInfoOffsetBox_Basic)
|
|||
SrsMp4SampleAuxiliaryInfoOffsetBox saio;
|
||||
|
||||
// Configure SAIO box
|
||||
saio.version = 0;
|
||||
saio.flags = 0;
|
||||
saio.offsets.push_back(100); // Offset to SENC box
|
||||
saio.version_ = 0;
|
||||
saio.flags_ = 0;
|
||||
saio.offsets_.push_back(100); // Offset to SENC box
|
||||
|
||||
// Test encoding
|
||||
char buffer_data[1024];
|
||||
|
|
@ -763,10 +763,10 @@ VOID TEST(Fmp4Test, CodecDetection_AudioCodecUpdate)
|
|||
|
||||
// Create mock format with AAC audio codec
|
||||
MockSrsFormat fmt;
|
||||
fmt.acodec = new SrsAudioCodecConfig();
|
||||
fmt.acodec->id = SrsAudioCodecIdAAC;
|
||||
fmt.audio = new SrsParsedAudioPacket();
|
||||
fmt.audio->codec = fmt.acodec;
|
||||
fmt.acodec_ = new SrsAudioCodecConfig();
|
||||
fmt.acodec_->id_ = SrsAudioCodecIdAAC;
|
||||
fmt.audio_ = new SrsParsedAudioPacket();
|
||||
fmt.audio_->codec_ = fmt.acodec_;
|
||||
|
||||
// Initial codec should be forbidden (not set)
|
||||
EXPECT_EQ(SrsAudioCodecIdForbidden, controller.muxer_->latest_acodec());
|
||||
|
|
@ -779,15 +779,15 @@ VOID TEST(Fmp4Test, CodecDetection_AudioCodecUpdate)
|
|||
EXPECT_EQ(SrsAudioCodecIdAAC, controller.muxer_->latest_acodec());
|
||||
|
||||
// Test codec change from AAC to MP3
|
||||
fmt.acodec->id = SrsAudioCodecIdMP3;
|
||||
fmt.acodec_->id_ = SrsAudioCodecIdMP3;
|
||||
HELPER_ASSERT_SUCCESS(controller.write_audio(&audio_msg, &fmt));
|
||||
|
||||
// Codec should now be updated to MP3
|
||||
EXPECT_EQ(SrsAudioCodecIdMP3, controller.muxer_->latest_acodec());
|
||||
|
||||
controller.dispose();
|
||||
srs_freep(fmt.acodec);
|
||||
srs_freep(fmt.audio);
|
||||
srs_freep(fmt.acodec_);
|
||||
srs_freep(fmt.audio_);
|
||||
}
|
||||
|
||||
VOID TEST(Fmp4Test, CodecDetection_VideoCodecUpdate)
|
||||
|
|
@ -802,10 +802,10 @@ VOID TEST(Fmp4Test, CodecDetection_VideoCodecUpdate)
|
|||
|
||||
// Create mock format with H.264 video codec
|
||||
MockSrsFormat fmt;
|
||||
fmt.vcodec = new SrsVideoCodecConfig();
|
||||
fmt.vcodec->id = SrsVideoCodecIdAVC;
|
||||
fmt.video = new SrsParsedVideoPacket();
|
||||
fmt.video->codec = fmt.vcodec;
|
||||
fmt.vcodec_ = new SrsVideoCodecConfig();
|
||||
fmt.vcodec_->id_ = SrsVideoCodecIdAVC;
|
||||
fmt.video_ = new SrsParsedVideoPacket();
|
||||
fmt.video_->codec_ = fmt.vcodec_;
|
||||
|
||||
// Initial codec should be forbidden (not set)
|
||||
EXPECT_EQ(SrsVideoCodecIdForbidden, controller.muxer_->latest_vcodec());
|
||||
|
|
@ -818,15 +818,15 @@ VOID TEST(Fmp4Test, CodecDetection_VideoCodecUpdate)
|
|||
EXPECT_EQ(SrsVideoCodecIdAVC, controller.muxer_->latest_vcodec());
|
||||
|
||||
// Test codec change from H.264 to HEVC
|
||||
fmt.vcodec->id = SrsVideoCodecIdHEVC;
|
||||
fmt.vcodec_->id_ = SrsVideoCodecIdHEVC;
|
||||
HELPER_ASSERT_SUCCESS(controller.write_video(&video_msg, &fmt));
|
||||
|
||||
// Codec should now be updated to HEVC
|
||||
EXPECT_EQ(SrsVideoCodecIdHEVC, controller.muxer_->latest_vcodec());
|
||||
|
||||
controller.dispose();
|
||||
srs_freep(fmt.vcodec);
|
||||
srs_freep(fmt.video);
|
||||
srs_freep(fmt.vcodec_);
|
||||
srs_freep(fmt.video_);
|
||||
}
|
||||
|
||||
VOID TEST(Fmp4Test, Performance_MultipleSegments)
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ VOID TEST(KernelPSTest, PsPacketDecodeRegularMessage)
|
|||
HELPER_ASSERT_SUCCESS(rtp.decode(&b2));
|
||||
|
||||
SrsRtpRawPayload *rtp_raw = dynamic_cast<SrsRtpRawPayload *>(rtp.payload());
|
||||
SrsBuffer b((char *)rtp_raw->payload, rtp_raw->nn_payload);
|
||||
SrsBuffer b((char *)rtp_raw->payload_, rtp_raw->nn_payload_);
|
||||
|
||||
// Should be success, for recover mode.
|
||||
HELPER_ASSERT_SUCCESS(context.decode(&b, &handler));
|
||||
|
|
@ -335,8 +335,8 @@ VOID TEST(KernelPSTest, PsPacketDecodeRegularMessage)
|
|||
EXPECT_EQ(0, context.recover_);
|
||||
|
||||
SrsTsMessage *m = handler.msgs_.front();
|
||||
EXPECT_EQ(SrsTsPESStreamIdAudioCommon, m->sid);
|
||||
EXPECT_EQ(100, m->PES_packet_length);
|
||||
EXPECT_EQ(SrsTsPESStreamIdAudioCommon, m->sid_);
|
||||
EXPECT_EQ(100, m->PES_packet_length_);
|
||||
}
|
||||
|
||||
VOID TEST(KernelPSTest, PsPacketDecodeRegularMessage2)
|
||||
|
|
@ -366,8 +366,8 @@ VOID TEST(KernelPSTest, PsPacketDecodeRegularMessage2)
|
|||
EXPECT_EQ(0, context.recover_);
|
||||
|
||||
SrsTsMessage *m = handler.msgs_.front();
|
||||
EXPECT_EQ(SrsTsPESStreamIdAudioCommon, m->sid);
|
||||
EXPECT_EQ(100, m->PES_packet_length);
|
||||
EXPECT_EQ(SrsTsPESStreamIdAudioCommon, m->sid_);
|
||||
EXPECT_EQ(100, m->PES_packet_length_);
|
||||
}
|
||||
|
||||
VOID TEST(KernelPSTest, PsPacketDecodeRegularMessage3)
|
||||
|
|
@ -397,8 +397,8 @@ VOID TEST(KernelPSTest, PsPacketDecodeRegularMessage3)
|
|||
EXPECT_EQ(0, context.recover_);
|
||||
|
||||
SrsTsMessage *m = handler.msgs_.front();
|
||||
EXPECT_EQ(SrsTsPESStreamIdAudioCommon, m->sid);
|
||||
EXPECT_EQ(100, m->PES_packet_length);
|
||||
EXPECT_EQ(SrsTsPESStreamIdAudioCommon, m->sid_);
|
||||
EXPECT_EQ(100, m->PES_packet_length_);
|
||||
}
|
||||
|
||||
VOID TEST(KernelPSTest, PsPacketDecodeInvalidStartCode)
|
||||
|
|
@ -446,8 +446,8 @@ VOID TEST(KernelPSTest, PsPacketDecodeInvalidStartCode)
|
|||
EXPECT_EQ(0, context.recover_);
|
||||
|
||||
SrsTsMessage *last = context.ctx_.last_;
|
||||
ASSERT_EQ(65472, last->PES_packet_length);
|
||||
ASSERT_EQ(1156, last->payload->length());
|
||||
ASSERT_EQ(65472, last->PES_packet_length_);
|
||||
ASSERT_EQ(1156, last->payload_->length());
|
||||
}
|
||||
|
||||
// Seq 31814 to 31858, 45*1400=63000, left is 65472-1156-63000=1316 bytes in next packet(seq=31859).
|
||||
|
|
@ -460,13 +460,13 @@ VOID TEST(KernelPSTest, PsPacketDecodeInvalidStartCode)
|
|||
EXPECT_EQ(0, context.recover_);
|
||||
|
||||
SrsTsMessage *last = context.ctx_.last_;
|
||||
ASSERT_EQ(65472, last->PES_packet_length);
|
||||
ASSERT_EQ(1156 + 1400 * (i + 1), last->payload->length());
|
||||
ASSERT_EQ(65472, last->PES_packet_length_);
|
||||
ASSERT_EQ(1156 + 1400 * (i + 1), last->payload_->length());
|
||||
}
|
||||
if (true) {
|
||||
SrsTsMessage *last = context.ctx_.last_;
|
||||
ASSERT_EQ(65472, last->PES_packet_length);
|
||||
ASSERT_EQ(64156, last->payload->length());
|
||||
ASSERT_EQ(65472, last->PES_packet_length_);
|
||||
ASSERT_EQ(64156, last->payload_->length());
|
||||
}
|
||||
|
||||
// PT=DynamicRTP-Type-96, SSRC=0xBEBD135, Seq=31859, Time=95648400 [TCP segment of a reassembled PDU]
|
||||
|
|
@ -488,8 +488,8 @@ VOID TEST(KernelPSTest, PsPacketDecodeInvalidStartCode)
|
|||
EXPECT_EQ(0, context.recover_);
|
||||
|
||||
SrsTsMessage *last = context.ctx_.last_;
|
||||
ASSERT_EQ(65472, last->PES_packet_length);
|
||||
ASSERT_EQ(72, last->payload->length());
|
||||
ASSERT_EQ(65472, last->PES_packet_length_);
|
||||
ASSERT_EQ(72, last->payload_->length());
|
||||
}
|
||||
|
||||
// Seq 31860 to 31905, 46*1400=64400, left is 65472-72-64400=1000 bytes in next packet(seq=31906).
|
||||
|
|
@ -502,13 +502,13 @@ VOID TEST(KernelPSTest, PsPacketDecodeInvalidStartCode)
|
|||
EXPECT_EQ(0, context.recover_);
|
||||
|
||||
SrsTsMessage *last = context.ctx_.last_;
|
||||
ASSERT_EQ(65472, last->PES_packet_length);
|
||||
ASSERT_EQ(72 + 1400 * (i + 1), last->payload->length());
|
||||
ASSERT_EQ(65472, last->PES_packet_length_);
|
||||
ASSERT_EQ(72 + 1400 * (i + 1), last->payload_->length());
|
||||
}
|
||||
if (true) {
|
||||
SrsTsMessage *last = context.ctx_.last_;
|
||||
ASSERT_EQ(65472, last->PES_packet_length);
|
||||
ASSERT_EQ(64472, last->payload->length());
|
||||
ASSERT_EQ(65472, last->PES_packet_length_);
|
||||
ASSERT_EQ(64472, last->payload_->length());
|
||||
}
|
||||
|
||||
// PT=DynamicRTP-Type-96, SSRC=0xBEBD135, Seq=31906, Time=95648400 [TCP segment of a reassembled PDU]
|
||||
|
|
@ -527,8 +527,8 @@ VOID TEST(KernelPSTest, PsPacketDecodeInvalidStartCode)
|
|||
EXPECT_EQ(0, context.recover_);
|
||||
|
||||
SrsTsMessage *last = context.ctx_.last_;
|
||||
ASSERT_EQ(10172, last->PES_packet_length);
|
||||
ASSERT_EQ(388, last->payload->length());
|
||||
ASSERT_EQ(10172, last->PES_packet_length_);
|
||||
ASSERT_EQ(388, last->payload_->length());
|
||||
}
|
||||
|
||||
// Seq 31907 to 31912, 6*1400=8400, left is 10172-388-8400=1384 bytes in next packet(seq=31913).
|
||||
|
|
@ -541,13 +541,13 @@ VOID TEST(KernelPSTest, PsPacketDecodeInvalidStartCode)
|
|||
EXPECT_EQ(0, context.recover_);
|
||||
|
||||
SrsTsMessage *last = context.ctx_.last_;
|
||||
ASSERT_EQ(10172, last->PES_packet_length);
|
||||
ASSERT_EQ(388 + 1400 * (i + 1), last->payload->length());
|
||||
ASSERT_EQ(10172, last->PES_packet_length_);
|
||||
ASSERT_EQ(388 + 1400 * (i + 1), last->payload_->length());
|
||||
}
|
||||
if (true) {
|
||||
SrsTsMessage *last = context.ctx_.last_;
|
||||
ASSERT_EQ(10172, last->PES_packet_length);
|
||||
ASSERT_EQ(8788, last->payload->length());
|
||||
ASSERT_EQ(10172, last->PES_packet_length_);
|
||||
ASSERT_EQ(8788, last->payload_->length());
|
||||
}
|
||||
|
||||
// PT=DynamicRTP-Type-96, SSRC=0xBEBD135, Seq=31913, Time=95648400
|
||||
|
|
@ -565,8 +565,8 @@ VOID TEST(KernelPSTest, PsPacketDecodeInvalidStartCode)
|
|||
EXPECT_EQ(0, context.recover_);
|
||||
|
||||
SrsTsMessage *last = context.ctx_.last_;
|
||||
ASSERT_EQ(96, last->PES_packet_length);
|
||||
ASSERT_EQ(0, last->payload->length());
|
||||
ASSERT_EQ(96, last->PES_packet_length_);
|
||||
ASSERT_EQ(0, last->payload_->length());
|
||||
}
|
||||
|
||||
// Seq 31914, 96 bytes
|
||||
|
|
|
|||
101
trunk/src/utest/srs_utest_hevc_structs.cpp
Normal file
101
trunk/src/utest/srs_utest_hevc_structs.cpp
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
#include <srs_utest.hpp>
|
||||
|
||||
#include <srs_kernel_codec.hpp>
|
||||
|
||||
VOID TEST(HevcStructsTest, SrsHevcProfileTierLevel_FieldNaming)
|
||||
{
|
||||
// Test that all fields follow SRS naming convention (ending with underscore)
|
||||
SrsHevcProfileTierLevel ptl;
|
||||
|
||||
// Test basic field access - these should compile without errors
|
||||
ptl.general_profile_space_ = 1;
|
||||
ptl.general_tier_flag_ = 0;
|
||||
ptl.general_profile_idc_ = 2;
|
||||
ptl.general_profile_compatibility_flag_[0] = 1;
|
||||
ptl.general_progressive_source_flag_ = 1;
|
||||
ptl.general_interlaced_source_flag_ = 0;
|
||||
ptl.general_non_packed_constraint_flag_ = 1;
|
||||
ptl.general_frame_only_constraint_flag_ = 0;
|
||||
ptl.general_max_12bit_constraint_flag_ = 1;
|
||||
ptl.general_max_10bit_constraint_flag_ = 0;
|
||||
ptl.general_max_8bit_constraint_flag_ = 1;
|
||||
ptl.general_max_422chroma_constraint_flag_ = 0;
|
||||
ptl.general_max_420chroma_constraint_flag_ = 1;
|
||||
ptl.general_max_monochrome_constraint_flag_ = 0;
|
||||
ptl.general_intra_constraint_flag_ = 1;
|
||||
ptl.general_one_picture_only_constraint_flag_ = 0;
|
||||
ptl.general_lower_bit_rate_constraint_flag_ = 1;
|
||||
ptl.general_max_14bit_constraint_flag_ = 0;
|
||||
ptl.general_reserved_zero_7bits_ = 0;
|
||||
ptl.general_reserved_zero_33bits_ = 0;
|
||||
ptl.general_reserved_zero_34bits_ = 0;
|
||||
ptl.general_reserved_zero_35bits_ = 0;
|
||||
ptl.general_reserved_zero_43bits_ = 0;
|
||||
ptl.general_inbld_flag_ = 1;
|
||||
ptl.general_reserved_zero_bit_ = 0;
|
||||
ptl.general_level_idc_ = 93;
|
||||
ptl.reserved_zero_2bits_[0] = 0;
|
||||
|
||||
// Test vector fields
|
||||
ptl.sub_layer_profile_present_flag_.resize(1);
|
||||
ptl.sub_layer_level_present_flag_.resize(1);
|
||||
ptl.sub_layer_profile_space_.resize(1);
|
||||
ptl.sub_layer_tier_flag_.resize(1);
|
||||
ptl.sub_layer_profile_idc_.resize(1);
|
||||
ptl.sub_layer_profile_compatibility_flag_.resize(1);
|
||||
ptl.sub_layer_progressive_source_flag_.resize(1);
|
||||
ptl.sub_layer_interlaced_source_flag_.resize(1);
|
||||
ptl.sub_layer_non_packed_constraint_flag_.resize(1);
|
||||
ptl.sub_layer_frame_only_constraint_flag_.resize(1);
|
||||
ptl.sub_layer_max_12bit_constraint_flag_.resize(1);
|
||||
ptl.sub_layer_max_10bit_constraint_flag_.resize(1);
|
||||
ptl.sub_layer_max_8bit_constraint_flag_.resize(1);
|
||||
ptl.sub_layer_max_422chroma_constraint_flag_.resize(1);
|
||||
ptl.sub_layer_max_420chroma_constraint_flag_.resize(1);
|
||||
ptl.sub_layer_max_monochrome_constraint_flag_.resize(1);
|
||||
ptl.sub_layer_intra_constraint_flag_.resize(1);
|
||||
ptl.sub_layer_one_picture_only_constraint_flag_.resize(1);
|
||||
ptl.sub_layer_lower_bit_rate_constraint_flag_.resize(1);
|
||||
ptl.sub_layer_reserved_zero_7bits_.resize(1);
|
||||
ptl.sub_layer_reserved_zero_33bits_.resize(1);
|
||||
ptl.sub_layer_reserved_zero_34bits_.resize(1);
|
||||
ptl.sub_layer_reserved_zero_35bits_.resize(1);
|
||||
ptl.sub_layer_reserved_zero_43bits_.resize(1);
|
||||
ptl.sub_layer_inbld_flag_.resize(1);
|
||||
ptl.sub_layer_reserved_zero_bit_.resize(1);
|
||||
ptl.sub_layer_level_idc_.resize(1);
|
||||
|
||||
// Verify values were set correctly
|
||||
EXPECT_EQ(1, ptl.general_profile_space_);
|
||||
EXPECT_EQ(0, ptl.general_tier_flag_);
|
||||
EXPECT_EQ(2, ptl.general_profile_idc_);
|
||||
EXPECT_EQ(1, ptl.general_profile_compatibility_flag_[0]);
|
||||
EXPECT_EQ(93, ptl.general_level_idc_);
|
||||
EXPECT_EQ(1, ptl.sub_layer_profile_present_flag_.size());
|
||||
}
|
||||
|
||||
VOID TEST(HevcStructsTest, SrsHevcSubLayerHrdParameters_FieldNaming)
|
||||
{
|
||||
// Test that SrsHevcSubLayerHrdParameters already has correct naming
|
||||
SrsHevcSubLayerHrdParameters params;
|
||||
|
||||
// Test field access - these should compile without errors
|
||||
params.bit_rate_value_minus1_.resize(1);
|
||||
params.cpb_size_value_minus1_.resize(1);
|
||||
params.cpb_size_du_value_minus1_.resize(1);
|
||||
params.bit_rate_du_value_minus1_.resize(1);
|
||||
params.cbr_flag_.resize(1);
|
||||
|
||||
params.bit_rate_value_minus1_[0] = 1000;
|
||||
params.cpb_size_value_minus1_[0] = 2000;
|
||||
params.cpb_size_du_value_minus1_[0] = 3000;
|
||||
params.bit_rate_du_value_minus1_[0] = 4000;
|
||||
params.cbr_flag_[0] = 1;
|
||||
|
||||
// Verify values were set correctly
|
||||
EXPECT_EQ(1000, params.bit_rate_value_minus1_[0]);
|
||||
EXPECT_EQ(2000, params.cpb_size_value_minus1_[0]);
|
||||
EXPECT_EQ(3000, params.cpb_size_du_value_minus1_[0]);
|
||||
EXPECT_EQ(4000, params.bit_rate_du_value_minus1_[0]);
|
||||
EXPECT_EQ(1, params.cbr_flag_[0]);
|
||||
}
|
||||
9
trunk/src/utest/srs_utest_hevc_structs.hpp
Normal file
9
trunk/src/utest/srs_utest_hevc_structs.hpp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef SRS_UTEST_HEVC_STRUCTS_HPP
|
||||
#define SRS_UTEST_HEVC_STRUCTS_HPP
|
||||
|
||||
/*
|
||||
#include <srs_utest_hevc_structs.hpp>
|
||||
*/
|
||||
#include <srs_utest.hpp>
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -47,7 +47,7 @@ VOID TEST(KernelPSTest, PsPacketDecodeNormal)
|
|||
}
|
||||
|
||||
SrsRtpRawPayload *rtp_raw = dynamic_cast<SrsRtpRawPayload *>(rtp.payload());
|
||||
SrsBuffer b((char *)rtp_raw->payload, rtp_raw->nn_payload);
|
||||
SrsBuffer b((char *)rtp_raw->payload_, rtp_raw->nn_payload_);
|
||||
|
||||
// There should be three video messages.
|
||||
HELPER_ASSERT_SUCCESS(context.decode(&b, &handler));
|
||||
|
|
@ -72,7 +72,7 @@ VOID TEST(KernelPSTest, PsPacketDecodeNormal)
|
|||
}
|
||||
|
||||
SrsRtpRawPayload *rtp_raw = dynamic_cast<SrsRtpRawPayload *>(rtp.payload());
|
||||
SrsBuffer b((char *)rtp_raw->payload, rtp_raw->nn_payload);
|
||||
SrsBuffer b((char *)rtp_raw->payload_, rtp_raw->nn_payload_);
|
||||
|
||||
// Bytes continuity for the large video frame, got nothing message yet.
|
||||
HELPER_ASSERT_SUCCESS(context.decode(&b, handler.clear()));
|
||||
|
|
@ -96,7 +96,7 @@ VOID TEST(KernelPSTest, PsPacketDecodeNormal)
|
|||
}
|
||||
|
||||
SrsRtpRawPayload *rtp_raw = dynamic_cast<SrsRtpRawPayload *>(rtp.payload());
|
||||
SrsBuffer b((char *)rtp_raw->payload, rtp_raw->nn_payload);
|
||||
SrsBuffer b((char *)rtp_raw->payload_, rtp_raw->nn_payload_);
|
||||
|
||||
// There should be one large video message, might be an I frame.
|
||||
HELPER_ASSERT_SUCCESS(context.decode(&b, handler.clear()));
|
||||
|
|
@ -115,7 +115,7 @@ VOID TEST(KernelPSTest, PsPacketDecodeNormal)
|
|||
}
|
||||
|
||||
SrsRtpRawPayload *rtp_raw = dynamic_cast<SrsRtpRawPayload *>(rtp.payload());
|
||||
SrsBuffer b((char *)rtp_raw->payload, rtp_raw->nn_payload);
|
||||
SrsBuffer b((char *)rtp_raw->payload_, rtp_raw->nn_payload_);
|
||||
|
||||
// There should be a message of private stream, we ignore it, so we won't get it in callback.
|
||||
HELPER_ASSERT_SUCCESS(context.decode(&b, handler.clear()));
|
||||
|
|
@ -137,7 +137,7 @@ VOID TEST(KernelPSTest, PsPacketDecodeNormal)
|
|||
}
|
||||
|
||||
SrsRtpRawPayload *rtp_raw = dynamic_cast<SrsRtpRawPayload *>(rtp.payload());
|
||||
SrsBuffer b((char *)rtp_raw->payload, rtp_raw->nn_payload);
|
||||
SrsBuffer b((char *)rtp_raw->payload_, rtp_raw->nn_payload_);
|
||||
|
||||
// There should be one audio message.
|
||||
HELPER_ASSERT_SUCCESS(context.decode(&b, handler.clear()));
|
||||
|
|
@ -159,7 +159,7 @@ VOID TEST(KernelPSTest, PsPacketDecodeNormal)
|
|||
}
|
||||
|
||||
SrsRtpRawPayload *rtp_raw = dynamic_cast<SrsRtpRawPayload *>(rtp.payload());
|
||||
SrsBuffer b((char *)rtp_raw->payload, rtp_raw->nn_payload);
|
||||
SrsBuffer b((char *)rtp_raw->payload_, rtp_raw->nn_payload_);
|
||||
|
||||
// There should be another audio message.
|
||||
HELPER_ASSERT_SUCCESS(context.decode(&b, handler.clear()));
|
||||
|
|
@ -181,7 +181,7 @@ VOID TEST(KernelPSTest, PsPacketDecodeNormal)
|
|||
}
|
||||
|
||||
SrsRtpRawPayload *rtp_raw = dynamic_cast<SrsRtpRawPayload *>(rtp.payload());
|
||||
SrsBuffer b((char *)rtp_raw->payload, rtp_raw->nn_payload);
|
||||
SrsBuffer b((char *)rtp_raw->payload_, rtp_raw->nn_payload_);
|
||||
|
||||
// There should be another audio message.
|
||||
HELPER_ASSERT_SUCCESS(context.decode(&b, handler.clear()));
|
||||
|
|
@ -424,10 +424,10 @@ VOID TEST(KernelRTMPExtTest, ExtRTMPTest)
|
|||
HELPER_EXPECT_SUCCESS(f.on_video(0, (char *)"\x17\x01\x00\x00\x12", 5));
|
||||
|
||||
// Verify the frame type, codec id, avc packet type and composition time.
|
||||
EXPECT_EQ(SrsVideoAvcFrameTypeKeyFrame, f.video->frame_type);
|
||||
EXPECT_EQ(SrsVideoCodecIdAVC, f.vcodec->id);
|
||||
EXPECT_EQ(SrsVideoAvcFrameTraitNALU, f.video->avc_packet_type);
|
||||
EXPECT_EQ(0x12, f.video->cts);
|
||||
EXPECT_EQ(SrsVideoAvcFrameTypeKeyFrame, f.video_->frame_type_);
|
||||
EXPECT_EQ(SrsVideoCodecIdAVC, f.vcodec_->id_);
|
||||
EXPECT_EQ(SrsVideoAvcFrameTraitNALU, f.video_->avc_packet_type_);
|
||||
EXPECT_EQ(0x12, f.video_->cts_);
|
||||
}
|
||||
|
||||
// For new RTMP enhanced specification, with ext tag header.
|
||||
|
|
@ -437,10 +437,10 @@ VOID TEST(KernelRTMPExtTest, ExtRTMPTest)
|
|||
HELPER_EXPECT_SUCCESS(f.on_video(0, (char *)"\x91hvc1\x00\x00\x12", 8));
|
||||
|
||||
// Verify the frame type, codec id, avc packet type and composition time.
|
||||
EXPECT_EQ(SrsVideoAvcFrameTypeKeyFrame, f.video->frame_type);
|
||||
EXPECT_EQ(SrsVideoCodecIdHEVC, f.vcodec->id);
|
||||
EXPECT_EQ(SrsVideoHEVCFrameTraitPacketTypeCodedFrames, f.video->avc_packet_type);
|
||||
EXPECT_EQ(0x12, f.video->cts);
|
||||
EXPECT_EQ(SrsVideoAvcFrameTypeKeyFrame, f.video_->frame_type_);
|
||||
EXPECT_EQ(SrsVideoCodecIdHEVC, f.vcodec_->id_);
|
||||
EXPECT_EQ(SrsVideoHEVCFrameTraitPacketTypeCodedFrames, f.video_->avc_packet_type_);
|
||||
EXPECT_EQ(0x12, f.video_->cts_);
|
||||
}
|
||||
|
||||
// If packet type is 3, which is coded frame X, the composition time is 0.
|
||||
|
|
@ -450,10 +450,10 @@ VOID TEST(KernelRTMPExtTest, ExtRTMPTest)
|
|||
HELPER_EXPECT_SUCCESS(f.on_video(0, (char *)"\x93hvc1", 5));
|
||||
|
||||
// Verify the frame type, codec id, avc packet type and composition time.
|
||||
EXPECT_EQ(SrsVideoAvcFrameTypeKeyFrame, f.video->frame_type);
|
||||
EXPECT_EQ(SrsVideoCodecIdHEVC, f.vcodec->id);
|
||||
EXPECT_EQ(SrsVideoHEVCFrameTraitPacketTypeCodedFramesX, f.video->avc_packet_type);
|
||||
EXPECT_EQ(0, f.video->cts);
|
||||
EXPECT_EQ(SrsVideoAvcFrameTypeKeyFrame, f.video_->frame_type_);
|
||||
EXPECT_EQ(SrsVideoCodecIdHEVC, f.vcodec_->id_);
|
||||
EXPECT_EQ(SrsVideoHEVCFrameTraitPacketTypeCodedFramesX, f.video_->avc_packet_type_);
|
||||
EXPECT_EQ(0, f.video_->cts_);
|
||||
}
|
||||
|
||||
// Should fail if only 1 byte for ext tag header, should be more bytes for fourcc.
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ VOID TEST(KernelMp4Test, DiscoveryBox)
|
|||
b.write_4bytes(SrsMp4BoxTypeEDTS);
|
||||
b.skip(-8);
|
||||
HELPER_ASSERT_SUCCESS(SrsMp4Box::discovery(&b, &pbox));
|
||||
ASSERT_EQ(SrsMp4BoxTypeEDTS, pbox->type);
|
||||
ASSERT_EQ(SrsMp4BoxTypeEDTS, pbox->type_);
|
||||
srs_freep(pbox);
|
||||
}
|
||||
|
||||
|
|
@ -241,7 +241,7 @@ VOID TEST(KernelMp4Test, DiscoveryBox)
|
|||
b.write_4bytes(SrsMp4BoxTypeELST);
|
||||
b.skip(-8);
|
||||
HELPER_ASSERT_SUCCESS(SrsMp4Box::discovery(&b, &pbox));
|
||||
ASSERT_EQ(SrsMp4BoxTypeELST, pbox->type);
|
||||
ASSERT_EQ(SrsMp4BoxTypeELST, pbox->type_);
|
||||
srs_freep(pbox);
|
||||
}
|
||||
|
||||
|
|
@ -252,7 +252,7 @@ VOID TEST(KernelMp4Test, DiscoveryBox)
|
|||
b.write_4bytes(SrsMp4BoxTypeURN);
|
||||
b.skip(-8);
|
||||
HELPER_ASSERT_SUCCESS(SrsMp4Box::discovery(&b, &pbox));
|
||||
ASSERT_EQ(SrsMp4BoxTypeURN, pbox->type);
|
||||
ASSERT_EQ(SrsMp4BoxTypeURN, pbox->type_);
|
||||
srs_freep(pbox);
|
||||
}
|
||||
|
||||
|
|
@ -263,7 +263,7 @@ VOID TEST(KernelMp4Test, DiscoveryBox)
|
|||
b.write_4bytes(SrsMp4BoxTypeCTTS);
|
||||
b.skip(-8);
|
||||
HELPER_ASSERT_SUCCESS(SrsMp4Box::discovery(&b, &pbox));
|
||||
ASSERT_EQ(SrsMp4BoxTypeCTTS, pbox->type);
|
||||
ASSERT_EQ(SrsMp4BoxTypeCTTS, pbox->type_);
|
||||
srs_freep(pbox);
|
||||
}
|
||||
|
||||
|
|
@ -274,7 +274,7 @@ VOID TEST(KernelMp4Test, DiscoveryBox)
|
|||
b.write_4bytes(SrsMp4BoxTypeCO64);
|
||||
b.skip(-8);
|
||||
HELPER_ASSERT_SUCCESS(SrsMp4Box::discovery(&b, &pbox));
|
||||
ASSERT_EQ(SrsMp4BoxTypeCO64, pbox->type);
|
||||
ASSERT_EQ(SrsMp4BoxTypeCO64, pbox->type_);
|
||||
srs_freep(pbox);
|
||||
}
|
||||
|
||||
|
|
@ -285,7 +285,7 @@ VOID TEST(KernelMp4Test, DiscoveryBox)
|
|||
b.write_4bytes(SrsMp4BoxTypeUDTA);
|
||||
b.skip(-8);
|
||||
HELPER_ASSERT_SUCCESS(SrsMp4Box::discovery(&b, &pbox));
|
||||
ASSERT_EQ(SrsMp4BoxTypeUDTA, pbox->type);
|
||||
ASSERT_EQ(SrsMp4BoxTypeUDTA, pbox->type_);
|
||||
srs_freep(pbox);
|
||||
}
|
||||
|
||||
|
|
@ -296,7 +296,7 @@ VOID TEST(KernelMp4Test, DiscoveryBox)
|
|||
b.write_4bytes(SrsMp4BoxTypeMVEX);
|
||||
b.skip(-8);
|
||||
HELPER_ASSERT_SUCCESS(SrsMp4Box::discovery(&b, &pbox));
|
||||
ASSERT_EQ(SrsMp4BoxTypeMVEX, pbox->type);
|
||||
ASSERT_EQ(SrsMp4BoxTypeMVEX, pbox->type_);
|
||||
srs_freep(pbox);
|
||||
}
|
||||
|
||||
|
|
@ -307,7 +307,7 @@ VOID TEST(KernelMp4Test, DiscoveryBox)
|
|||
b.write_4bytes(SrsMp4BoxTypeTREX);
|
||||
b.skip(-8);
|
||||
HELPER_ASSERT_SUCCESS(SrsMp4Box::discovery(&b, &pbox));
|
||||
ASSERT_EQ(SrsMp4BoxTypeTREX, pbox->type);
|
||||
ASSERT_EQ(SrsMp4BoxTypeTREX, pbox->type_);
|
||||
srs_freep(pbox);
|
||||
}
|
||||
|
||||
|
|
@ -318,7 +318,7 @@ VOID TEST(KernelMp4Test, DiscoveryBox)
|
|||
b.write_4bytes(SrsMp4BoxTypeSTYP);
|
||||
b.skip(-8);
|
||||
HELPER_ASSERT_SUCCESS(SrsMp4Box::discovery(&b, &pbox));
|
||||
ASSERT_EQ(SrsMp4BoxTypeSTYP, pbox->type);
|
||||
ASSERT_EQ(SrsMp4BoxTypeSTYP, pbox->type_);
|
||||
srs_freep(pbox);
|
||||
}
|
||||
|
||||
|
|
@ -329,7 +329,7 @@ VOID TEST(KernelMp4Test, DiscoveryBox)
|
|||
b.write_4bytes(SrsMp4BoxTypeMOOF);
|
||||
b.skip(-8);
|
||||
HELPER_ASSERT_SUCCESS(SrsMp4Box::discovery(&b, &pbox));
|
||||
ASSERT_EQ(SrsMp4BoxTypeMOOF, pbox->type);
|
||||
ASSERT_EQ(SrsMp4BoxTypeMOOF, pbox->type_);
|
||||
srs_freep(pbox);
|
||||
}
|
||||
|
||||
|
|
@ -340,7 +340,7 @@ VOID TEST(KernelMp4Test, DiscoveryBox)
|
|||
b.write_4bytes(SrsMp4BoxTypeMFHD);
|
||||
b.skip(-8);
|
||||
HELPER_ASSERT_SUCCESS(SrsMp4Box::discovery(&b, &pbox));
|
||||
ASSERT_EQ(SrsMp4BoxTypeMFHD, pbox->type);
|
||||
ASSERT_EQ(SrsMp4BoxTypeMFHD, pbox->type_);
|
||||
srs_freep(pbox);
|
||||
}
|
||||
|
||||
|
|
@ -351,7 +351,7 @@ VOID TEST(KernelMp4Test, DiscoveryBox)
|
|||
b.write_4bytes(SrsMp4BoxTypeTRAF);
|
||||
b.skip(-8);
|
||||
HELPER_ASSERT_SUCCESS(SrsMp4Box::discovery(&b, &pbox));
|
||||
ASSERT_EQ(SrsMp4BoxTypeTRAF, pbox->type);
|
||||
ASSERT_EQ(SrsMp4BoxTypeTRAF, pbox->type_);
|
||||
srs_freep(pbox);
|
||||
}
|
||||
|
||||
|
|
@ -362,7 +362,7 @@ VOID TEST(KernelMp4Test, DiscoveryBox)
|
|||
b.write_4bytes(SrsMp4BoxTypeTFHD);
|
||||
b.skip(-8);
|
||||
HELPER_ASSERT_SUCCESS(SrsMp4Box::discovery(&b, &pbox));
|
||||
ASSERT_EQ(SrsMp4BoxTypeTFHD, pbox->type);
|
||||
ASSERT_EQ(SrsMp4BoxTypeTFHD, pbox->type_);
|
||||
srs_freep(pbox);
|
||||
}
|
||||
|
||||
|
|
@ -373,7 +373,7 @@ VOID TEST(KernelMp4Test, DiscoveryBox)
|
|||
b.write_4bytes(SrsMp4BoxTypeTFDT);
|
||||
b.skip(-8);
|
||||
HELPER_ASSERT_SUCCESS(SrsMp4Box::discovery(&b, &pbox));
|
||||
ASSERT_EQ(SrsMp4BoxTypeTFDT, pbox->type);
|
||||
ASSERT_EQ(SrsMp4BoxTypeTFDT, pbox->type_);
|
||||
srs_freep(pbox);
|
||||
}
|
||||
|
||||
|
|
@ -384,7 +384,7 @@ VOID TEST(KernelMp4Test, DiscoveryBox)
|
|||
b.write_4bytes(SrsMp4BoxTypeTRUN);
|
||||
b.skip(-8);
|
||||
HELPER_ASSERT_SUCCESS(SrsMp4Box::discovery(&b, &pbox));
|
||||
ASSERT_EQ(SrsMp4BoxTypeTRUN, pbox->type);
|
||||
ASSERT_EQ(SrsMp4BoxTypeTRUN, pbox->type_);
|
||||
srs_freep(pbox);
|
||||
}
|
||||
|
||||
|
|
@ -395,7 +395,7 @@ VOID TEST(KernelMp4Test, DiscoveryBox)
|
|||
b.write_4bytes(SrsMp4BoxTypeSIDX);
|
||||
b.skip(-8);
|
||||
HELPER_ASSERT_SUCCESS(SrsMp4Box::discovery(&b, &pbox));
|
||||
ASSERT_EQ(SrsMp4BoxTypeSIDX, pbox->type);
|
||||
ASSERT_EQ(SrsMp4BoxTypeSIDX, pbox->type_);
|
||||
srs_freep(pbox);
|
||||
}
|
||||
}
|
||||
|
|
@ -459,7 +459,7 @@ VOID TEST(KernelMp4Test, UUIDBoxDecode)
|
|||
b.write_4bytes(SrsMp4BoxTypeUUID);
|
||||
b.skip(-8);
|
||||
HELPER_ASSERT_SUCCESS(SrsMp4Box::discovery(&b, &pbox));
|
||||
ASSERT_EQ(SrsMp4BoxTypeUUID, pbox->type);
|
||||
ASSERT_EQ(SrsMp4BoxTypeUUID, pbox->type_);
|
||||
HELPER_EXPECT_SUCCESS(pbox->decode(&b));
|
||||
srs_freep(pbox);
|
||||
}
|
||||
|
|
@ -471,7 +471,7 @@ VOID TEST(KernelMp4Test, UUIDBoxDecode)
|
|||
b.write_4bytes(SrsMp4BoxTypeUUID);
|
||||
b.skip(-8);
|
||||
HELPER_ASSERT_SUCCESS(SrsMp4Box::discovery(&b, &pbox));
|
||||
ASSERT_EQ(SrsMp4BoxTypeUUID, pbox->type);
|
||||
ASSERT_EQ(SrsMp4BoxTypeUUID, pbox->type_);
|
||||
srs_freep(pbox);
|
||||
}
|
||||
|
||||
|
|
@ -482,7 +482,7 @@ VOID TEST(KernelMp4Test, UUIDBoxDecode)
|
|||
b.write_4bytes(SrsMp4BoxTypeUUID);
|
||||
b.skip(-8);
|
||||
HELPER_ASSERT_SUCCESS(SrsMp4Box::discovery(&b, &pbox));
|
||||
ASSERT_EQ(SrsMp4BoxTypeUUID, pbox->type);
|
||||
ASSERT_EQ(SrsMp4BoxTypeUUID, pbox->type_);
|
||||
srs_freep(pbox);
|
||||
}
|
||||
}
|
||||
|
|
@ -496,8 +496,8 @@ VOID TEST(KernelMp4Test, UUIDBoxEncode)
|
|||
SrsBuffer b(data, 8);
|
||||
|
||||
SrsMp4Box box;
|
||||
box.type = SrsMp4BoxTypeFREE;
|
||||
box.usertype.resize(8);
|
||||
box.type_ = SrsMp4BoxTypeFREE;
|
||||
box.usertype_.resize(8);
|
||||
ASSERT_EQ(8, (int)box.nb_bytes());
|
||||
HELPER_ASSERT_SUCCESS(box.encode(&b));
|
||||
}
|
||||
|
|
@ -507,8 +507,8 @@ VOID TEST(KernelMp4Test, UUIDBoxEncode)
|
|||
SrsBuffer b(data, 24);
|
||||
|
||||
SrsMp4Box box;
|
||||
box.type = SrsMp4BoxTypeUUID;
|
||||
box.usertype.resize(16);
|
||||
box.type_ = SrsMp4BoxTypeUUID;
|
||||
box.usertype_.resize(16);
|
||||
ASSERT_EQ(24, (int)box.nb_bytes());
|
||||
HELPER_ASSERT_SUCCESS(box.encode(&b));
|
||||
}
|
||||
|
|
@ -529,14 +529,14 @@ VOID TEST(KernelMp4Test, FullBoxDump)
|
|||
|
||||
SrsMp4FullBox box;
|
||||
HELPER_ASSERT_SUCCESS(box.decode(&b));
|
||||
EXPECT_EQ(1, box.version);
|
||||
EXPECT_EQ(2, (int)box.flags);
|
||||
EXPECT_EQ(1, box.version_);
|
||||
EXPECT_EQ(2, (int)box.flags_);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsMp4FileTypeBox box;
|
||||
box.major_brand = SrsMp4BoxBrandISO2;
|
||||
box.compatible_brands.push_back(SrsMp4BoxBrandISOM);
|
||||
box.major_brand_ = SrsMp4BoxBrandISO2;
|
||||
box.compatible_brands_.push_back(SrsMp4BoxBrandISOM);
|
||||
EXPECT_EQ(20, (int)box.update_size());
|
||||
|
||||
stringstream ss;
|
||||
|
|
@ -549,9 +549,9 @@ VOID TEST(KernelMp4Test, FullBoxDump)
|
|||
|
||||
if (true) {
|
||||
SrsMp4FullBox box;
|
||||
box.type = SrsMp4BoxTypeFTYP;
|
||||
box.version = 1;
|
||||
box.flags = 0x02;
|
||||
box.type_ = SrsMp4BoxTypeFTYP;
|
||||
box.version_ = 1;
|
||||
box.flags_ = 0x02;
|
||||
EXPECT_EQ(12, (int)box.update_size());
|
||||
|
||||
stringstream ss;
|
||||
|
|
@ -564,8 +564,8 @@ VOID TEST(KernelMp4Test, FullBoxDump)
|
|||
|
||||
if (true) {
|
||||
SrsMp4FullBox box;
|
||||
box.type = SrsMp4BoxTypeFTYP;
|
||||
box.version = 1;
|
||||
box.type_ = SrsMp4BoxTypeFTYP;
|
||||
box.version_ = 1;
|
||||
EXPECT_EQ(12, (int)box.update_size());
|
||||
|
||||
stringstream ss;
|
||||
|
|
@ -578,7 +578,7 @@ VOID TEST(KernelMp4Test, FullBoxDump)
|
|||
|
||||
if (true) {
|
||||
SrsMp4FullBox box;
|
||||
box.type = SrsMp4BoxTypeFTYP;
|
||||
box.type_ = SrsMp4BoxTypeFTYP;
|
||||
EXPECT_EQ(12, (int)box.update_size());
|
||||
|
||||
stringstream ss;
|
||||
|
|
@ -621,12 +621,12 @@ VOID TEST(KernelMp4Test, MFHDBox)
|
|||
|
||||
SrsMp4MovieFragmentHeaderBox box;
|
||||
HELPER_ASSERT_SUCCESS(box.decode(&b));
|
||||
EXPECT_EQ(3, (int)box.sequence_number);
|
||||
EXPECT_EQ(3, (int)box.sequence_number_);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsMp4MovieFragmentHeaderBox box;
|
||||
box.sequence_number = 3;
|
||||
box.sequence_number_ = 3;
|
||||
EXPECT_EQ(16, (int)box.update_size());
|
||||
|
||||
stringstream ss;
|
||||
|
|
@ -652,7 +652,7 @@ VOID TEST(KernelMp4Test, TFHDBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4TrackFragmentHeaderBox box;
|
||||
box.track_id = 100;
|
||||
box.track_id_ = 100;
|
||||
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
|
||||
HELPER_EXPECT_SUCCESS(box.encode(&b));
|
||||
|
||||
|
|
@ -668,7 +668,7 @@ VOID TEST(KernelMp4Test, TFHDBox)
|
|||
b.skip(-1 * b.pos());
|
||||
SrsMp4TrackFragmentHeaderBox box;
|
||||
HELPER_EXPECT_SUCCESS(box.decode(&b));
|
||||
EXPECT_EQ(100, (int)box.track_id);
|
||||
EXPECT_EQ(100, (int)box.track_id_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -678,13 +678,13 @@ VOID TEST(KernelMp4Test, TFHDBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4TrackFragmentHeaderBox box;
|
||||
box.track_id = 100;
|
||||
box.flags = SrsMp4TfhdFlagsBaseDataOffset | SrsMp4TfhdFlagsSampleDescriptionIndex | SrsMp4TfhdFlagsDefaultSampleDuration | SrsMp4TfhdFlagsDefautlSampleSize | SrsMp4TfhdFlagsDefaultSampleFlags | SrsMp4TfhdFlagsDurationIsEmpty | SrsMp4TfhdFlagsDefaultBaseIsMoof;
|
||||
box.base_data_offset = 10;
|
||||
box.sample_description_index = 11;
|
||||
box.default_sample_duration = 12;
|
||||
box.default_sample_size = 13;
|
||||
box.default_sample_flags = 14;
|
||||
box.track_id_ = 100;
|
||||
box.flags_ = SrsMp4TfhdFlagsBaseDataOffset | SrsMp4TfhdFlagsSampleDescriptionIndex | SrsMp4TfhdFlagsDefaultSampleDuration | SrsMp4TfhdFlagsDefautlSampleSize | SrsMp4TfhdFlagsDefaultSampleFlags | SrsMp4TfhdFlagsDurationIsEmpty | SrsMp4TfhdFlagsDefaultBaseIsMoof;
|
||||
box.base_data_offset_ = 10;
|
||||
box.sample_description_index_ = 11;
|
||||
box.default_sample_duration_ = 12;
|
||||
box.default_sample_size_ = 13;
|
||||
box.default_sample_flags_ = 14;
|
||||
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
|
||||
HELPER_EXPECT_SUCCESS(box.encode(&b));
|
||||
|
||||
|
|
@ -700,12 +700,12 @@ VOID TEST(KernelMp4Test, TFHDBox)
|
|||
b.skip(-1 * b.pos());
|
||||
SrsMp4TrackFragmentHeaderBox box;
|
||||
HELPER_EXPECT_SUCCESS(box.decode(&b));
|
||||
EXPECT_EQ((int)box.track_id, 100);
|
||||
EXPECT_EQ((int)box.base_data_offset, 10);
|
||||
EXPECT_EQ((int)box.sample_description_index, 11);
|
||||
EXPECT_EQ((int)box.default_sample_duration, 12);
|
||||
EXPECT_EQ((int)box.default_sample_size, 13);
|
||||
EXPECT_EQ((int)box.default_sample_flags, 14);
|
||||
EXPECT_EQ((int)box.track_id_, 100);
|
||||
EXPECT_EQ((int)box.base_data_offset_, 10);
|
||||
EXPECT_EQ((int)box.sample_description_index_, 11);
|
||||
EXPECT_EQ((int)box.default_sample_duration_, 12);
|
||||
EXPECT_EQ((int)box.default_sample_size_, 13);
|
||||
EXPECT_EQ((int)box.default_sample_flags_, 14);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -720,7 +720,7 @@ VOID TEST(KernelMp4Test, TFDTBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4TrackFragmentDecodeTimeBox box;
|
||||
box.base_media_decode_time = 100;
|
||||
box.base_media_decode_time_ = 100;
|
||||
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
|
||||
HELPER_EXPECT_SUCCESS(box.encode(&b));
|
||||
|
||||
|
|
@ -736,7 +736,7 @@ VOID TEST(KernelMp4Test, TFDTBox)
|
|||
b.skip(-1 * b.pos());
|
||||
SrsMp4TrackFragmentDecodeTimeBox box;
|
||||
HELPER_EXPECT_SUCCESS(box.decode(&b));
|
||||
EXPECT_EQ(100, (int)box.base_media_decode_time);
|
||||
EXPECT_EQ(100, (int)box.base_media_decode_time_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -746,8 +746,8 @@ VOID TEST(KernelMp4Test, TFDTBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4TrackFragmentDecodeTimeBox box;
|
||||
box.version = 1;
|
||||
box.base_media_decode_time = 100;
|
||||
box.version_ = 1;
|
||||
box.base_media_decode_time_ = 100;
|
||||
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
|
||||
HELPER_EXPECT_SUCCESS(box.encode(&b));
|
||||
|
||||
|
|
@ -763,7 +763,7 @@ VOID TEST(KernelMp4Test, TFDTBox)
|
|||
b.skip(-1 * b.pos());
|
||||
SrsMp4TrackFragmentDecodeTimeBox box;
|
||||
HELPER_EXPECT_SUCCESS(box.decode(&b));
|
||||
EXPECT_EQ(100, (int)box.base_media_decode_time);
|
||||
EXPECT_EQ(100, (int)box.base_media_decode_time_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -802,11 +802,11 @@ VOID TEST(KernelMp4Test, TRUNBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4TrackFragmentRunBox box;
|
||||
box.flags = SrsMp4TrunFlagsSampleDuration;
|
||||
box.flags_ = SrsMp4TrunFlagsSampleDuration;
|
||||
|
||||
SrsMp4TrunEntry *entry = new SrsMp4TrunEntry(&box);
|
||||
entry->sample_duration = 1000;
|
||||
box.entries.push_back(entry);
|
||||
entry->sample_duration_ = 1000;
|
||||
box.entries_.push_back(entry);
|
||||
|
||||
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
|
||||
HELPER_EXPECT_SUCCESS(box.encode(&b));
|
||||
|
|
@ -823,10 +823,10 @@ VOID TEST(KernelMp4Test, TRUNBox)
|
|||
b.skip(-1 * b.pos());
|
||||
SrsMp4TrackFragmentRunBox box;
|
||||
HELPER_EXPECT_SUCCESS(box.decode(&b));
|
||||
ASSERT_EQ(1, (int)box.entries.size());
|
||||
ASSERT_EQ(1, (int)box.entries_.size());
|
||||
|
||||
SrsMp4TrunEntry *entry = box.entries.at(0);
|
||||
EXPECT_EQ(1000, (int)entry->sample_duration);
|
||||
SrsMp4TrunEntry *entry = box.entries_.at(0);
|
||||
EXPECT_EQ(1000, (int)entry->sample_duration_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -841,7 +841,7 @@ VOID TEST(KernelMp4Test, FreeBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4FreeSpaceBox box(SrsMp4BoxTypeFREE);
|
||||
box.data.resize(4);
|
||||
box.data_.resize(4);
|
||||
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
|
||||
HELPER_EXPECT_SUCCESS(box.encode(&b));
|
||||
|
||||
|
|
@ -857,7 +857,7 @@ VOID TEST(KernelMp4Test, FreeBox)
|
|||
b.skip(-1 * b.pos());
|
||||
SrsMp4FreeSpaceBox box(SrsMp4BoxTypeSKIP);
|
||||
HELPER_EXPECT_SUCCESS(box.decode(&b));
|
||||
EXPECT_EQ(4, (int)box.data.size());
|
||||
EXPECT_EQ(4, (int)box.data_.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -911,7 +911,7 @@ VOID TEST(KernelMp4Test, MOOVBox)
|
|||
if (true) {
|
||||
SrsMp4MediaBox *media = new SrsMp4MediaBox();
|
||||
SrsMp4HandlerReferenceBox *hdr = new SrsMp4HandlerReferenceBox();
|
||||
hdr->handler_type = SrsMp4HandlerTypeVIDE;
|
||||
hdr->handler_type_ = SrsMp4HandlerTypeVIDE;
|
||||
media->set_hdlr(hdr);
|
||||
video->set_mdia(media);
|
||||
}
|
||||
|
|
@ -923,7 +923,7 @@ VOID TEST(KernelMp4Test, MOOVBox)
|
|||
if (true) {
|
||||
SrsMp4MediaBox *media = new SrsMp4MediaBox();
|
||||
SrsMp4HandlerReferenceBox *hdr = new SrsMp4HandlerReferenceBox();
|
||||
hdr->handler_type = SrsMp4HandlerTypeSOUN;
|
||||
hdr->handler_type_ = SrsMp4HandlerTypeSOUN;
|
||||
media->set_hdlr(hdr);
|
||||
audio->set_mdia(media);
|
||||
}
|
||||
|
|
@ -943,11 +943,11 @@ VOID TEST(KernelMp4Test, TREXBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4TrackExtendsBox box;
|
||||
box.track_ID = 1;
|
||||
box.default_sample_description_index = 2;
|
||||
box.default_sample_size = 3;
|
||||
box.default_sample_duration = 4;
|
||||
box.default_sample_flags = 5;
|
||||
box.track_ID_ = 1;
|
||||
box.default_sample_description_index_ = 2;
|
||||
box.default_sample_size_ = 3;
|
||||
box.default_sample_duration_ = 4;
|
||||
box.default_sample_flags_ = 5;
|
||||
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
|
||||
HELPER_EXPECT_SUCCESS(box.encode(&b));
|
||||
|
||||
|
|
@ -963,11 +963,11 @@ VOID TEST(KernelMp4Test, TREXBox)
|
|||
b.skip(-1 * b.pos());
|
||||
SrsMp4TrackExtendsBox box;
|
||||
HELPER_EXPECT_SUCCESS(box.decode(&b));
|
||||
EXPECT_EQ((int)box.track_ID, 1);
|
||||
EXPECT_EQ((int)box.default_sample_description_index, 2);
|
||||
EXPECT_EQ((int)box.default_sample_size, 3);
|
||||
EXPECT_EQ((int)box.default_sample_duration, 4);
|
||||
EXPECT_EQ((int)box.default_sample_flags, 5);
|
||||
EXPECT_EQ((int)box.track_ID_, 1);
|
||||
EXPECT_EQ((int)box.default_sample_description_index_, 2);
|
||||
EXPECT_EQ((int)box.default_sample_size_, 3);
|
||||
EXPECT_EQ((int)box.default_sample_duration_, 4);
|
||||
EXPECT_EQ((int)box.default_sample_flags_, 5);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -988,7 +988,7 @@ VOID TEST(KernelMp4Test, TKHDBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4TrackHeaderBox box;
|
||||
box.track_ID = 1;
|
||||
box.track_ID_ = 1;
|
||||
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
|
||||
HELPER_EXPECT_SUCCESS(box.encode(&b));
|
||||
|
||||
|
|
@ -1004,7 +1004,7 @@ VOID TEST(KernelMp4Test, TKHDBox)
|
|||
b.skip(-1 * b.pos());
|
||||
SrsMp4TrackHeaderBox box;
|
||||
HELPER_EXPECT_SUCCESS(box.decode(&b));
|
||||
EXPECT_EQ((int)box.track_ID, 1);
|
||||
EXPECT_EQ((int)box.track_ID_, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1014,8 +1014,8 @@ VOID TEST(KernelMp4Test, TKHDBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4TrackHeaderBox box;
|
||||
box.version = 1;
|
||||
box.track_ID = 1;
|
||||
box.version_ = 1;
|
||||
box.track_ID_ = 1;
|
||||
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
|
||||
HELPER_EXPECT_SUCCESS(box.encode(&b));
|
||||
|
||||
|
|
@ -1031,7 +1031,7 @@ VOID TEST(KernelMp4Test, TKHDBox)
|
|||
b.skip(-1 * b.pos());
|
||||
SrsMp4TrackHeaderBox box;
|
||||
HELPER_EXPECT_SUCCESS(box.decode(&b));
|
||||
EXPECT_EQ((int)box.track_ID, 1);
|
||||
EXPECT_EQ((int)box.track_ID_, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1072,7 +1072,7 @@ VOID TEST(KernelMp4Test, ELSTBox)
|
|||
SrsMp4EditListBox box;
|
||||
if (true) {
|
||||
SrsMp4ElstEntry entry;
|
||||
box.entries.push_back(entry);
|
||||
box.entries_.push_back(entry);
|
||||
}
|
||||
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
|
||||
HELPER_EXPECT_SUCCESS(box.encode(&b));
|
||||
|
|
@ -1170,13 +1170,13 @@ VOID TEST(KernelMp4Test, MDHDBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4HandlerReferenceBox box;
|
||||
box.handler_type = SrsMp4HandlerTypeVIDE;
|
||||
box.handler_type_ = SrsMp4HandlerTypeVIDE;
|
||||
EXPECT_TRUE(box.is_video());
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsMp4HandlerReferenceBox box;
|
||||
box.handler_type = SrsMp4HandlerTypeSOUN;
|
||||
box.handler_type_ = SrsMp4HandlerTypeSOUN;
|
||||
EXPECT_TRUE(box.is_audio());
|
||||
}
|
||||
}
|
||||
|
|
@ -1191,7 +1191,7 @@ VOID TEST(KernelMp4Test, HDLRBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4HandlerReferenceBox box;
|
||||
box.handler_type = SrsMp4HandlerTypeSOUN;
|
||||
box.handler_type_ = SrsMp4HandlerTypeSOUN;
|
||||
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
|
||||
HELPER_EXPECT_SUCCESS(box.encode(&b));
|
||||
|
||||
|
|
@ -1207,7 +1207,7 @@ VOID TEST(KernelMp4Test, HDLRBox)
|
|||
b.skip(-1 * b.pos());
|
||||
SrsMp4HandlerReferenceBox box;
|
||||
HELPER_EXPECT_SUCCESS(box.decode(&b));
|
||||
EXPECT_EQ(SrsMp4HandlerTypeSOUN, box.handler_type);
|
||||
EXPECT_EQ(SrsMp4HandlerTypeSOUN, box.handler_type_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1217,7 +1217,7 @@ VOID TEST(KernelMp4Test, HDLRBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4HandlerReferenceBox box;
|
||||
box.handler_type = SrsMp4HandlerTypeVIDE;
|
||||
box.handler_type_ = SrsMp4HandlerTypeVIDE;
|
||||
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
|
||||
HELPER_EXPECT_SUCCESS(box.encode(&b));
|
||||
|
||||
|
|
@ -1233,7 +1233,7 @@ VOID TEST(KernelMp4Test, HDLRBox)
|
|||
b.skip(-1 * b.pos());
|
||||
SrsMp4HandlerReferenceBox box;
|
||||
HELPER_EXPECT_SUCCESS(box.decode(&b));
|
||||
EXPECT_EQ(SrsMp4HandlerTypeVIDE, box.handler_type);
|
||||
EXPECT_EQ(SrsMp4HandlerTypeVIDE, box.handler_type_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1243,8 +1243,8 @@ VOID TEST(KernelMp4Test, HDLRBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4HandlerReferenceBox box;
|
||||
box.handler_type = SrsMp4HandlerTypeVIDE;
|
||||
box.name = "srs";
|
||||
box.handler_type_ = SrsMp4HandlerTypeVIDE;
|
||||
box.name_ = "srs";
|
||||
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
|
||||
HELPER_EXPECT_SUCCESS(box.encode(&b));
|
||||
|
||||
|
|
@ -1260,7 +1260,7 @@ VOID TEST(KernelMp4Test, HDLRBox)
|
|||
b.skip(-1 * b.pos());
|
||||
SrsMp4HandlerReferenceBox box;
|
||||
HELPER_EXPECT_SUCCESS(box.decode(&b));
|
||||
EXPECT_EQ(SrsMp4HandlerTypeVIDE, box.handler_type);
|
||||
EXPECT_EQ(SrsMp4HandlerTypeVIDE, box.handler_type_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1396,7 +1396,7 @@ VOID TEST(KernelMp4Test, SampleDescBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4VisualSampleEntry box = SrsMp4VisualSampleEntry(SrsMp4BoxTypeAVC1);
|
||||
box.data_reference_index = 1;
|
||||
box.data_reference_index_ = 1;
|
||||
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
|
||||
HELPER_EXPECT_SUCCESS(box.encode(&b));
|
||||
|
||||
|
|
@ -1445,7 +1445,7 @@ VOID TEST(KernelMp4Test, SampleDescBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4VisualSampleEntry box = SrsMp4VisualSampleEntry(SrsMp4BoxTypeHEV1);
|
||||
box.data_reference_index = 1;
|
||||
box.data_reference_index_ = 1;
|
||||
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
|
||||
HELPER_EXPECT_SUCCESS(box.encode(&b));
|
||||
|
||||
|
|
@ -1494,7 +1494,7 @@ VOID TEST(KernelMp4Test, SampleDescBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4AudioSampleEntry box;
|
||||
box.data_reference_index = 1;
|
||||
box.data_reference_index_ = 1;
|
||||
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
|
||||
HELPER_EXPECT_SUCCESS(box.encode(&b));
|
||||
|
||||
|
|
@ -1524,7 +1524,7 @@ VOID TEST(KernelMp4Test, SpecificInfoBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4DecoderSpecificInfo box;
|
||||
box.asc.resize(2);
|
||||
box.asc_.resize(2);
|
||||
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
|
||||
HELPER_EXPECT_SUCCESS(box.encode(&b));
|
||||
|
||||
|
|
@ -1602,7 +1602,7 @@ VOID TEST(KernelMp4Test, STSDBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4SampleDescriptionBox box;
|
||||
box.entries.push_back(new SrsMp4SampleEntry());
|
||||
box.entries_.push_back(new SrsMp4SampleEntry());
|
||||
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
|
||||
HELPER_EXPECT_SUCCESS(box.encode(&b));
|
||||
|
||||
|
|
@ -1627,7 +1627,7 @@ VOID TEST(KernelMp4Test, STSDBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4DecodingTime2SampleBox box;
|
||||
box.entries.push_back(SrsMp4SttsEntry());
|
||||
box.entries_.push_back(SrsMp4SttsEntry());
|
||||
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
|
||||
HELPER_EXPECT_SUCCESS(box.encode(&b));
|
||||
|
||||
|
|
@ -1652,7 +1652,7 @@ VOID TEST(KernelMp4Test, STSDBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4CompositionTime2SampleBox box;
|
||||
box.entries.push_back(SrsMp4CttsEntry());
|
||||
box.entries_.push_back(SrsMp4CttsEntry());
|
||||
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
|
||||
HELPER_EXPECT_SUCCESS(box.encode(&b));
|
||||
|
||||
|
|
@ -1797,7 +1797,7 @@ VOID TEST(KernelMp4Test, STSDBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4UserDataBox box;
|
||||
box.data.resize(2);
|
||||
box.data_.resize(2);
|
||||
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
|
||||
HELPER_EXPECT_SUCCESS(box.encode(&b));
|
||||
|
||||
|
|
@ -1915,11 +1915,11 @@ VOID TEST(KernelMp4Test, SAIZBox)
|
|||
|
||||
HELPER_ASSERT_SUCCESS(saiz.decode(&b));
|
||||
EXPECT_EQ(17, (int)saiz.nb_header());
|
||||
EXPECT_EQ(0, (int)saiz.version);
|
||||
EXPECT_EQ(0, (int)saiz.flags);
|
||||
EXPECT_EQ(1, (int)saiz.default_sample_info_size);
|
||||
EXPECT_EQ(0, (int)saiz.sample_count);
|
||||
EXPECT_EQ(0, saiz.sample_info_sizes.size());
|
||||
EXPECT_EQ(0, (int)saiz.version_);
|
||||
EXPECT_EQ(0, (int)saiz.flags_);
|
||||
EXPECT_EQ(1, (int)saiz.default_sample_info_size_);
|
||||
EXPECT_EQ(0, (int)saiz.sample_count_);
|
||||
EXPECT_EQ(0, saiz.sample_info_sizes_.size());
|
||||
}
|
||||
|
||||
// flags & 1 == 1; default_sample_info_size == 1
|
||||
|
|
@ -1940,13 +1940,13 @@ VOID TEST(KernelMp4Test, SAIZBox)
|
|||
|
||||
HELPER_ASSERT_SUCCESS(saiz.decode(&b));
|
||||
EXPECT_EQ(25, (int)saiz.nb_header());
|
||||
EXPECT_EQ(0, (int)saiz.version);
|
||||
EXPECT_EQ(1, (int)saiz.flags);
|
||||
EXPECT_EQ(1, (int)saiz.aux_info_type);
|
||||
EXPECT_EQ(2, (int)saiz.aux_info_type_parameter);
|
||||
EXPECT_EQ(1, (int)saiz.default_sample_info_size);
|
||||
EXPECT_EQ(0, (int)saiz.sample_count);
|
||||
EXPECT_EQ(0, saiz.sample_info_sizes.size());
|
||||
EXPECT_EQ(0, (int)saiz.version_);
|
||||
EXPECT_EQ(1, (int)saiz.flags_);
|
||||
EXPECT_EQ(1, (int)saiz.aux_info_type_);
|
||||
EXPECT_EQ(2, (int)saiz.aux_info_type_parameter_);
|
||||
EXPECT_EQ(1, (int)saiz.default_sample_info_size_);
|
||||
EXPECT_EQ(0, (int)saiz.sample_count_);
|
||||
EXPECT_EQ(0, saiz.sample_info_sizes_.size());
|
||||
}
|
||||
|
||||
// flags & 1 == 1; default_sample_info_size == 0; sample_count = 3;
|
||||
|
|
@ -1970,23 +1970,23 @@ VOID TEST(KernelMp4Test, SAIZBox)
|
|||
|
||||
HELPER_ASSERT_SUCCESS(saiz.decode(&b));
|
||||
EXPECT_EQ(28, (int)saiz.nb_header());
|
||||
EXPECT_EQ(0, (int)saiz.version);
|
||||
EXPECT_EQ(1, (int)saiz.flags);
|
||||
EXPECT_EQ(1, (int)saiz.aux_info_type);
|
||||
EXPECT_EQ(2, (int)saiz.aux_info_type_parameter);
|
||||
EXPECT_EQ(0, (int)saiz.default_sample_info_size);
|
||||
EXPECT_EQ(3, (int)saiz.sample_count);
|
||||
EXPECT_EQ(3, saiz.sample_info_sizes.size());
|
||||
EXPECT_EQ(4, saiz.sample_info_sizes[0]);
|
||||
EXPECT_EQ(5, saiz.sample_info_sizes[1]);
|
||||
EXPECT_EQ(6, saiz.sample_info_sizes[2]);
|
||||
EXPECT_EQ(0, (int)saiz.version_);
|
||||
EXPECT_EQ(1, (int)saiz.flags_);
|
||||
EXPECT_EQ(1, (int)saiz.aux_info_type_);
|
||||
EXPECT_EQ(2, (int)saiz.aux_info_type_parameter_);
|
||||
EXPECT_EQ(0, (int)saiz.default_sample_info_size_);
|
||||
EXPECT_EQ(3, (int)saiz.sample_count_);
|
||||
EXPECT_EQ(3, saiz.sample_info_sizes_.size());
|
||||
EXPECT_EQ(4, saiz.sample_info_sizes_[0]);
|
||||
EXPECT_EQ(5, saiz.sample_info_sizes_[1]);
|
||||
EXPECT_EQ(6, saiz.sample_info_sizes_[2]);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsMp4SampleAuxiliaryInfoSizeBox saiz;
|
||||
saiz.flags = 0;
|
||||
saiz.default_sample_info_size = 1;
|
||||
saiz.sample_count = 0;
|
||||
saiz.flags_ = 0;
|
||||
saiz.default_sample_info_size_ = 1;
|
||||
saiz.sample_count_ = 0;
|
||||
|
||||
EXPECT_EQ(17, saiz.nb_header());
|
||||
|
||||
|
|
@ -1999,9 +1999,9 @@ VOID TEST(KernelMp4Test, SAIZBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4SampleAuxiliaryInfoSizeBox saiz;
|
||||
saiz.flags = 1;
|
||||
saiz.default_sample_info_size = 1;
|
||||
saiz.sample_count = 0;
|
||||
saiz.flags_ = 1;
|
||||
saiz.default_sample_info_size_ = 1;
|
||||
saiz.sample_count_ = 0;
|
||||
|
||||
EXPECT_EQ(25, saiz.nb_header());
|
||||
stringstream ss;
|
||||
|
|
@ -2013,10 +2013,10 @@ VOID TEST(KernelMp4Test, SAIZBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4SampleAuxiliaryInfoSizeBox saiz;
|
||||
saiz.flags = 1;
|
||||
saiz.default_sample_info_size = 0;
|
||||
saiz.sample_count = 1;
|
||||
saiz.sample_info_sizes.push_back(4);
|
||||
saiz.flags_ = 1;
|
||||
saiz.default_sample_info_size_ = 0;
|
||||
saiz.sample_count_ = 1;
|
||||
saiz.sample_info_sizes_.push_back(4);
|
||||
|
||||
EXPECT_EQ(26, saiz.nb_header());
|
||||
stringstream ss;
|
||||
|
|
@ -2046,10 +2046,10 @@ VOID TEST(KernelMp4Test, SAIOBox)
|
|||
|
||||
HELPER_ASSERT_SUCCESS(saio.decode(&b));
|
||||
EXPECT_EQ(20, (int)saio.nb_header());
|
||||
EXPECT_EQ(0, (int)saio.version);
|
||||
EXPECT_EQ(0, (int)saio.flags);
|
||||
EXPECT_EQ(1, (int)saio.offsets.size());
|
||||
EXPECT_EQ(2, (int)saio.offsets[0]);
|
||||
EXPECT_EQ(0, (int)saio.version_);
|
||||
EXPECT_EQ(0, (int)saio.flags_);
|
||||
EXPECT_EQ(1, (int)saio.offsets_.size());
|
||||
EXPECT_EQ(2, (int)saio.offsets_[0]);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
|
|
@ -2069,12 +2069,12 @@ VOID TEST(KernelMp4Test, SAIOBox)
|
|||
|
||||
HELPER_ASSERT_SUCCESS(saio.decode(&b));
|
||||
EXPECT_EQ(28, (int)saio.nb_header());
|
||||
EXPECT_EQ(0, (int)saio.version);
|
||||
EXPECT_EQ(1, (int)saio.flags);
|
||||
EXPECT_EQ(1, (int)saio.aux_info_type);
|
||||
EXPECT_EQ(2, (int)saio.aux_info_type_parameter);
|
||||
EXPECT_EQ(1, (int)saio.offsets.size());
|
||||
EXPECT_EQ(2, (int)saio.offsets[0]);
|
||||
EXPECT_EQ(0, (int)saio.version_);
|
||||
EXPECT_EQ(1, (int)saio.flags_);
|
||||
EXPECT_EQ(1, (int)saio.aux_info_type_);
|
||||
EXPECT_EQ(2, (int)saio.aux_info_type_parameter_);
|
||||
EXPECT_EQ(1, (int)saio.offsets_.size());
|
||||
EXPECT_EQ(2, (int)saio.offsets_[0]);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
|
|
@ -2094,19 +2094,19 @@ VOID TEST(KernelMp4Test, SAIOBox)
|
|||
|
||||
HELPER_ASSERT_SUCCESS(saio.decode(&b));
|
||||
EXPECT_EQ(32, (int)saio.nb_header());
|
||||
EXPECT_EQ(1, (int)saio.version);
|
||||
EXPECT_EQ(1, (int)saio.flags);
|
||||
EXPECT_EQ(1, (int)saio.aux_info_type);
|
||||
EXPECT_EQ(2, (int)saio.aux_info_type_parameter);
|
||||
EXPECT_EQ(1, (int)saio.offsets.size());
|
||||
EXPECT_EQ(2, (int)saio.offsets[0]);
|
||||
EXPECT_EQ(1, (int)saio.version_);
|
||||
EXPECT_EQ(1, (int)saio.flags_);
|
||||
EXPECT_EQ(1, (int)saio.aux_info_type_);
|
||||
EXPECT_EQ(2, (int)saio.aux_info_type_parameter_);
|
||||
EXPECT_EQ(1, (int)saio.offsets_.size());
|
||||
EXPECT_EQ(2, (int)saio.offsets_[0]);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsMp4SampleAuxiliaryInfoOffsetBox saio;
|
||||
saio.version = 0;
|
||||
saio.flags = 0;
|
||||
saio.offsets.push_back(2);
|
||||
saio.version_ = 0;
|
||||
saio.flags_ = 0;
|
||||
saio.offsets_.push_back(2);
|
||||
EXPECT_EQ(20, (int)saio.nb_header());
|
||||
|
||||
stringstream ss;
|
||||
|
|
@ -2118,9 +2118,9 @@ VOID TEST(KernelMp4Test, SAIOBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4SampleAuxiliaryInfoOffsetBox saio;
|
||||
saio.version = 0;
|
||||
saio.flags = 1;
|
||||
saio.offsets.push_back(2);
|
||||
saio.version_ = 0;
|
||||
saio.flags_ = 1;
|
||||
saio.offsets_.push_back(2);
|
||||
EXPECT_EQ(28, (int)saio.nb_header());
|
||||
|
||||
stringstream ss;
|
||||
|
|
@ -2132,9 +2132,9 @@ VOID TEST(KernelMp4Test, SAIOBox)
|
|||
|
||||
if (true) {
|
||||
SrsMp4SampleAuxiliaryInfoOffsetBox saio;
|
||||
saio.version = 1;
|
||||
saio.flags = 1;
|
||||
saio.offsets.push_back(2);
|
||||
saio.version_ = 1;
|
||||
saio.flags_ = 1;
|
||||
saio.offsets_.push_back(2);
|
||||
EXPECT_EQ(32, (int)saio.nb_header());
|
||||
|
||||
stringstream ss;
|
||||
|
|
@ -2163,9 +2163,9 @@ VOID TEST(KernelMp4Test, SENCBox)
|
|||
|
||||
HELPER_ASSERT_SUCCESS(senc.decode(&b));
|
||||
EXPECT_EQ(16, (int)senc.nb_header());
|
||||
EXPECT_EQ(0, (int)senc.version);
|
||||
EXPECT_EQ(0, (int)senc.flags);
|
||||
EXPECT_EQ(0, (int)senc.entries.size());
|
||||
EXPECT_EQ(0, (int)senc.version_);
|
||||
EXPECT_EQ(0, (int)senc.flags_);
|
||||
EXPECT_EQ(0, (int)senc.entries_.size());
|
||||
}
|
||||
|
||||
if (true) {
|
||||
|
|
@ -2183,9 +2183,9 @@ VOID TEST(KernelMp4Test, SENCBox)
|
|||
|
||||
HELPER_ASSERT_SUCCESS(senc.decode(&b));
|
||||
EXPECT_EQ(24, (int)senc.nb_header());
|
||||
EXPECT_EQ(0, (int)senc.version);
|
||||
EXPECT_EQ(0, (int)senc.flags);
|
||||
EXPECT_EQ(1, (int)senc.entries.size());
|
||||
EXPECT_EQ(0, (int)senc.version_);
|
||||
EXPECT_EQ(0, (int)senc.flags_);
|
||||
EXPECT_EQ(1, (int)senc.entries_.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2236,10 +2236,10 @@ VOID TEST(KernelMp4Test, SCHMBox)
|
|||
|
||||
HELPER_ASSERT_SUCCESS(schm.decode(&b));
|
||||
EXPECT_EQ(20, (int)schm.nb_header());
|
||||
EXPECT_EQ(0, (int)schm.version);
|
||||
EXPECT_EQ(0, (int)schm.flags);
|
||||
EXPECT_EQ(1, (int)schm.scheme_type);
|
||||
EXPECT_EQ(2, (int)schm.scheme_version);
|
||||
EXPECT_EQ(0, (int)schm.version_);
|
||||
EXPECT_EQ(0, (int)schm.flags_);
|
||||
EXPECT_EQ(1, (int)schm.scheme_type_);
|
||||
EXPECT_EQ(2, (int)schm.scheme_version_);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
|
|
@ -2260,10 +2260,10 @@ VOID TEST(KernelMp4Test, SCHMBox)
|
|||
|
||||
HELPER_ASSERT_SUCCESS(schm.decode(&b));
|
||||
EXPECT_EQ(24, (int)schm.nb_header());
|
||||
EXPECT_EQ(0, (int)schm.version);
|
||||
EXPECT_EQ(1, (int)schm.flags);
|
||||
EXPECT_EQ(1, (int)schm.scheme_type);
|
||||
EXPECT_EQ(2, (int)schm.scheme_version);
|
||||
EXPECT_EQ(0, (int)schm.version_);
|
||||
EXPECT_EQ(1, (int)schm.flags_);
|
||||
EXPECT_EQ(1, (int)schm.scheme_type_);
|
||||
EXPECT_EQ(2, (int)schm.scheme_version_);
|
||||
|
||||
stringstream ss;
|
||||
SrsMp4DumpContext dc;
|
||||
|
|
@ -2369,17 +2369,17 @@ VOID TEST(KernelMp4Test, SrsFmp4SegmentEncoder)
|
|||
|
||||
HELPER_ASSERT_SUCCESS(audio_fmt.on_audio(0, (char *)audio_raw, sizeof(audio_raw)));
|
||||
|
||||
SrsVideoAvcFrameType video_frame_type = video_fmt.video->frame_type;
|
||||
uint32_t cts = (uint32_t)video_fmt.video->cts;
|
||||
SrsVideoAvcFrameType video_frame_type = video_fmt.video_->frame_type_;
|
||||
uint32_t cts = (uint32_t)video_fmt.video_->cts_;
|
||||
|
||||
uint32_t dts = 0;
|
||||
uint32_t pts = dts + cts;
|
||||
|
||||
uint8_t *video_sample = (uint8_t *)video_fmt.raw;
|
||||
uint32_t nb_video_sample = (uint32_t)video_fmt.nb_raw;
|
||||
uint8_t *video_sample = (uint8_t *)video_fmt.raw_;
|
||||
uint32_t nb_video_sample = (uint32_t)video_fmt.nb_raw_;
|
||||
encoder.write_sample(SrsMp4HandlerTypeVIDE, video_frame_type, dts, pts, video_sample, nb_video_sample);
|
||||
uint8_t *audio_sample = (uint8_t *)audio_fmt.raw;
|
||||
uint32_t nb_audio_sample = (uint32_t)audio_fmt.nb_raw;
|
||||
uint8_t *audio_sample = (uint8_t *)audio_fmt.raw_;
|
||||
uint32_t nb_audio_sample = (uint32_t)audio_fmt.nb_raw_;
|
||||
encoder.write_sample(SrsMp4HandlerTypeSOUN, 0, 0, 0, audio_sample, nb_audio_sample);
|
||||
encoder.flush(dts);
|
||||
EXPECT_TRUE(fw.filesize() > 0);
|
||||
|
|
@ -2475,13 +2475,13 @@ VOID TEST(KernelMp4Test, SrsMp4DvrJitter)
|
|||
|
||||
// Create audio sample that arrives first
|
||||
SrsMp4Sample audio_sample;
|
||||
audio_sample.type = SrsFrameTypeAudio;
|
||||
audio_sample.dts = 1000; // Audio starts at 1000us
|
||||
audio_sample.type_ = SrsFrameTypeAudio;
|
||||
audio_sample.dts_ = 1000; // Audio starts at 1000us
|
||||
|
||||
// Create video sample that arrives later
|
||||
SrsMp4Sample video_sample;
|
||||
video_sample.type = SrsFrameTypeVideo;
|
||||
video_sample.dts = 2000; // Video starts at 2000us
|
||||
video_sample.type_ = SrsFrameTypeVideo;
|
||||
video_sample.dts_ = 2000; // Video starts at 2000us
|
||||
|
||||
// Process samples
|
||||
jitter.on_sample(&audio_sample);
|
||||
|
|
@ -2503,13 +2503,13 @@ VOID TEST(KernelMp4Test, SrsMp4DvrJitter)
|
|||
|
||||
// Create video sample that arrives first
|
||||
SrsMp4Sample video_sample;
|
||||
video_sample.type = SrsFrameTypeVideo;
|
||||
video_sample.dts = 500; // Video starts at 500us
|
||||
video_sample.type_ = SrsFrameTypeVideo;
|
||||
video_sample.dts_ = 500; // Video starts at 500us
|
||||
|
||||
// Create audio sample that arrives later
|
||||
SrsMp4Sample audio_sample;
|
||||
audio_sample.type = SrsFrameTypeAudio;
|
||||
audio_sample.dts = 1500; // Audio starts at 1500us
|
||||
audio_sample.type_ = SrsFrameTypeAudio;
|
||||
audio_sample.dts_ = 1500; // Audio starts at 1500us
|
||||
|
||||
// Process samples
|
||||
jitter.on_sample(&video_sample);
|
||||
|
|
@ -2531,12 +2531,12 @@ VOID TEST(KernelMp4Test, SrsMp4DvrJitter)
|
|||
|
||||
// Create samples with same start time
|
||||
SrsMp4Sample audio_sample;
|
||||
audio_sample.type = SrsFrameTypeAudio;
|
||||
audio_sample.dts = 1000;
|
||||
audio_sample.type_ = SrsFrameTypeAudio;
|
||||
audio_sample.dts_ = 1000;
|
||||
|
||||
SrsMp4Sample video_sample;
|
||||
video_sample.type = SrsFrameTypeVideo;
|
||||
video_sample.dts = 1000;
|
||||
video_sample.type_ = SrsFrameTypeVideo;
|
||||
video_sample.dts_ = 1000;
|
||||
|
||||
// Process samples
|
||||
jitter.on_sample(&audio_sample);
|
||||
|
|
@ -2556,8 +2556,8 @@ VOID TEST(KernelMp4Test, SrsMp4DvrJitter)
|
|||
|
||||
// Initialize with samples
|
||||
SrsMp4Sample audio_sample;
|
||||
audio_sample.type = SrsFrameTypeAudio;
|
||||
audio_sample.dts = 1000;
|
||||
audio_sample.type_ = SrsFrameTypeAudio;
|
||||
audio_sample.dts_ = 1000;
|
||||
|
||||
jitter.on_sample(&audio_sample);
|
||||
|
||||
|
|
@ -2574,16 +2574,16 @@ VOID TEST(KernelMp4Test, SrsMp4DvrJitter)
|
|||
|
||||
// Create multiple audio samples
|
||||
SrsMp4Sample audio1;
|
||||
audio1.type = SrsFrameTypeAudio;
|
||||
audio1.dts = 1000;
|
||||
audio1.type_ = SrsFrameTypeAudio;
|
||||
audio1.dts_ = 1000;
|
||||
|
||||
SrsMp4Sample audio2;
|
||||
audio2.type = SrsFrameTypeAudio;
|
||||
audio2.dts = 2000; // This should be ignored
|
||||
audio2.type_ = SrsFrameTypeAudio;
|
||||
audio2.dts_ = 2000; // This should be ignored
|
||||
|
||||
SrsMp4Sample video1;
|
||||
video1.type = SrsFrameTypeVideo;
|
||||
video1.dts = 1500;
|
||||
video1.type_ = SrsFrameTypeVideo;
|
||||
video1.dts_ = 1500;
|
||||
|
||||
// Process samples
|
||||
jitter.on_sample(&audio1);
|
||||
|
|
|
|||
|
|
@ -1121,7 +1121,7 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVMessage)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1149,7 +1149,7 @@ VOID TEST(ProtocolStackTest, ProtocolRecvAMessage)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_audio());
|
||||
EXPECT_TRUE(msg->header_.is_audio());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1196,7 +1196,7 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVMessage2Trunk)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1405,13 +1405,13 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAMessage)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_audio());
|
||||
EXPECT_TRUE(msg->header_.is_audio());
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1644,13 +1644,13 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAFmt1)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_audio());
|
||||
EXPECT_TRUE(msg->header_.is_audio());
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1879,13 +1879,13 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAFmt2)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_audio());
|
||||
EXPECT_TRUE(msg->header_.is_audio());
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2111,13 +2111,13 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAFmt3)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_audio());
|
||||
EXPECT_TRUE(msg->header_.is_audio());
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2490,25 +2490,25 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVMessage)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x10, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x10, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_audio());
|
||||
EXPECT_EQ(0x15, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_audio());
|
||||
EXPECT_EQ(0x15, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x20, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x20, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2894,25 +2894,25 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVFmt1)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x10, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x10, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_audio());
|
||||
EXPECT_EQ(0x15, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_audio());
|
||||
EXPECT_EQ(0x15, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x22, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x22, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3296,25 +3296,25 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVFmt2)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x10, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x10, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_audio());
|
||||
EXPECT_EQ(0x15, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_audio());
|
||||
EXPECT_EQ(0x15, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x22, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x22, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3697,25 +3697,25 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVFmt3)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x10, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x10, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_audio());
|
||||
EXPECT_EQ(0x15, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_audio());
|
||||
EXPECT_EQ(0x15, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x20, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x20, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3766,7 +3766,7 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid1BNormal)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -3816,7 +3816,7 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid1BMax)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -3866,7 +3866,7 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid2BMin)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -3916,7 +3916,7 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid2BNormal)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -3966,7 +3966,7 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid2BNormal2)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -4016,7 +4016,7 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid2BMax)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -4066,7 +4066,7 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid3BMin)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -4116,7 +4116,7 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid3BNormal)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -4166,7 +4166,7 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid3BNormal2)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -4216,7 +4216,7 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid3BNormal3)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -4266,7 +4266,7 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid3BNormal4)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -4316,7 +4316,7 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid3BMax)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -4353,9 +4353,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvV0LenMessage)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
// protocol stack will ignore the empty video message.
|
||||
EXPECT_EQ(4, msg->header.payload_length);
|
||||
EXPECT_EQ(4, msg->header_.payload_length_);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -4934,10 +4934,10 @@ VOID TEST(ProtocolStackTest, ProtocolAckSizeFlow)
|
|||
SrsRtmpCommonMessage *msg = new SrsRtmpCommonMessage();
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
msg->create_payload(4096);
|
||||
msg->header.payload_length = 4096;
|
||||
msg->header_.payload_length_ = 4096;
|
||||
|
||||
msg->header.message_type = 9;
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
msg->header_.message_type_ = 9;
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
|
||||
SrsMediaPacket m;
|
||||
msg->to_msg(&m);
|
||||
|
|
@ -4956,14 +4956,14 @@ VOID TEST(ProtocolStackTest, ProtocolAckSizeFlow)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
ASSERT_TRUE(msg->header.is_window_ackledgement_size());
|
||||
ASSERT_TRUE(msg->header_.is_window_ackledgement_size());
|
||||
}
|
||||
// recv video
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
ASSERT_TRUE(msg->header.is_video());
|
||||
ASSERT_TRUE(msg->header_.is_video());
|
||||
}
|
||||
|
||||
// copy output to input
|
||||
|
|
@ -4976,18 +4976,18 @@ VOID TEST(ProtocolStackTest, ProtocolAckSizeFlow)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
ASSERT_TRUE(msg->header.is_ackledgement());
|
||||
ASSERT_TRUE(msg->header_.is_ackledgement());
|
||||
}
|
||||
|
||||
// send again
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg = new SrsRtmpCommonMessage();
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
msg->header.payload_length = 4096;
|
||||
msg->header_.payload_length_ = 4096;
|
||||
msg->create_payload(4096);
|
||||
|
||||
msg->header.message_type = 9;
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
msg->header_.message_type_ = 9;
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
|
||||
SrsMediaPacket m;
|
||||
msg->to_msg(&m);
|
||||
|
|
@ -5004,7 +5004,7 @@ VOID TEST(ProtocolStackTest, ProtocolAckSizeFlow)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
ASSERT_TRUE(msg->header.is_video());
|
||||
ASSERT_TRUE(msg->header_.is_video());
|
||||
}
|
||||
|
||||
// copy output to input
|
||||
|
|
@ -5017,7 +5017,7 @@ VOID TEST(ProtocolStackTest, ProtocolAckSizeFlow)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
ASSERT_TRUE(msg->header.is_ackledgement());
|
||||
ASSERT_TRUE(msg->header_.is_ackledgement());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5048,7 +5048,7 @@ VOID TEST(ProtocolStackTest, ProtocolPingFlow)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_TRUE(msg->header.is_user_control_message());
|
||||
EXPECT_TRUE(msg->header_.is_user_control_message());
|
||||
}
|
||||
|
||||
// recv the server auto send ping response message
|
||||
|
|
@ -5062,7 +5062,7 @@ VOID TEST(ProtocolStackTest, ProtocolPingFlow)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
ASSERT_TRUE(msg->header.is_user_control_message());
|
||||
ASSERT_TRUE(msg->header_.is_user_control_message());
|
||||
|
||||
SrsRtmpCommand *pkt = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.decode_message(msg, &pkt));
|
||||
|
|
|
|||
|
|
@ -564,36 +564,36 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVVFmt11)
|
|||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x10, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x10, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_audio());
|
||||
EXPECT_EQ(0x15, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_audio());
|
||||
EXPECT_EQ(0x15, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x20, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x20, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x40, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x40, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1144,36 +1144,36 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVVFmt11Length)
|
|||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x10, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x10, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_audio());
|
||||
EXPECT_EQ(0x15, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_audio());
|
||||
EXPECT_EQ(0x15, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x20, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x20, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x40, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x40, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1720,36 +1720,36 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVVFmt12)
|
|||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x10, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x10, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_audio());
|
||||
EXPECT_EQ(0x15, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_audio());
|
||||
EXPECT_EQ(0x15, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x20, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x20, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x40, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x40, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2299,39 +2299,39 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVVFmt12Length)
|
|||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x10, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_EQ(0x110, msg->header.payload_length);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x10, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
EXPECT_EQ(0x110, msg->header_.payload_length_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_audio());
|
||||
EXPECT_EQ(0x15, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_audio());
|
||||
EXPECT_EQ(0x15, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x20, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_EQ(0x120, msg->header.payload_length);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x20, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
EXPECT_EQ(0x120, msg->header_.payload_length_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x40, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_EQ(0x120, msg->header.payload_length);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x40, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
EXPECT_EQ(0x120, msg->header_.payload_length_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2375,8 +2375,8 @@ VOID TEST(ProtocolStackTest, ProtocolRecvExtTimeMessage)
|
|||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x10, msg->header.timestamp);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x10, msg->header_.timestamp_);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2419,8 +2419,8 @@ VOID TEST(ProtocolStackTest, ProtocolRecvExtTimeMessage2)
|
|||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x7f010203, msg->header.timestamp);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x7f010203, msg->header_.timestamp_);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2464,9 +2464,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvExtTimeMessage3)
|
|||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
// always use 31bits timestamp
|
||||
EXPECT_EQ(0x7f010203, msg->header.timestamp);
|
||||
EXPECT_EQ(0x7f010203, msg->header_.timestamp_);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2539,9 +2539,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVExtTime2Trunk)
|
|||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
// 0xCX with extended timestamp.
|
||||
EXPECT_EQ(0x00010203, msg->header.timestamp);
|
||||
EXPECT_EQ(0x00010203, msg->header_.timestamp_);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2596,9 +2596,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVExtTime2Trunk2)
|
|||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
// 0xCX without extended timestamp.
|
||||
EXPECT_EQ(0x00010203, msg->header.timestamp);
|
||||
EXPECT_EQ(0x00010203, msg->header_.timestamp_);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -3202,8 +3202,8 @@ VOID TEST(ProtocolStackTest, ProtocolRecvAVExtTimedeltaStream)
|
|||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
EXPECT_TRUE(msg->header.is_audio());
|
||||
EXPECT_EQ(0x00002710, msg->header.timestamp);
|
||||
EXPECT_TRUE(msg->header_.is_audio());
|
||||
EXPECT_EQ(0x00002710, msg->header_.timestamp_);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
|
|
@ -3211,8 +3211,8 @@ VOID TEST(ProtocolStackTest, ProtocolRecvAVExtTimedeltaStream)
|
|||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x00002af8, msg->header.timestamp);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x00002af8, msg->header_.timestamp_);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
|
|
@ -3220,8 +3220,8 @@ VOID TEST(ProtocolStackTest, ProtocolRecvAVExtTimedeltaStream)
|
|||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
EXPECT_TRUE(msg->header.is_audio());
|
||||
EXPECT_EQ(0x01002710, msg->header.timestamp);
|
||||
EXPECT_TRUE(msg->header_.is_audio());
|
||||
EXPECT_EQ(0x01002710, msg->header_.timestamp_);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
|
|
@ -3229,8 +3229,8 @@ VOID TEST(ProtocolStackTest, ProtocolRecvAVExtTimedeltaStream)
|
|||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x01002710, msg->header.timestamp);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x01002710, msg->header_.timestamp_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3542,8 +3542,8 @@ VOID TEST(ProtocolStackTest, ProtocolRecvAVExtTimedeltaAudio)
|
|||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
EXPECT_TRUE(msg->header.is_audio());
|
||||
EXPECT_EQ(0x00002710, msg->header.timestamp);
|
||||
EXPECT_TRUE(msg->header_.is_audio());
|
||||
EXPECT_EQ(0x00002710, msg->header_.timestamp_);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
|
|
@ -3551,8 +3551,8 @@ VOID TEST(ProtocolStackTest, ProtocolRecvAVExtTimedeltaAudio)
|
|||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
EXPECT_TRUE(msg->header.is_audio());
|
||||
EXPECT_EQ(0x01002710, msg->header.timestamp);
|
||||
EXPECT_TRUE(msg->header_.is_audio());
|
||||
EXPECT_EQ(0x01002710, msg->header_.timestamp_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3864,8 +3864,8 @@ VOID TEST(ProtocolStackTest, ProtocolRecvAVExtTimedeltaVideo)
|
|||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x00002af8, msg->header.timestamp);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x00002af8, msg->header_.timestamp_);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
|
|
@ -3873,8 +3873,8 @@ VOID TEST(ProtocolStackTest, ProtocolRecvAVExtTimedeltaVideo)
|
|||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x01002710, msg->header.timestamp);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x01002710, msg->header_.timestamp_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4206,8 +4206,8 @@ VOID TEST(ProtocolStackTest, ProtocolRecvAVExtTimedeltaVideoFmt3)
|
|||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x00002af8, msg->header.timestamp);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x00002af8, msg->header_.timestamp_);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
|
|
@ -4215,8 +4215,8 @@ VOID TEST(ProtocolStackTest, ProtocolRecvAVExtTimedeltaVideoFmt3)
|
|||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x01002710, msg->header.timestamp);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x01002710, msg->header_.timestamp_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4268,7 +4268,7 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid1BMin)
|
|||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
}
|
||||
|
||||
VOID TEST(ProtocolKbpsTest, Connections)
|
||||
|
|
@ -5956,36 +5956,36 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVVMessage)
|
|||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x10, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x10, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_audio());
|
||||
EXPECT_EQ(0x15, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_audio());
|
||||
EXPECT_EQ(0x15, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x20, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x20, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x30, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x30, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -6534,36 +6534,36 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVVFmt1)
|
|||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x10, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x10, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_audio());
|
||||
EXPECT_EQ(0x15, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_audio());
|
||||
EXPECT_EQ(0x15, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x20, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x20, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x30, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x30, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -7108,36 +7108,36 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVVFmt2)
|
|||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x10, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x10, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_audio());
|
||||
EXPECT_EQ(0x15, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_audio());
|
||||
EXPECT_EQ(0x15, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x20, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x20, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x30, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x30, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -7680,36 +7680,36 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVVFmt3)
|
|||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x10, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x10, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_audio());
|
||||
EXPECT_EQ(0x15, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_audio());
|
||||
EXPECT_EQ(0x15, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x20, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x20, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg_raw = NULL;
|
||||
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
|
||||
|
||||
EXPECT_TRUE(msg->header.is_video());
|
||||
EXPECT_EQ(0x30, msg->header.timestamp);
|
||||
EXPECT_EQ(0x01, msg->header.stream_id);
|
||||
EXPECT_TRUE(msg->header_.is_video());
|
||||
EXPECT_EQ(0x30, msg->header_.timestamp_);
|
||||
EXPECT_EQ(0x01, msg->header_.stream_id_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2346,23 +2346,23 @@ VOID TEST(KernelRTCTest, H265RtpSTAPPayload)
|
|||
// Create sample VPS NALU
|
||||
SrsNaluSample *vps = new SrsNaluSample();
|
||||
uint8_t vps_data[] = {0x40, 0x01, 0x0c, 0x01, 0xff, 0xff, 0x01, 0x60, 0x00, 0x00, 0x03, 0x00, 0x90, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x3d, 0x95, 0x98, 0x09};
|
||||
vps->bytes = (char *)vps_data;
|
||||
vps->size = sizeof(vps_data);
|
||||
stap.nalus.push_back(vps);
|
||||
vps->bytes_ = (char *)vps_data;
|
||||
vps->size_ = sizeof(vps_data);
|
||||
stap.nalus_.push_back(vps);
|
||||
|
||||
// Create sample SPS NALU
|
||||
SrsNaluSample *sps = new SrsNaluSample();
|
||||
uint8_t sps_data[] = {0x42, 0x01, 0x01, 0x01, 0x60, 0x00, 0x00, 0x03, 0x00, 0x90, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x3d, 0xa0, 0x02, 0x80, 0x80, 0x2d, 0x16, 0x59, 0x59, 0xa4, 0x93, 0x2b, 0xc0, 0x5a, 0x70, 0x80, 0x80, 0x80, 0x82};
|
||||
sps->bytes = (char *)sps_data;
|
||||
sps->size = sizeof(sps_data);
|
||||
stap.nalus.push_back(sps);
|
||||
sps->bytes_ = (char *)sps_data;
|
||||
sps->size_ = sizeof(sps_data);
|
||||
stap.nalus_.push_back(sps);
|
||||
|
||||
// Create sample PPS NALU
|
||||
SrsNaluSample *pps = new SrsNaluSample();
|
||||
uint8_t pps_data[] = {0x44, 0x01, 0xc1, 0x72, 0xb4, 0x62, 0x40};
|
||||
pps->bytes = (char *)pps_data;
|
||||
pps->size = sizeof(pps_data);
|
||||
stap.nalus.push_back(pps);
|
||||
pps->bytes_ = (char *)pps_data;
|
||||
pps->size_ = sizeof(pps_data);
|
||||
stap.nalus_.push_back(pps);
|
||||
|
||||
// Test encoding
|
||||
char buf[1500];
|
||||
|
|
@ -2380,29 +2380,29 @@ VOID TEST(KernelRTCTest, H265RtpSTAPPayload)
|
|||
HELPER_EXPECT_SUCCESS(decode_stap.decode(&decode_buf));
|
||||
|
||||
// Verify decoded NALUs
|
||||
EXPECT_EQ(3, (int)decode_stap.nalus.size());
|
||||
EXPECT_EQ(3, (int)decode_stap.nalus_.size());
|
||||
|
||||
// Check VPS
|
||||
SrsNaluSample *decoded_vps = decode_stap.get_vps();
|
||||
EXPECT_TRUE(decoded_vps != NULL);
|
||||
EXPECT_EQ(sizeof(vps_data), (size_t)decoded_vps->size);
|
||||
EXPECT_EQ(sizeof(vps_data), (size_t)decoded_vps->size_);
|
||||
|
||||
// Check SPS
|
||||
SrsNaluSample *decoded_sps = decode_stap.get_sps();
|
||||
EXPECT_TRUE(decoded_sps != NULL);
|
||||
EXPECT_EQ(sizeof(sps_data), (size_t)decoded_sps->size);
|
||||
EXPECT_EQ(sizeof(sps_data), (size_t)decoded_sps->size_);
|
||||
|
||||
// Check PPS
|
||||
SrsNaluSample *decoded_pps = decode_stap.get_pps();
|
||||
EXPECT_TRUE(decoded_pps != NULL);
|
||||
EXPECT_EQ(sizeof(pps_data), (size_t)decoded_pps->size);
|
||||
EXPECT_EQ(sizeof(pps_data), (size_t)decoded_pps->size_);
|
||||
|
||||
// Test copy functionality
|
||||
ISrsRtpPayloader *copied = stap.copy();
|
||||
SrsUniquePtr<ISrsRtpPayloader> copied_uptr(copied);
|
||||
SrsRtpSTAPPayloadHevc *copied_stap = dynamic_cast<SrsRtpSTAPPayloadHevc *>(copied);
|
||||
EXPECT_TRUE(copied_stap != NULL);
|
||||
EXPECT_EQ(3, (int)copied_stap->nalus.size());
|
||||
EXPECT_EQ(3, (int)copied_stap->nalus_.size());
|
||||
}
|
||||
|
||||
// Test SrsRtpSTAPPayloadHevc with empty NALUs
|
||||
|
|
@ -2438,16 +2438,16 @@ VOID TEST(KernelRTCTest, H265RtpFUAPayload)
|
|||
// Test SrsRtpFUAPayloadHevc encoding and decoding
|
||||
if (true) {
|
||||
SrsRtpFUAPayloadHevc fua;
|
||||
fua.start = true;
|
||||
fua.end = false;
|
||||
fua.nalu_type = SrsHevcNaluType_CODED_SLICE_IDR;
|
||||
fua.start_ = true;
|
||||
fua.end_ = false;
|
||||
fua.nalu_type_ = SrsHevcNaluType_CODED_SLICE_IDR;
|
||||
|
||||
// Create sample payload data
|
||||
SrsNaluSample *sample = new SrsNaluSample();
|
||||
uint8_t payload_data[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
|
||||
sample->bytes = (char *)payload_data;
|
||||
sample->size = sizeof(payload_data);
|
||||
fua.nalus.push_back(sample);
|
||||
sample->bytes_ = (char *)payload_data;
|
||||
sample->size_ = sizeof(payload_data);
|
||||
fua.nalus_.push_back(sample);
|
||||
|
||||
// Test encoding
|
||||
char buf[100];
|
||||
|
|
@ -2465,33 +2465,33 @@ VOID TEST(KernelRTCTest, H265RtpFUAPayload)
|
|||
HELPER_EXPECT_SUCCESS(decode_fua.decode(&decode_buf));
|
||||
|
||||
// Verify decoded values
|
||||
EXPECT_TRUE(decode_fua.start);
|
||||
EXPECT_FALSE(decode_fua.end);
|
||||
EXPECT_EQ(SrsHevcNaluType_CODED_SLICE_IDR, decode_fua.nalu_type);
|
||||
EXPECT_EQ(1, (int)decode_fua.nalus.size());
|
||||
EXPECT_EQ(sizeof(payload_data), (size_t)decode_fua.nalus[0]->size);
|
||||
EXPECT_TRUE(decode_fua.start_);
|
||||
EXPECT_FALSE(decode_fua.end_);
|
||||
EXPECT_EQ(SrsHevcNaluType_CODED_SLICE_IDR, decode_fua.nalu_type_);
|
||||
EXPECT_EQ(1, (int)decode_fua.nalus_.size());
|
||||
EXPECT_EQ(sizeof(payload_data), (size_t)decode_fua.nalus_[0]->size_);
|
||||
|
||||
// Test copy functionality
|
||||
ISrsRtpPayloader *copied = fua.copy();
|
||||
SrsUniquePtr<ISrsRtpPayloader> copied_uptr(copied);
|
||||
SrsRtpFUAPayloadHevc *copied_fua = dynamic_cast<SrsRtpFUAPayloadHevc *>(copied);
|
||||
EXPECT_TRUE(copied_fua != NULL);
|
||||
EXPECT_TRUE(copied_fua->start);
|
||||
EXPECT_FALSE(copied_fua->end);
|
||||
EXPECT_EQ(SrsHevcNaluType_CODED_SLICE_IDR, copied_fua->nalu_type);
|
||||
EXPECT_EQ(1, (int)copied_fua->nalus.size());
|
||||
EXPECT_TRUE(copied_fua->start_);
|
||||
EXPECT_FALSE(copied_fua->end_);
|
||||
EXPECT_EQ(SrsHevcNaluType_CODED_SLICE_IDR, copied_fua->nalu_type_);
|
||||
EXPECT_EQ(1, (int)copied_fua->nalus_.size());
|
||||
}
|
||||
|
||||
// Test SrsRtpFUAPayloadHevc2 encoding and decoding
|
||||
if (true) {
|
||||
SrsRtpFUAPayloadHevc2 fua2;
|
||||
fua2.start = false;
|
||||
fua2.end = true;
|
||||
fua2.nalu_type = SrsHevcNaluType_CODED_SLICE_TRAIL_R;
|
||||
fua2.start_ = false;
|
||||
fua2.end_ = true;
|
||||
fua2.nalu_type_ = SrsHevcNaluType_CODED_SLICE_TRAIL_R;
|
||||
|
||||
uint8_t payload_data[] = {0xAA, 0xBB, 0xCC, 0xDD};
|
||||
fua2.payload = (char *)payload_data;
|
||||
fua2.size = sizeof(payload_data);
|
||||
fua2.payload_ = (char *)payload_data;
|
||||
fua2.size_ = sizeof(payload_data);
|
||||
|
||||
// Test encoding
|
||||
char buf[100];
|
||||
|
|
@ -2509,20 +2509,20 @@ VOID TEST(KernelRTCTest, H265RtpFUAPayload)
|
|||
HELPER_EXPECT_SUCCESS(decode_fua2.decode(&decode_buf2));
|
||||
|
||||
// Verify decoded values
|
||||
EXPECT_FALSE(decode_fua2.start);
|
||||
EXPECT_TRUE(decode_fua2.end);
|
||||
EXPECT_EQ(SrsHevcNaluType_CODED_SLICE_TRAIL_R, decode_fua2.nalu_type);
|
||||
EXPECT_EQ(sizeof(payload_data), (size_t)decode_fua2.size);
|
||||
EXPECT_FALSE(decode_fua2.start_);
|
||||
EXPECT_TRUE(decode_fua2.end_);
|
||||
EXPECT_EQ(SrsHevcNaluType_CODED_SLICE_TRAIL_R, decode_fua2.nalu_type_);
|
||||
EXPECT_EQ(sizeof(payload_data), (size_t)decode_fua2.size_);
|
||||
|
||||
// Test copy functionality
|
||||
ISrsRtpPayloader *copied = fua2.copy();
|
||||
SrsUniquePtr<ISrsRtpPayloader> copied_uptr(copied);
|
||||
SrsRtpFUAPayloadHevc2 *copied_fua2 = dynamic_cast<SrsRtpFUAPayloadHevc2 *>(copied);
|
||||
EXPECT_TRUE(copied_fua2 != NULL);
|
||||
EXPECT_FALSE(copied_fua2->start);
|
||||
EXPECT_TRUE(copied_fua2->end);
|
||||
EXPECT_EQ(SrsHevcNaluType_CODED_SLICE_TRAIL_R, copied_fua2->nalu_type);
|
||||
EXPECT_EQ(sizeof(payload_data), (size_t)copied_fua2->size);
|
||||
EXPECT_FALSE(copied_fua2->start_);
|
||||
EXPECT_TRUE(copied_fua2->end_);
|
||||
EXPECT_EQ(SrsHevcNaluType_CODED_SLICE_TRAIL_R, copied_fua2->nalu_type_);
|
||||
EXPECT_EQ(sizeof(payload_data), (size_t)copied_fua2->size_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2531,46 +2531,46 @@ VOID TEST(KernelRTCTest, H265RtpPacketKeyframe)
|
|||
// Test RTP packet keyframe detection for HEVC
|
||||
if (true) {
|
||||
SrsRtpPacket pkt;
|
||||
pkt.frame_type = SrsFrameTypeVideo;
|
||||
pkt.frame_type_ = SrsFrameTypeVideo;
|
||||
|
||||
// Test VPS NALU (should be keyframe)
|
||||
pkt.nalu_type = SrsHevcNaluType_VPS;
|
||||
pkt.nalu_type_ = SrsHevcNaluType_VPS;
|
||||
EXPECT_TRUE(pkt.is_keyframe(SrsVideoCodecIdHEVC));
|
||||
|
||||
// Test SPS NALU (should be keyframe)
|
||||
pkt.nalu_type = SrsHevcNaluType_SPS;
|
||||
pkt.nalu_type_ = SrsHevcNaluType_SPS;
|
||||
EXPECT_TRUE(pkt.is_keyframe(SrsVideoCodecIdHEVC));
|
||||
|
||||
// Test PPS NALU (should be keyframe)
|
||||
pkt.nalu_type = SrsHevcNaluType_PPS;
|
||||
pkt.nalu_type_ = SrsHevcNaluType_PPS;
|
||||
EXPECT_TRUE(pkt.is_keyframe(SrsVideoCodecIdHEVC));
|
||||
|
||||
// Test IDR NALU (should be keyframe)
|
||||
pkt.nalu_type = SrsHevcNaluType_CODED_SLICE_IDR;
|
||||
pkt.nalu_type_ = SrsHevcNaluType_CODED_SLICE_IDR;
|
||||
EXPECT_TRUE(pkt.is_keyframe(SrsVideoCodecIdHEVC));
|
||||
|
||||
// Test CRA NALU (should be keyframe)
|
||||
pkt.nalu_type = SrsHevcNaluType_CODED_SLICE_CRA;
|
||||
pkt.nalu_type_ = SrsHevcNaluType_CODED_SLICE_CRA;
|
||||
EXPECT_TRUE(pkt.is_keyframe(SrsVideoCodecIdHEVC));
|
||||
|
||||
// Test BLA NALU (should be keyframe)
|
||||
pkt.nalu_type = SrsHevcNaluType_CODED_SLICE_BLA;
|
||||
pkt.nalu_type_ = SrsHevcNaluType_CODED_SLICE_BLA;
|
||||
EXPECT_TRUE(pkt.is_keyframe(SrsVideoCodecIdHEVC));
|
||||
|
||||
// Test regular P-frame NALU (should not be keyframe)
|
||||
pkt.nalu_type = SrsHevcNaluType_CODED_SLICE_TRAIL_R;
|
||||
pkt.nalu_type_ = SrsHevcNaluType_CODED_SLICE_TRAIL_R;
|
||||
EXPECT_FALSE(pkt.is_keyframe(SrsVideoCodecIdHEVC));
|
||||
|
||||
// Test regular B-frame NALU (should not be keyframe)
|
||||
pkt.nalu_type = SrsHevcNaluType_CODED_SLICE_TSA_N;
|
||||
pkt.nalu_type_ = SrsHevcNaluType_CODED_SLICE_TSA_N;
|
||||
EXPECT_FALSE(pkt.is_keyframe(SrsVideoCodecIdHEVC));
|
||||
}
|
||||
|
||||
// Test HEVC STAP payload keyframe detection
|
||||
if (true) {
|
||||
SrsRtpPacket pkt;
|
||||
pkt.frame_type = SrsFrameTypeVideo;
|
||||
pkt.nalu_type = kStapHevc;
|
||||
pkt.frame_type_ = SrsFrameTypeVideo;
|
||||
pkt.nalu_type_ = kStapHevc;
|
||||
|
||||
SrsRtpSTAPPayloadHevc *stap_payload = new SrsRtpSTAPPayloadHevc();
|
||||
pkt.set_payload(stap_payload, SrsRtpPacketPayloadTypeSTAPHevc);
|
||||
|
|
@ -2578,9 +2578,9 @@ VOID TEST(KernelRTCTest, H265RtpPacketKeyframe)
|
|||
// Create VPS NALU
|
||||
SrsNaluSample *vps = new SrsNaluSample();
|
||||
uint8_t vps_data[] = {0x40, 0x01}; // VPS NALU header
|
||||
vps->bytes = (char *)vps_data;
|
||||
vps->size = sizeof(vps_data);
|
||||
stap_payload->nalus.push_back(vps);
|
||||
vps->bytes_ = (char *)vps_data;
|
||||
vps->size_ = sizeof(vps_data);
|
||||
stap_payload->nalus_.push_back(vps);
|
||||
|
||||
// Should be keyframe because it contains VPS
|
||||
EXPECT_TRUE(pkt.is_keyframe(SrsVideoCodecIdHEVC));
|
||||
|
|
@ -2589,26 +2589,26 @@ VOID TEST(KernelRTCTest, H265RtpPacketKeyframe)
|
|||
// Test HEVC FU-A payload keyframe detection
|
||||
if (true) {
|
||||
SrsRtpPacket pkt;
|
||||
pkt.frame_type = SrsFrameTypeVideo;
|
||||
pkt.nalu_type = kFuHevc;
|
||||
pkt.frame_type_ = SrsFrameTypeVideo;
|
||||
pkt.nalu_type_ = kFuHevc;
|
||||
|
||||
SrsRtpFUAPayloadHevc2 *fua_payload = new SrsRtpFUAPayloadHevc2();
|
||||
pkt.set_payload(fua_payload, SrsRtpPacketPayloadTypeFUAHevc2);
|
||||
|
||||
// Test IDR slice in FU-A (should be keyframe)
|
||||
fua_payload->nalu_type = SrsHevcNaluType_CODED_SLICE_IDR;
|
||||
fua_payload->nalu_type_ = SrsHevcNaluType_CODED_SLICE_IDR;
|
||||
EXPECT_TRUE(pkt.is_keyframe(SrsVideoCodecIdHEVC));
|
||||
|
||||
// Test regular slice in FU-A (should not be keyframe)
|
||||
fua_payload->nalu_type = SrsHevcNaluType_CODED_SLICE_TRAIL_R;
|
||||
fua_payload->nalu_type_ = SrsHevcNaluType_CODED_SLICE_TRAIL_R;
|
||||
EXPECT_FALSE(pkt.is_keyframe(SrsVideoCodecIdHEVC));
|
||||
}
|
||||
|
||||
// Test audio packet (should not be keyframe regardless of NALU type)
|
||||
if (true) {
|
||||
SrsRtpPacket pkt;
|
||||
pkt.frame_type = SrsFrameTypeAudio;
|
||||
pkt.nalu_type = SrsHevcNaluType_VPS;
|
||||
pkt.frame_type_ = SrsFrameTypeAudio;
|
||||
pkt.nalu_type_ = SrsHevcNaluType_VPS;
|
||||
EXPECT_FALSE(pkt.is_keyframe(SrsVideoCodecIdHEVC));
|
||||
}
|
||||
}
|
||||
|
|
@ -2626,8 +2626,8 @@ VOID TEST(KernelRTCTest, H265RtpRawNALUsSkipBytes)
|
|||
// Create sample HEVC NALU
|
||||
SrsNaluSample *sample = new SrsNaluSample();
|
||||
uint8_t nalu_data[] = {0x26, 0x01, 0x12, 0x34, 0x56, 0x78}; // IDR slice
|
||||
sample->bytes = (char *)nalu_data;
|
||||
sample->size = sizeof(nalu_data);
|
||||
sample->bytes_ = (char *)nalu_data;
|
||||
sample->size_ = sizeof(nalu_data);
|
||||
raw_nalus.push_back(sample);
|
||||
|
||||
// Skip HEVC header (2 bytes)
|
||||
|
|
@ -2638,11 +2638,11 @@ VOID TEST(KernelRTCTest, H265RtpRawNALUsSkipBytes)
|
|||
std::vector<SrsNaluSample *> samples;
|
||||
HELPER_EXPECT_SUCCESS(raw_nalus.read_samples(samples, 4));
|
||||
EXPECT_EQ(1, (int)samples.size());
|
||||
EXPECT_EQ(4, samples[0]->size);
|
||||
EXPECT_EQ(0x12, (uint8_t)samples[0]->bytes[0]);
|
||||
EXPECT_EQ(0x34, (uint8_t)samples[0]->bytes[1]);
|
||||
EXPECT_EQ(0x56, (uint8_t)samples[0]->bytes[2]);
|
||||
EXPECT_EQ(0x78, (uint8_t)samples[0]->bytes[3]);
|
||||
EXPECT_EQ(4, samples[0]->size_);
|
||||
EXPECT_EQ(0x12, (uint8_t)samples[0]->bytes_[0]);
|
||||
EXPECT_EQ(0x34, (uint8_t)samples[0]->bytes_[1]);
|
||||
EXPECT_EQ(0x56, (uint8_t)samples[0]->bytes_[2]);
|
||||
EXPECT_EQ(0x78, (uint8_t)samples[0]->bytes_[3]);
|
||||
|
||||
// Clean up
|
||||
for (size_t i = 0; i < samples.size(); i++) {
|
||||
|
|
@ -2657,8 +2657,8 @@ VOID TEST(KernelRTCTest, H265RtpRawNALUsSkipBytes)
|
|||
// Create sample H.264 NALU
|
||||
SrsNaluSample *sample = new SrsNaluSample();
|
||||
uint8_t nalu_data[] = {0x65, 0x12, 0x34, 0x56}; // IDR slice
|
||||
sample->bytes = (char *)nalu_data;
|
||||
sample->size = sizeof(nalu_data);
|
||||
sample->bytes_ = (char *)nalu_data;
|
||||
sample->size_ = sizeof(nalu_data);
|
||||
raw_nalus.push_back(sample);
|
||||
|
||||
// Skip H.264 header (1 byte)
|
||||
|
|
@ -2669,10 +2669,10 @@ VOID TEST(KernelRTCTest, H265RtpRawNALUsSkipBytes)
|
|||
std::vector<SrsNaluSample *> samples;
|
||||
HELPER_EXPECT_SUCCESS(raw_nalus.read_samples(samples, 3));
|
||||
EXPECT_EQ(1, (int)samples.size());
|
||||
EXPECT_EQ(3, samples[0]->size);
|
||||
EXPECT_EQ(0x12, (uint8_t)samples[0]->bytes[0]);
|
||||
EXPECT_EQ(0x34, (uint8_t)samples[0]->bytes[1]);
|
||||
EXPECT_EQ(0x56, (uint8_t)samples[0]->bytes[2]);
|
||||
EXPECT_EQ(3, samples[0]->size_);
|
||||
EXPECT_EQ(0x12, (uint8_t)samples[0]->bytes_[0]);
|
||||
EXPECT_EQ(0x34, (uint8_t)samples[0]->bytes_[1]);
|
||||
EXPECT_EQ(0x56, (uint8_t)samples[0]->bytes_[2]);
|
||||
|
||||
// Clean up
|
||||
for (size_t i = 0; i < samples.size(); i++) {
|
||||
|
|
|
|||
|
|
@ -434,16 +434,16 @@ SrsRtpPacket *mock_create_test_rtp_packet(uint16_t sequence_number, uint32_t tim
|
|||
SrsRtpFUAPayload2 *mock_create_test_fua_payload(bool start, bool end, const char *payload_data, int size)
|
||||
{
|
||||
SrsRtpFUAPayload2 *fua = new SrsRtpFUAPayload2();
|
||||
fua->start = start;
|
||||
fua->end = end;
|
||||
fua->nalu_type = SrsAvcNaluTypeNonIDR; // Use a common NALU type
|
||||
fua->nri = SrsAvcNaluTypeNonIDR;
|
||||
fua->start_ = start;
|
||||
fua->end_ = end;
|
||||
fua->nalu_type_ = SrsAvcNaluTypeNonIDR; // Use a common NALU type
|
||||
fua->nri_ = SrsAvcNaluTypeNonIDR;
|
||||
|
||||
// Create a buffer for the payload
|
||||
char *buf = new char[size];
|
||||
memcpy(buf, payload_data, size);
|
||||
fua->payload = buf;
|
||||
fua->size = size;
|
||||
fua->payload_ = buf;
|
||||
fua->size_ = size;
|
||||
|
||||
return fua;
|
||||
}
|
||||
|
|
@ -1595,18 +1595,18 @@ VOID TEST(KernelRTC2Test, SrsRtcFrameBuilderPacketVideoRtmpNullPointerCrash)
|
|||
// Add some payload to ensure packets are not empty
|
||||
char payload_data[] = "test_payload_data";
|
||||
SrsRtpRawPayload *payload101 = new SrsRtpRawPayload();
|
||||
payload101->payload = (char *)payload_data;
|
||||
payload101->nn_payload = strlen(payload_data);
|
||||
payload101->payload_ = (char *)payload_data;
|
||||
payload101->nn_payload_ = strlen(payload_data);
|
||||
pkt101->set_payload(payload101, SrsRtpPacketPayloadTypeRaw);
|
||||
|
||||
SrsRtpRawPayload *payload102 = new SrsRtpRawPayload();
|
||||
payload102->payload = (char *)payload_data;
|
||||
payload102->nn_payload = strlen(payload_data);
|
||||
payload102->payload_ = (char *)payload_data;
|
||||
payload102->nn_payload_ = strlen(payload_data);
|
||||
pkt102->set_payload(payload102, SrsRtpPacketPayloadTypeRaw);
|
||||
|
||||
SrsRtpRawPayload *payload103 = new SrsRtpRawPayload();
|
||||
payload103->payload = (char *)payload_data;
|
||||
payload103->nn_payload = strlen(payload_data);
|
||||
payload103->payload_ = (char *)payload_data;
|
||||
payload103->nn_payload_ = strlen(payload_data);
|
||||
pkt103->set_payload(payload103, SrsRtpPacketPayloadTypeRaw);
|
||||
|
||||
// Set the avsync time for the packets to avoid other null pointer issues
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ SrsRtpPacket *mock_create_audio_rtp_packet(uint16_t sequence, uint32_t timestamp
|
|||
// We're not testing the downstream transcoding, just the cache reordering behavior
|
||||
|
||||
// Set frame type for audio
|
||||
pkt->frame_type = SrsFrameTypeAudio;
|
||||
pkt->frame_type_ = SrsFrameTypeAudio;
|
||||
|
||||
return pkt;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ VOID TEST(ProtocolRTMPTest, SendPacketsError)
|
|||
SrsProtocol p(&io);
|
||||
|
||||
SrsRtmpCommonMessage pkt;
|
||||
pkt.header.initialize_audio(200, 1000, 1);
|
||||
pkt.header_.initialize_audio(200, 1000, 1);
|
||||
pkt.create_payload(256);
|
||||
|
||||
SrsMediaPacket *msg = new SrsMediaPacket();
|
||||
|
|
@ -342,7 +342,7 @@ VOID TEST(ProtocolRTMPTest, HugeMessages)
|
|||
SrsProtocol p(&io);
|
||||
|
||||
SrsRtmpCommonMessage pkt;
|
||||
pkt.header.initialize_audio(200, 1000, 1);
|
||||
pkt.header_.initialize_audio(200, 1000, 1);
|
||||
pkt.create_payload(256);
|
||||
|
||||
SrsMediaPacket *msg = new SrsMediaPacket();
|
||||
|
|
@ -357,7 +357,7 @@ VOID TEST(ProtocolRTMPTest, HugeMessages)
|
|||
SrsProtocol p(&io);
|
||||
|
||||
SrsRtmpCommonMessage pkt;
|
||||
pkt.header.initialize_audio(200, 1000, 1);
|
||||
pkt.header_.initialize_audio(200, 1000, 1);
|
||||
pkt.create_payload(256);
|
||||
|
||||
SrsMediaPacket *msg = new SrsMediaPacket();
|
||||
|
|
@ -378,7 +378,7 @@ VOID TEST(ProtocolRTMPTest, HugeMessages)
|
|||
SrsProtocol p(&io);
|
||||
|
||||
SrsRtmpCommonMessage pkt;
|
||||
pkt.header.initialize_audio(200, 1000, 1);
|
||||
pkt.header_.initialize_audio(200, 1000, 1);
|
||||
pkt.create_payload(256);
|
||||
|
||||
SrsMediaPacket *msg = new SrsMediaPacket();
|
||||
|
|
@ -405,7 +405,7 @@ VOID TEST(ProtocolRTMPTest, DecodeMessages)
|
|||
|
||||
// AMF0 message with 1B should fail.
|
||||
SrsRtmpCommonMessage msg;
|
||||
msg.header.initialize_amf0_script(1, 1);
|
||||
msg.header_.initialize_amf0_script(1, 1);
|
||||
msg.create_payload(1);
|
||||
|
||||
SrsRtmpCommand *pkt;
|
||||
|
|
@ -447,7 +447,7 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages)
|
|||
SrsRtmpCommonMessage *_create_amf0(char *bytes, int size, int stream_id)
|
||||
{
|
||||
SrsRtmpCommonMessage *msg = new SrsRtmpCommonMessage();
|
||||
msg->header.initialize_amf0_script(size, stream_id);
|
||||
msg->header_.initialize_amf0_script(size, stream_id);
|
||||
msg->create_payload(size);
|
||||
memcpy(msg->payload(), bytes, size);
|
||||
return msg;
|
||||
|
|
@ -464,7 +464,7 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages2)
|
|||
uint8_t bytes[] = {0x17, 0x02, 0x00, 0x01, 's', 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0x03, 0, 0, 9};
|
||||
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
msg->header.message_type = RTMP_MSG_AMF3CommandMessage;
|
||||
msg->header_.message_type_ = RTMP_MSG_AMF3CommandMessage;
|
||||
|
||||
SrsRtmpCommand *pkt;
|
||||
HELPER_EXPECT_SUCCESS(p.decode_message(msg, &pkt));
|
||||
|
|
@ -481,7 +481,7 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages2)
|
|||
uint8_t bytes[] = {0x17, 0x02, 0x00, 0x01, 's'};
|
||||
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
msg->header.message_type = RTMP_MSG_AMF3CommandMessage;
|
||||
msg->header_.message_type_ = RTMP_MSG_AMF3CommandMessage;
|
||||
|
||||
SrsRtmpCommand *pkt;
|
||||
HELPER_EXPECT_FAILED(p.decode_message(msg, &pkt));
|
||||
|
|
@ -495,7 +495,7 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages2)
|
|||
uint8_t bytes[] = {0x00};
|
||||
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
msg->header.message_type = 0xff;
|
||||
msg->header_.message_type_ = 0xff;
|
||||
|
||||
SrsRtmpCommand *pkt;
|
||||
HELPER_EXPECT_SUCCESS(p.decode_message(msg, &pkt));
|
||||
|
|
@ -509,7 +509,7 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages2)
|
|||
uint8_t bytes[] = {0x02, 0x00, 0x01, 's'};
|
||||
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
msg->header.message_type = RTMP_MSG_AMF0DataMessage;
|
||||
msg->header_.message_type_ = RTMP_MSG_AMF0DataMessage;
|
||||
|
||||
SrsRtmpCommand *pkt;
|
||||
HELPER_EXPECT_SUCCESS(p.decode_message(msg, &pkt));
|
||||
|
|
@ -528,7 +528,7 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages3)
|
|||
uint8_t bytes[] = {0x02, 0x00, 0x07, '_', 'r', 'e', 's', 'u', 'l', 't'};
|
||||
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
msg->header.message_type = RTMP_MSG_AMF0DataMessage;
|
||||
msg->header_.message_type_ = RTMP_MSG_AMF0DataMessage;
|
||||
|
||||
SrsRtmpCommand *pkt;
|
||||
// Decode the response failed, no transaction ID was set by request.
|
||||
|
|
@ -543,7 +543,7 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages3)
|
|||
uint8_t bytes[] = {0x17, 0x02, 0x00, 0x07, '_', 'r', 'e', 's', 'u', 'l', 't'};
|
||||
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
msg->header.message_type = RTMP_MSG_AMF3DataMessage;
|
||||
msg->header_.message_type_ = RTMP_MSG_AMF3DataMessage;
|
||||
|
||||
SrsRtmpCommand *pkt;
|
||||
// Decode the response failed, no transaction ID was set by request.
|
||||
|
|
@ -558,7 +558,7 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages3)
|
|||
uint8_t bytes[] = {0x17, 0x02, 0x00, 0x07, '_', 'r', 'e', 's', 'u', 'l', 't', 0x00, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
msg->header.message_type = RTMP_MSG_AMF3CommandMessage;
|
||||
msg->header_.message_type_ = RTMP_MSG_AMF3CommandMessage;
|
||||
|
||||
SrsRtmpCommand *pkt;
|
||||
// Decode the response failed, no transaction ID was set by request.
|
||||
|
|
@ -840,7 +840,7 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages4)
|
|||
|
||||
uint8_t bytes[] = {0x02, 0x00, 3, 's', 'r', 's', 0x00, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
|
||||
msg->header.message_type = RTMP_MSG_AMF0CommandMessage;
|
||||
msg->header_.message_type_ = RTMP_MSG_AMF0CommandMessage;
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
|
||||
SrsRtmpCommand *pkt;
|
||||
|
|
@ -2776,14 +2776,14 @@ VOID TEST(ProtocolRTMPTest, CheckStreamID)
|
|||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_EXPECT_SUCCESS(p.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_EQ(1, msg->header.stream_id);
|
||||
EXPECT_EQ(1, msg->header_.stream_id_);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsRtmpCommonMessage *msg = NULL;
|
||||
HELPER_EXPECT_SUCCESS(p.recv_message(&msg));
|
||||
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
|
||||
EXPECT_EQ(2, msg->header.stream_id);
|
||||
EXPECT_EQ(2, msg->header_.stream_id_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user