Skip to content

Commit ce6b3ab

Browse files
author
Isaac Connor
committed
Add last flag
1 parent 24e6b71 commit ce6b3ab

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/xop/H264Source.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ bool H264Source::HandleFrame(MediaChannelId channel_id, AVFrame frame)
107107
rtp_pkt.type = frame.type;
108108
rtp_pkt.timestamp = frame.timestamp;
109109
rtp_pkt.size = frame_size + RTP_TCP_HEAD_SIZE + RTP_HEADER_SIZE;
110-
rtp_pkt.last = 1;
110+
rtp_pkt.last = frame.last; // Use caller-provided value for RTP marker bit
111111
memcpy(rtp_pkt.data.get()+RTP_TCP_HEAD_SIZE+RTP_HEADER_SIZE, frame_buf, frame_size);
112112

113113
if (send_frame_callback_) {

src/xop/H265Source.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ bool H265Source::HandleFrame(MediaChannelId channelId, AVFrame frame)
102102
rtp_pkt.type = frame.type;
103103
rtp_pkt.timestamp = frame.timestamp;
104104
rtp_pkt.size = frame_size + RTP_TCP_HEAD_SIZE + RTP_HEADER_SIZE;
105-
rtp_pkt.last = 1;
105+
rtp_pkt.last = frame.last; // Use caller-provided value for RTP marker bit
106106

107107
memcpy(rtp_pkt.data.get()+RTP_TCP_HEAD_SIZE+RTP_HEADER_SIZE, frame_buf, frame_size);
108108

src/xop/media.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ enum FrameType
3232

3333
struct AVFrame
3434
{
35-
AVFrame() : type(0), timestamp(0) {}
35+
AVFrame() : type(0), timestamp(0), last(1) {}
3636
AVFrame(const uint8_t *data, std::size_t size) : AVFrame()
3737
{
3838
buffer.reserve(size);
@@ -42,6 +42,7 @@ struct AVFrame
4242
std::vector<uint8_t> buffer; /* 帧数据 */
4343
uint8_t type; /* 帧类型 */
4444
int64_t timestamp; /* 时间戳 */
45+
uint8_t last; /* RTP marker bit (1=last packet of frame) */
4546
};
4647

4748
static const int MAX_MEDIA_CHANNEL = 2;

0 commit comments

Comments
 (0)