Skip to content

Commit

Permalink
Revert "Add support for slice segments" (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorxda authored Mar 15, 2024
1 parent e683263 commit 69186c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
6 changes: 0 additions & 6 deletions include/smolrtsp/nal_transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ typedef struct {
* The maximum size of an H.265 NAL unit (including the header).
*/
size_t max_h265_nalu_size;

/**
* The encoder uses slice segments.
*/
bool is_coded_slice;
} SmolRTSP_NalTransportConfig;

/**
Expand All @@ -56,7 +51,6 @@ typedef struct {
*
* - `max_h264_nalu_size` is #SMOLRTSP_MAX_H264_NALU_SIZE.
* - `max_h265_nalu_size` is #SMOLRTSP_MAX_H265_NALU_SIZE.
* - `is_coded_slice` is `false`.
*/
SmolRTSP_NalTransportConfig
SmolRTSP_NalTransportConfig_default(void) SMOLRTSP_PRIV_MUST_USE;
Expand Down
10 changes: 4 additions & 6 deletions src/nal_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

static int send_fragmentized_nal_data(
SmolRTSP_RtpTransport *t, SmolRTSP_RtpTimestamp ts, size_t max_packet_size,
SmolRTSP_NalUnit nalu, bool is_coded_slice);
SmolRTSP_NalUnit nalu);
static int send_fu(
SmolRTSP_RtpTransport *t, SmolRTSP_RtpTimestamp ts, SmolRTSP_NalUnit fu,
bool is_first_fragment, bool is_last_fragment);
Expand All @@ -19,7 +19,6 @@ SmolRTSP_NalTransportConfig SmolRTSP_NalTransportConfig_default(void) {
return (SmolRTSP_NalTransportConfig){
.max_h264_nalu_size = SMOLRTSP_MAX_H264_NALU_SIZE,
.max_h265_nalu_size = SMOLRTSP_MAX_H265_NALU_SIZE,
.is_coded_slice = false,
};
}

Expand Down Expand Up @@ -89,15 +88,14 @@ int SmolRTSP_NalTransport_send_packet(
}

return send_fragmentized_nal_data(
self->transport, ts, max_packet_size, nalu,
self->config.is_coded_slice);
self->transport, ts, max_packet_size, nalu);
}

// See <https://tools.ietf.org/html/rfc6184#section-5.8> (H.264),
// <https://tools.ietf.org/html/rfc7798#section-4.4.3> (H.265).
static int send_fragmentized_nal_data(
SmolRTSP_RtpTransport *t, SmolRTSP_RtpTimestamp ts, size_t max_packet_size,
SmolRTSP_NalUnit nalu, bool is_coded_slice) {
SmolRTSP_NalUnit nalu) {
const size_t rem = nalu.payload.len % max_packet_size,
packets_count = (nalu.payload.len - rem) / max_packet_size;

Expand All @@ -122,7 +120,7 @@ static int send_fragmentized_nal_data(
U8Slice99_advance(nalu.payload, packets_count * max_packet_size);
const SmolRTSP_NalUnit fu = {nalu.header, fu_data};
const bool is_first_fragment = 0 == packets_count,
is_last_fragment = !is_coded_slice;
is_last_fragment = true;

if (send_fu(t, ts, fu, is_first_fragment, is_last_fragment) == -1) {
return -1;
Expand Down

0 comments on commit 69186c9

Please sign in to comment.