Skip to content

Commit

Permalink
AUTO judge codec
Browse files Browse the repository at this point in the history
  • Loading branch information
TalusL committed Jun 19, 2024
1 parent 7585619 commit ee145ee
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/wifi/WFBReceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,6 @@ void WFBReceiver::handle80211Frame(const Packet &packet) {
static unsigned long long sendFd = INVALID_SOCKET;
static volatile bool playing = false;

#define GET_H265_NAL_UNIT_TYPE(buffer_ptr) ((buffer_ptr[0] & 0x7E) >> 1)
inline bool isH265(const uint8_t * data){
auto h265NalType = GET_H265_NAL_UNIT_TYPE(data);
return 0<=h265NalType&&40>=h265NalType;
}

#define GET_H264_NAL_UNIT_TYPE(buffer_ptr) (buffer_ptr[0] & 0x1F)
inline bool isH264(const uint8_t * data){
Expand Down Expand Up @@ -215,15 +210,10 @@ void WFBReceiver::handleRtp(uint8_t *payload, uint16_t packet_size) {
QmlNativeAPI::Instance().playerCodec = "H264";
QmlNativeAPI::Instance().PutLog("debug",
"judge Codec " + QmlNativeAPI::Instance().playerCodec.toStdString());
} else if (isH265(header->getPayloadData())) {
} else{
QmlNativeAPI::Instance().playerCodec = "H265";
QmlNativeAPI::Instance().PutLog("debug",
"judge Codec " + QmlNativeAPI::Instance().playerCodec.toStdString());
}else{
QmlNativeAPI::Instance().playerCodec = "H264";
QmlNativeAPI::Instance().PutLog("debug",
"judge Codec failed!Set codec "
+ QmlNativeAPI::Instance().playerCodec.toStdString());
}
}
QmlNativeAPI::Instance().NotifyRtpStream(header->pt, ntohl(header->ssrc));
Expand Down

0 comments on commit ee145ee

Please sign in to comment.