H.264 std: simplified a bit

Note that RTCP SR are now send slightly in a different way - previously
the timestamp used was T-1.
This commit is contained in:
Martin Pulec
2018-11-23 16:07:16 +01:00
parent 2b8d1cb08c
commit baf069b7c5
2 changed files with 9 additions and 32 deletions

View File

@@ -948,11 +948,13 @@ void audio_tx_send_standard(struct tx* tx, struct rtp *rtp_session,
/**
* H.264 standard transmission
*/
static void tx_send_base_h264(struct tx *tx, struct video_frame *frame,
struct rtp *rtp_session, uint32_t ts, int send_m, codec_t color_spec,
double input_fps, enum interlacing_t interlacing,
unsigned int substream, int fragment_offset) {
struct tile *tile = &frame->tiles[substream];
void tx_send_h264(struct tx *tx, struct video_frame *frame,
struct rtp *rtp_session) {
assert(frame->tile_count == 1); // std transmit doesn't handle more than one tile
assert(!frame->fragment || tx->fec_scheme == FEC_NONE); // currently no support for FEC with fragments
assert(!frame->fragment || frame->tile_count); // multiple tiles are not currently supported for fragmented send
uint32_t ts = get_std_video_local_mediatime();
struct tile *tile = &frame->tiles[0];
char pt = RTPENC_H264_PT;
unsigned char hdr[2];
@@ -1056,30 +1058,6 @@ static void tx_send_base_h264(struct tx *tx, struct video_frame *frame,
}
}
/*
* sends one or more frames (tiles) with same TS in one RTP stream. Only one m-bit is set.
*/
void tx_send_h264(struct tx *tx, struct video_frame *frame,
struct rtp *rtp_session) {
struct timeval curr_time;
static uint32_t ts_prev = 0;
uint32_t ts = 0;
assert(frame->tile_count == 1); // std transmit doesn't handle more than one tile
assert(!frame->fragment || tx->fec_scheme == FEC_NONE); // currently no support for FEC with fragments
assert(!frame->fragment || frame->tile_count); // multiple tiles are not currently supported for fragmented send
ts = get_std_video_local_mediatime();
gettimeofday(&curr_time, NULL);
rtp_send_ctrl(rtp_session, ts_prev, 0, curr_time); //send RTCP SR
ts_prev = ts;
tx_send_base_h264(tx, frame, rtp_session, ts, 0,
frame->color_spec, frame->fps, frame->interlacing, 0,
0);
}
void tx_send_jpeg(struct tx *tx, struct video_frame *frame,
struct rtp *rtp_session) {
uint32_t ts = 0;

View File

@@ -54,6 +54,7 @@
#include "rtp/rtp_callback.h" // PCMA/PCMU packet types
#include "rtp/rtpenc_h264.h"
#include "transmit.h"
#include "tv.h"
#include "utils/sdp.h"
#include "video.h"
#include "video_rxtx.h"
@@ -151,9 +152,7 @@ void h264_sdp_video_rxtx::send_frame(shared_ptr<video_frame> tx_frame)
}
if ((m_rxtx_mode & MODE_RECEIVER) == 0) { // send RTCP (receiver thread would otherwise do this
struct timeval curr_time;
uint32_t ts;
gettimeofday(&curr_time, NULL);
ts = std::chrono::duration_cast<std::chrono::duration<double>>(m_start_time - std::chrono::steady_clock::now()).count() * 90000;
uint32_t ts = get_std_video_local_mediatime();
rtp_update(m_network_devices[0], curr_time);
rtp_send_ctrl(m_network_devices[0], ts, 0, curr_time);