1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Squash: Merge SRS 4.0

This commit is contained in:
winlin 2021-10-10 12:05:26 +08:00
parent 6c597facfb
commit a81aa2edc5
65 changed files with 276 additions and 5990 deletions

View file

@ -1078,10 +1078,57 @@ srs_error_t SrsFormat::avc_demux_sps_rbsp(char* rbsp, int nb_rbsp)
if ((err = srs_avc_nalu_read_uev(&bs, pic_height_in_map_units_minus1)) != srs_success) {
return srs_error_wrap(err, "read pic_height_in_map_units_minus1");;
}
vcodec->width = (int)(pic_width_in_mbs_minus1 + 1) * 16;
vcodec->height = (int)(pic_height_in_map_units_minus1 + 1) * 16;
int8_t frame_mbs_only_flag = -1;
if ((err = srs_avc_nalu_read_bit(&bs, frame_mbs_only_flag)) != srs_success) {
return srs_error_wrap(err, "read frame_mbs_only_flag");;
}
if(!frame_mbs_only_flag) {
/* Skip mb_adaptive_frame_field_flag */
int8_t mb_adaptive_frame_field_flag = -1;
if ((err = srs_avc_nalu_read_bit(&bs, mb_adaptive_frame_field_flag)) != srs_success) {
return srs_error_wrap(err, "read mb_adaptive_frame_field_flag");;
}
}
/* Skip direct_8x8_inference_flag */
int8_t direct_8x8_inference_flag = -1;
if ((err = srs_avc_nalu_read_bit(&bs, direct_8x8_inference_flag)) != srs_success) {
return srs_error_wrap(err, "read direct_8x8_inference_flag");;
}
/* We need the following value to evaluate offsets, if any */
int8_t frame_cropping_flag = -1;
if ((err = srs_avc_nalu_read_bit(&bs, frame_cropping_flag)) != srs_success) {
return srs_error_wrap(err, "read frame_cropping_flag");;
}
int32_t frame_crop_left_offset = 0, frame_crop_right_offset = 0,
frame_crop_top_offset = 0, frame_crop_bottom_offset = 0;
if(frame_cropping_flag) {
if ((err = srs_avc_nalu_read_uev(&bs, frame_crop_left_offset)) != srs_success) {
return srs_error_wrap(err, "read frame_crop_left_offset");;
}
if ((err = srs_avc_nalu_read_uev(&bs, frame_crop_right_offset)) != srs_success) {
return srs_error_wrap(err, "read frame_crop_right_offset");;
}
if ((err = srs_avc_nalu_read_uev(&bs, frame_crop_top_offset)) != srs_success) {
return srs_error_wrap(err, "read frame_crop_top_offset");;
}
if ((err = srs_avc_nalu_read_uev(&bs, frame_crop_bottom_offset)) != srs_success) {
return srs_error_wrap(err, "read frame_crop_bottom_offset");;
}
}
/* Skip vui_parameters_present_flag */
int8_t vui_parameters_present_flag = -1;
if ((err = srs_avc_nalu_read_bit(&bs, vui_parameters_present_flag)) != srs_success) {
return srs_error_wrap(err, "read vui_parameters_present_flag");;
}
vcodec->width = ((pic_width_in_mbs_minus1 + 1) * 16) - frame_crop_left_offset * 2 - frame_crop_right_offset * 2;
vcodec->height = ((2 - frame_mbs_only_flag) * (pic_height_in_map_units_minus1 + 1) * 16) \
- (frame_crop_top_offset * 2) - (frame_crop_bottom_offset * 2);
return err;
}

View file

@ -6,7 +6,6 @@
#include <srs_kernel_mp3.hpp>
// for srs-librtmp, @see https://github.com/ossrs/srs/issues/213
#ifndef _WIN32
#include <unistd.h>
#endif

View file

@ -6,7 +6,6 @@
#include <srs_kernel_utility.hpp>
// for srs-librtmp, @see https://github.com/ossrs/srs/issues/213
#ifndef _WIN32
#include <unistd.h>
#include <netdb.h>
@ -120,7 +119,6 @@ srs_utime_t srs_update_system_time()
return -1;
}
// @see: https://github.com/ossrs/srs/issues/35
// we must convert the tv_sec/tv_usec to int64_t.
int64_t now_us = ((int64_t)now.tv_sec) * 1000 * 1000 + (int64_t)now.tv_usec;
@ -140,7 +138,6 @@ srs_utime_t srs_update_system_time()
diff = srs_max(0, diff);
if (diff < 0 || diff > 1000 * SYS_TIME_RESOLUTION_US) {
srs_warn("clock jump, history=%" PRId64 "us, now=%" PRId64 "us, diff=%" PRId64 "us", _srs_system_time_us_cache, now_us, diff);
// @see: https://github.com/ossrs/srs/issues/109
_srs_system_time_startup_time += diff;
}
@ -580,7 +577,6 @@ int srs_do_create_dir_recursively(string dir)
}
// create curren dir.
// for srs-librtmp, @see https://github.com/ossrs/srs/issues/213
#ifdef _WIN32
if (::_mkdir(dir.c_str()) < 0) {
#else