mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-29 14:45:55 +08:00
精简代码
This commit is contained in:
parent
4b0d0efdfb
commit
9217a5dbcd
@ -146,8 +146,7 @@ bool H264Track::ready() {
|
|||||||
|
|
||||||
void H264Track::inputFrame(const Frame::Ptr &frame) {
|
void H264Track::inputFrame(const Frame::Ptr &frame) {
|
||||||
using H264FrameInternal = FrameInternal<H264FrameNoCacheAble>;
|
using H264FrameInternal = FrameInternal<H264FrameNoCacheAble>;
|
||||||
|
int type = H264_TYPE( frame->data()[frame->prefixSize()]);
|
||||||
int type = H264_TYPE(*((uint8_t *) frame->data() + frame->prefixSize()));
|
|
||||||
if (type != H264Frame::NAL_B_P && type != H264Frame::NAL_IDR) {
|
if (type != H264Frame::NAL_B_P && type != H264Frame::NAL_IDR) {
|
||||||
//非I/B/P帧情况下,split一下,防止多个帧粘合在一起
|
//非I/B/P帧情况下,split一下,防止多个帧粘合在一起
|
||||||
splitH264(frame->data(), frame->size(), frame->prefixSize(), [&](const char *ptr, size_t len, size_t prefix) {
|
splitH264(frame->data(), frame->size(), frame->prefixSize(), [&](const char *ptr, size_t len, size_t prefix) {
|
||||||
@ -171,7 +170,7 @@ Track::Ptr H264Track::clone() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void H264Track::inputFrame_l(const Frame::Ptr &frame){
|
void H264Track::inputFrame_l(const Frame::Ptr &frame){
|
||||||
int type = H264_TYPE(*((uint8_t *) frame->data() + frame->prefixSize()));
|
int type = H264_TYPE( frame->data()[frame->prefixSize()]);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case H264Frame::NAL_SPS: {
|
case H264Frame::NAL_SPS: {
|
||||||
_sps = string(frame->data() + frame->prefixSize(), frame->size() - frame->prefixSize());
|
_sps = string(frame->data() + frame->prefixSize(), frame->size() - frame->prefixSize());
|
||||||
|
@ -91,8 +91,7 @@ bool H265Track::ready() {
|
|||||||
|
|
||||||
void H265Track::inputFrame(const Frame::Ptr &frame) {
|
void H265Track::inputFrame(const Frame::Ptr &frame) {
|
||||||
using H265FrameInternal = FrameInternal<H265FrameNoCacheAble>;
|
using H265FrameInternal = FrameInternal<H265FrameNoCacheAble>;
|
||||||
|
int type = H265_TYPE( frame->data()[frame->prefixSize()]);
|
||||||
int type = H265_TYPE(*((uint8_t *) frame->data() + frame->prefixSize()));
|
|
||||||
if (frame->configFrame() || type == H265Frame::NAL_SEI_PREFIX) {
|
if (frame->configFrame() || type == H265Frame::NAL_SEI_PREFIX) {
|
||||||
splitH264(frame->data(), frame->size(), frame->prefixSize(), [&](const char *ptr, size_t len, size_t prefix) {
|
splitH264(frame->data(), frame->size(), frame->prefixSize(), [&](const char *ptr, size_t len, size_t prefix) {
|
||||||
H265FrameInternal::Ptr sub_frame = std::make_shared<H265FrameInternal>(frame, (char *) ptr, len, prefix);
|
H265FrameInternal::Ptr sub_frame = std::make_shared<H265FrameInternal>(frame, (char *) ptr, len, prefix);
|
||||||
@ -113,7 +112,7 @@ void H265Track::inputFrame_l(const Frame::Ptr &frame) {
|
|||||||
|
|
||||||
_is_idr = false;
|
_is_idr = false;
|
||||||
//非idr帧
|
//非idr帧
|
||||||
switch (H265_TYPE(((uint8_t *) frame->data() + frame->prefixSize())[0])) {
|
switch (H265_TYPE( frame->data()[frame->prefixSize()])) {
|
||||||
case H265Frame::NAL_VPS: {
|
case H265Frame::NAL_VPS: {
|
||||||
_vps = string(frame->data() + frame->prefixSize(), frame->size() - frame->prefixSize());
|
_vps = string(frame->data() + frame->prefixSize(), frame->size() - frame->prefixSize());
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user