summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandrew-elder <aelder@audioscience.com>2015-09-23 12:53:43 -0400
committerandrew-elder <aelder@audioscience.com>2015-09-23 12:53:43 -0400
commit639149eb1f552ac39a41b3846f604ade04cac9ec (patch)
tree953335277086178f883d19a8b42d14d296f2c37e
parentb9e3f66732d384fbd347908f5b484a3aa83c91c8 (diff)
parent03ff88577a6559f27b70a8729c0c494619406192 (diff)
downloadOpen-AVB-639149eb1f552ac39a41b3846f604ade04cac9ec.tar.gz
Merge pull request #293 from MarcinMiklasSTC/feature-avtp-pipeline
AVTP pipeline is using gptplocaltime() function
-rw-r--r--daemons/gptp/linux/src/ipcdef.hpp2
-rw-r--r--daemons/gptp/windows/daemon_cl/ipcdef.hpp2
-rw-r--r--examples/common/avb.c28
-rw-r--r--examples/common/avb.h10
-rwxr-xr-xexamples/jackd-talker/jackd_talker.c14
-rw-r--r--examples/simple_talker/simple_talker.c12
-rw-r--r--lib/avtp_pipeline/avtp_pipeline.mk7
-rw-r--r--lib/avtp_pipeline/include/openavb_types_base_pub.h2
-rw-r--r--lib/avtp_pipeline/intf_viewer/latency_listener.ini2
-rw-r--r--lib/avtp_pipeline/map_mpeg2ts/demo_listener.ini2
-rw-r--r--lib/avtp_pipeline/openavb_common/avb.c24
-rw-r--r--lib/avtp_pipeline/openavb_common/avb.h16
-rw-r--r--lib/avtp_pipeline/platform/Linux/avb_host/openavb_harness.c2
-rw-r--r--lib/avtp_pipeline/platform/Linux/avb_host/openavb_host.c2
-rw-r--r--lib/avtp_pipeline/platform/Linux/intf_alsa/aaf_listener.ini2
-rw-r--r--lib/avtp_pipeline/platform/Linux/intf_alsa/aaf_listener_auto.ini2
-rw-r--r--lib/avtp_pipeline/platform/Linux/intf_alsa/alsa_listener.ini2
-rw-r--r--lib/avtp_pipeline/platform/Linux/intf_alsa/alsa_talker.ini2
-rw-r--r--lib/avtp_pipeline/platform/Linux/intf_h264_gst/h264_gst_listener.ini9
-rw-r--r--lib/avtp_pipeline/platform/Linux/intf_h264_gst/h264_gst_talker.ini4
-rw-r--r--lib/avtp_pipeline/platform/Linux/intf_h264_gst/openavb_intf_h264_gst.c2
-rw-r--r--lib/avtp_pipeline/platform/Linux/intf_mjpeg_gst/mjpeg_gst_listener.ini2
-rw-r--r--lib/avtp_pipeline/platform/Linux/intf_mjpeg_gst/mjpeg_gst_talker.ini2
-rw-r--r--lib/avtp_pipeline/platform/Linux/intf_mpeg2ts_gst/mpeg2ts_gst_listener.ini4
-rw-r--r--lib/avtp_pipeline/platform/Linux/intf_wav_file/wav_file_listener.ini2
-rw-r--r--lib/avtp_pipeline/platform/Linux/openavb_time_osal.c13
-rw-r--r--lib/avtp_pipeline/platform/Linux/rawsock/igb_rawsock.c14
-rw-r--r--lib/avtp_pipeline/platform/Linux/rawsock/igb_rawsock.h1
-rw-r--r--lib/avtp_pipeline/platform/x86_i210/openavb_ether_hal.c34
-rw-r--r--lib/avtp_pipeline/platform/x86_i210/openavb_ether_hal.h3
-rw-r--r--lib/avtp_pipeline/tl/openavb_talker.c2
31 files changed, 163 insertions, 62 deletions
diff --git a/daemons/gptp/linux/src/ipcdef.hpp b/daemons/gptp/linux/src/ipcdef.hpp
index 3c4ac676..98787888 100644
--- a/daemons/gptp/linux/src/ipcdef.hpp
+++ b/daemons/gptp/linux/src/ipcdef.hpp
@@ -47,7 +47,7 @@ typedef struct {
int64_t ls_phoffset; //!< Local to system phase offset
FrequencyRatio ml_freqoffset; //!< Master to local frequency offset
FrequencyRatio ls_freqoffset; //!< Local to system frequency offset
- int64_t local_time; //!< Local time of last update
+ uint64_t local_time; //!< Local time of last update
uint32_t sync_count; //!< Sync messages count
uint32_t pdelay_count; //!< pdelay messages count
PortState port_state; //!< gPTP port state. It can assume values defined at ::PortState
diff --git a/daemons/gptp/windows/daemon_cl/ipcdef.hpp b/daemons/gptp/windows/daemon_cl/ipcdef.hpp
index 87b3fec8..7193fec0 100644
--- a/daemons/gptp/windows/daemon_cl/ipcdef.hpp
+++ b/daemons/gptp/windows/daemon_cl/ipcdef.hpp
@@ -53,7 +53,7 @@ typedef struct {
int64_t ls_phoffset;
FrequencyRatio ml_freqoffset;
FrequencyRatio ls_freqoffset;
- int64_t local_time;
+ uint64_t local_time;
uint32_t sync_count;
uint32_t pdelay_count;
PortState port_state;
diff --git a/examples/common/avb.c b/examples/common/avb.c
index fb056149..8f7e0903 100644
--- a/examples/common/avb.c
+++ b/examples/common/avb.c
@@ -129,14 +129,38 @@ int gptpscaling(gPtpTimeData * td, char *memory_offset_buffer)
memcpy(td, memory_offset_buffer + sizeof(pthread_mutex_t), sizeof(*td));
pthread_mutex_unlock((pthread_mutex_t *) memory_offset_buffer);
- fprintf(stderr, "ml_phoffset = %lld, ls_phoffset = %lld\n",
+ fprintf(stderr, "ml_phoffset = %" PRId64 ", ls_phoffset = %" PRId64 "\n",
td->ml_phoffset, td->ls_phoffset);
- fprintf(stderr, "ml_freqffset = %d, ls_freqoffset = %d\n",
+ fprintf(stderr, "ml_freqffset = %Lf, ls_freqoffset = %Lf\n",
td->ml_freqoffset, td->ls_freqoffset);
return true;
}
+bool gptplocaltime(const gPtpTimeData * td, uint64_t* now_local)
+{
+ struct timespec sys_time;
+ uint64_t now_system;
+ uint64_t system_time;
+ int64_t delta_local;
+ int64_t delta_system;
+
+ if (!td || !now_local)
+ return false;
+
+ if (clock_gettime(CLOCK_REALTIME, &sys_time) != 0)
+ return false;
+
+ now_system = (uint64_t)sys_time.tv_sec * 1000000000ULL + (uint64_t)sys_time.tv_nsec;
+
+ system_time = td->local_time + td->ls_phoffset;
+ delta_system = now_system - system_time;
+ delta_local = td->ls_freqoffset * delta_system;
+ *now_local = td->local_time + delta_local;
+
+ return true;
+}
+
/* setters & getters for seventeen22_header */
void avb_set_1722_cd_indicator(seventeen22_header *h1722, uint64_t cd_indicator)
{
diff --git a/examples/common/avb.h b/examples/common/avb.h
index 07c938e6..3cb77abb 100644
--- a/examples/common/avb.h
+++ b/examples/common/avb.h
@@ -98,12 +98,14 @@ typedef struct __attribute__ ((packed)) {
uint8_t h_protocol[2];
} eth_header;
+typedef long double FrequencyRatio;
+
typedef struct {
int64_t ml_phoffset;
int64_t ls_phoffset;
- int32_t ml_freqoffset;
- int32_t ls_freqoffset;
- int64_t local_time;
+ FrequencyRatio ml_freqoffset;
+ FrequencyRatio ls_freqoffset;
+ uint64_t local_time;
} gPtpTimeData;
typedef enum { false = 0, true = 1 } bool;
@@ -112,6 +114,8 @@ int pci_connect(device_t * igb_dev);
int gptpscaling(gPtpTimeData * td, char *memory_offset_buffer);
+bool gptplocaltime(const gPtpTimeData * td, uint64_t* now_local);
+
void gptpdeinit(int shm_fd, char *memory_offset_buffer);
int gptpinit(int *shm_fd, char **memory_offset_buffer);
diff --git a/examples/jackd-talker/jackd_talker.c b/examples/jackd-talker/jackd_talker.c
index 63041b2c..11005fc7 100755
--- a/examples/jackd-talker/jackd_talker.c
+++ b/examples/jackd-talker/jackd_talker.c
@@ -65,12 +65,14 @@
#define PACKET_IPG (125000) /* (1) packet every 125 usec */
#define PKT_SZ (100)
-typedef struct {
- int64_t ml_phoffset;
- int64_t ls_phoffset;
- long double ml_freqoffset;
- long double ls_freqoffset;
- int64_t local_time;
+typedef long double FrequencyRatio;
+
+typedef struct {
+ int64_t ml_phoffset;
+ int64_t ls_phoffset;
+ FrequencyRatio ml_freqoffset;
+ FrequencyRatio ls_freqoffset;
+ uint64_t local_time;
} gPtpTimeData;
typedef struct __attribute__ ((packed)) {
diff --git a/examples/simple_talker/simple_talker.c b/examples/simple_talker/simple_talker.c
index 573af26e..e66e8c52 100644
--- a/examples/simple_talker/simple_talker.c
+++ b/examples/simple_talker/simple_talker.c
@@ -72,12 +72,14 @@
#define L4_PORT ((uint16_t)5004)
#define PKT_SZ (100)
+typedef long double FrequencyRatio;
+
typedef struct {
- int64_t ml_phoffset;
- int64_t ls_phoffset;
- long double ml_freqoffset;
- long double ls_freqoffset;
- uint64_t local_time;
+ int64_t ml_phoffset;
+ int64_t ls_phoffset;
+ FrequencyRatio ml_freqoffset;
+ FrequencyRatio ls_freqoffset;
+ uint64_t local_time;
} gPtpTimeData;
typedef struct __attribute__ ((packed)) {
diff --git a/lib/avtp_pipeline/avtp_pipeline.mk b/lib/avtp_pipeline/avtp_pipeline.mk
index 9c0d7d47..c0acdb69 100644
--- a/lib/avtp_pipeline/avtp_pipeline.mk
+++ b/lib/avtp_pipeline/avtp_pipeline.mk
@@ -1,3 +1,5 @@
+AVB_FEATURE_ENDPOINT ?= 1
+
.PHONY: all clean
all: build/Makefile
@@ -9,5 +11,6 @@ clean:
build/Makefile:
mkdir -p build && \
cd build && \
- cmake -DCMAKE_TOOLCHAIN_FILE=../platform/Linux/x86_i210_linux.cmake -DAVB_FEATURE_ENDPOINT=1 ..
-
+ cmake -DCMAKE_TOOLCHAIN_FILE=../platform/Linux/x86_i210_linux.cmake \
+ -DAVB_FEATURE_ENDPOINT=$(AVB_FEATURE_ENDPOINT) \
+ ..
diff --git a/lib/avtp_pipeline/include/openavb_types_base_pub.h b/lib/avtp_pipeline/include/openavb_types_base_pub.h
index 0e64206e..f568477a 100644
--- a/lib/avtp_pipeline/include/openavb_types_base_pub.h
+++ b/lib/avtp_pipeline/include/openavb_types_base_pub.h
@@ -37,7 +37,7 @@ https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175.
#include "openavb_types_base_tcal_pub.h"
#include <stdbool.h>
-#include <stdint.h>
+#include <inttypes.h>
/** \file
* Common Base AVB Types that are exposed outside of the AVB
diff --git a/lib/avtp_pipeline/intf_viewer/latency_listener.ini b/lib/avtp_pipeline/intf_viewer/latency_listener.ini
index 7f83632c..b85d4e18 100644
--- a/lib/avtp_pipeline/intf_viewer/latency_listener.ini
+++ b/lib/avtp_pipeline/intf_viewer/latency_listener.ini
@@ -121,6 +121,6 @@ intf_nv_raw_offset = 0
intf_nv_raw_length = 0
# intf_nv_ignore_timestamp: If set the listener will ignore the timestamp on media queue items.
-intf_nv_ignore_timestamp = 1
+# intf_nv_ignore_timestamp = 1
diff --git a/lib/avtp_pipeline/map_mpeg2ts/demo_listener.ini b/lib/avtp_pipeline/map_mpeg2ts/demo_listener.ini
index 1f37d535..f48dbba4 100644
--- a/lib/avtp_pipeline/map_mpeg2ts/demo_listener.ini
+++ b/lib/avtp_pipeline/map_mpeg2ts/demo_listener.ini
@@ -86,4 +86,4 @@ intf_fn = openavbIntfMpeg2tsFileInitialize
#intf_nv_file_name = listener.ts
# intf_nv_ignore_timestamp: If set the listener will ignore the timestamp on media queue items.
-intf_nv_ignore_timestamp = 1
+# intf_nv_ignore_timestamp = 1
diff --git a/lib/avtp_pipeline/openavb_common/avb.c b/lib/avtp_pipeline/openavb_common/avb.c
index f27a2b24..6265858b 100644
--- a/lib/avtp_pipeline/openavb_common/avb.c
+++ b/lib/avtp_pipeline/openavb_common/avb.c
@@ -135,6 +135,30 @@ int gptpscaling(gPtpTimeData * td, char *memory_offset_buffer)
return true;
}
+bool gptplocaltime(const gPtpTimeData * td, uint64_t* now_local)
+{
+ struct timespec sys_time;
+ uint64_t now_system;
+ uint64_t system_time;
+ int64_t delta_local;
+ int64_t delta_system;
+
+ if (!td || !now_local)
+ return false;
+
+ if (clock_gettime(CLOCK_REALTIME, &sys_time) != 0)
+ return false;
+
+ now_system = (uint64_t)sys_time.tv_sec * 1000000000ULL + (uint64_t)sys_time.tv_nsec;
+
+ system_time = td->local_time + td->ls_phoffset;
+ delta_system = now_system - system_time;
+ delta_local = td->ls_freqoffset * delta_system;
+ *now_local = td->local_time + delta_local;
+
+ return true;
+}
+
/* setters & getters for seventeen22_header */
void avb_set_1722_cd_indicator(seventeen22_header *h1722, uint64_t cd_indicator)
{
diff --git a/lib/avtp_pipeline/openavb_common/avb.h b/lib/avtp_pipeline/openavb_common/avb.h
index 019c9d65..a592290b 100644
--- a/lib/avtp_pipeline/openavb_common/avb.h
+++ b/lib/avtp_pipeline/openavb_common/avb.h
@@ -98,12 +98,14 @@ typedef struct __attribute__ ((packed)) {
uint8_t h_protocol[2];
} eth_header;
-typedef struct {
- int64_t ml_phoffset;
- int64_t ls_phoffset;
- long double ml_freqoffset;
- long double ls_freqoffset;
- uint64_t local_time;
+typedef long double FrequencyRatio;
+
+typedef struct {
+ int64_t ml_phoffset;
+ int64_t ls_phoffset;
+ FrequencyRatio ml_freqoffset;
+ FrequencyRatio ls_freqoffset;
+ uint64_t local_time;
} gPtpTimeData;
#ifndef false
@@ -114,6 +116,8 @@ int pci_connect(device_t * igb_dev);
int gptpscaling(gPtpTimeData * td, char *memory_offset_buffer);
+bool gptplocaltime(const gPtpTimeData * td, uint64_t* now_local);
+
void gptpdeinit(int shm_fd, char *memory_offset_buffer);
int gptpinit(int *shm_fd, char **memory_offset_buffer);
diff --git a/lib/avtp_pipeline/platform/Linux/avb_host/openavb_harness.c b/lib/avtp_pipeline/platform/Linux/avb_host/openavb_harness.c
index e0533f28..c999e628 100644
--- a/lib/avtp_pipeline/platform/Linux/avb_host/openavb_harness.c
+++ b/lib/avtp_pipeline/platform/Linux/avb_host/openavb_harness.c
@@ -199,7 +199,7 @@ int main(int argc, char *argv[])
//registerStaticIntfModule(openavbIntfToneGenInitialize);
registerStaticIntfModule(openavbIntfViewerInitialize);
registerStaticIntfModule(openavbIntfAlsaInitialize);
- //registerStaticIntfModule(openavbIntfMjpegGstInitialize); // TODO_OPENAVB : Not sure why MJPEG is having an issue linking GST RTP
+ registerStaticIntfModule(openavbIntfMjpegGstInitialize);
registerStaticIntfModule(openavbIntfMpeg2tsFileInitialize);
registerStaticIntfModule(openavbIntfMpeg2tsGstInitialize);
registerStaticIntfModule(openavbIntfWavFileInitialize);
diff --git a/lib/avtp_pipeline/platform/Linux/avb_host/openavb_host.c b/lib/avtp_pipeline/platform/Linux/avb_host/openavb_host.c
index ce1fd4f1..e1eec996 100644
--- a/lib/avtp_pipeline/platform/Linux/avb_host/openavb_host.c
+++ b/lib/avtp_pipeline/platform/Linux/avb_host/openavb_host.c
@@ -207,7 +207,7 @@ int main(int argc, char *argv[])
//registerStaticIntfModule(openavbIntfToneGenInitialize);
registerStaticIntfModule(openavbIntfViewerInitialize);
registerStaticIntfModule(openavbIntfAlsaInitialize);
- //registerStaticIntfModule(openavbIntfMjpegGstInitialize); // TODO_OPENAVB : Not sure why MJPEG is having an issue linking GST RTP
+ registerStaticIntfModule(openavbIntfMjpegGstInitialize);
registerStaticIntfModule(openavbIntfMpeg2tsFileInitialize);
registerStaticIntfModule(openavbIntfMpeg2tsGstInitialize);
registerStaticIntfModule(openavbIntfWavFileInitialize);
diff --git a/lib/avtp_pipeline/platform/Linux/intf_alsa/aaf_listener.ini b/lib/avtp_pipeline/platform/Linux/intf_alsa/aaf_listener.ini
index 4c4fd179..b04ca608 100644
--- a/lib/avtp_pipeline/platform/Linux/intf_alsa/aaf_listener.ini
+++ b/lib/avtp_pipeline/platform/Linux/intf_alsa/aaf_listener.ini
@@ -99,7 +99,7 @@ intf_lib = ./libopenavb_intf_alsa.so
intf_fn = openavbIntfAlsaInitialize
# intf_nv_ignore_timestamp: If set the listener will ignore the timestamp on media queue items.
-intf_nv_ignore_timestamp = 1
+# intf_nv_ignore_timestamp = 1
# intf_nv_device_name: ALSA device name. Commonly "default" or "plug:dmix"
intf_nv_device_name = default
diff --git a/lib/avtp_pipeline/platform/Linux/intf_alsa/aaf_listener_auto.ini b/lib/avtp_pipeline/platform/Linux/intf_alsa/aaf_listener_auto.ini
index b0947814..481dac65 100644
--- a/lib/avtp_pipeline/platform/Linux/intf_alsa/aaf_listener_auto.ini
+++ b/lib/avtp_pipeline/platform/Linux/intf_alsa/aaf_listener_auto.ini
@@ -99,7 +99,7 @@ intf_lib = ./libopenavb_intf_alsa.so
intf_fn = openavbIntfAlsaInitialize
# intf_nv_ignore_timestamp: If set the listener will ignore the timestamp on media queue items.
-intf_nv_ignore_timestamp = 1
+# intf_nv_ignore_timestamp = 1
# intf_nv_device_name: ALSA device name. Commonly "default" or "plug:dmix"
intf_nv_device_name = default
diff --git a/lib/avtp_pipeline/platform/Linux/intf_alsa/alsa_listener.ini b/lib/avtp_pipeline/platform/Linux/intf_alsa/alsa_listener.ini
index 2b9eb256..d7c03609 100644
--- a/lib/avtp_pipeline/platform/Linux/intf_alsa/alsa_listener.ini
+++ b/lib/avtp_pipeline/platform/Linux/intf_alsa/alsa_listener.ini
@@ -116,7 +116,7 @@ intf_lib = ./libopenavb_intf_alsa.so
intf_fn = openavbIntfAlsaInitialize
# intf_nv_ignore_timestamp: If set the listener will ignore the timestamp on media queue items.
-intf_nv_ignore_timestamp = 1
+# intf_nv_ignore_timestamp = 1
# intf_nv_device_name: ALSA device name. Commonly "default" or "plug:dmix"
intf_nv_device_name = default
diff --git a/lib/avtp_pipeline/platform/Linux/intf_alsa/alsa_talker.ini b/lib/avtp_pipeline/platform/Linux/intf_alsa/alsa_talker.ini
index 9c8a3b82..652b9704 100644
--- a/lib/avtp_pipeline/platform/Linux/intf_alsa/alsa_talker.ini
+++ b/lib/avtp_pipeline/platform/Linux/intf_alsa/alsa_talker.ini
@@ -127,7 +127,7 @@ intf_lib = ./libopenavb_intf_alsa.so
intf_fn = openavbIntfAlsaInitialize
# intf_nv_ignore_timestamp: If set the listener will ignore the timestamp on media queue items.
-intf_nv_ignore_timestamp = 1
+# intf_nv_ignore_timestamp = 1
# intf_nv_device_name: ALSA device name. Commonly "default" or "plug:dmix"
intf_nv_device_name = default
diff --git a/lib/avtp_pipeline/platform/Linux/intf_h264_gst/h264_gst_listener.ini b/lib/avtp_pipeline/platform/Linux/intf_h264_gst/h264_gst_listener.ini
index 8b9c6798..9817900c 100644
--- a/lib/avtp_pipeline/platform/Linux/intf_h264_gst/h264_gst_listener.ini
+++ b/lib/avtp_pipeline/platform/Linux/intf_h264_gst/h264_gst_listener.ini
@@ -94,8 +94,13 @@ intf_fn = openavbIntfH264RtpGstInitialize
#intf_nv_repeat = 0
# intf_nv_ignore_timestamp: If set the listener will ignore the timestamp on media queue items.
-intf_nv_ignore_timestamp = 1
-intf_nv_gst_pipeline = appsrc name=avbsrc ! application/x-rtp,media=video,clock-rate=90000,encoding-name=H264,payload=96,ssrc=5,clock-base=1,seqnum-base=1 ! rtph264depay ! h264parse ! omxh264dec ! v4l2sink sync=false
+# intf_nv_ignore_timestamp = 1
+
+# gst 1.0 with libav
+#intf_nv_gst_pipeline = appsrc name=avbsrc ! application/x-rtp,media=video,clock-rate=90000,encoding-name=H264,payload=96,ssrc=5,clock-base=1,seqnum-base=1 ! rtph264depay ! h264parse ! avdec_h264 ! autovideosink sync=false
+
+# gst 0.1 with ffmpeg
+intf_nv_gst_pipeline = appsrc name=avbsrc ! application/x-rtp,media=video,clock-rate=90000,encoding-name=H264,payload=96,ssrc=5,clock-base=1,seqnum-base=1 ! rtph264depay ! h264parse ! ffdec_h264 ! autovideosink sync=false
intf_nv_blocking_rx = 0
intf_nv_async_rx = 0
diff --git a/lib/avtp_pipeline/platform/Linux/intf_h264_gst/h264_gst_talker.ini b/lib/avtp_pipeline/platform/Linux/intf_h264_gst/h264_gst_talker.ini
index 79c7371e..87569675 100644
--- a/lib/avtp_pipeline/platform/Linux/intf_h264_gst/h264_gst_talker.ini
+++ b/lib/avtp_pipeline/platform/Linux/intf_h264_gst/h264_gst_talker.ini
@@ -124,6 +124,4 @@ intf_lib = ./libopenavb_intf_h264_gst.so
# intf_fn: The name of the initialize function in the interface.
intf_fn = openavbIntfH264RtpGstInitialize
-#intf_nv_gst_pipeline = v4l2src ! "image/jpeg" ! rtpjpegpay ssrc=5 timestamp-offset=1 seqnum-offset=1 ! appsink name=avbsink
-#intf_nv_gst_pipeline = filesrc location=/run/media/mmcblk0p7/ser02.h264 ! video/x-h264 ! typefind ! queue ! h264parse ! rtph264pay ssrc=5 timestamp-offset=1 seqnum-offset=1 ! appsink name=avbsink
-intf_nv_gst_pipeline = filesrc location=/run/media/mmcblk0p7/ser02.h264 ! video/x-h264 ! typefind ! h264parse ! rtph264pay ssrc=5 timestamp-offset=1 seqnum-offset=1 ! appsink name=avbsink
+intf_nv_gst_pipeline = filesrc location=/home/marcin/ser02.h264 ! video/x-h264 ! typefind ! h264parse ! rtph264pay ssrc=5 timestamp-offset=1 seqnum-offset=1 name=avbrtppay ! appsink name=avbsink
diff --git a/lib/avtp_pipeline/platform/Linux/intf_h264_gst/openavb_intf_h264_gst.c b/lib/avtp_pipeline/platform/Linux/intf_h264_gst/openavb_intf_h264_gst.c
index fb6b91ec..9a7f08fb 100644
--- a/lib/avtp_pipeline/platform/Linux/intf_h264_gst/openavb_intf_h264_gst.c
+++ b/lib/avtp_pipeline/platform/Linux/intf_h264_gst/openavb_intf_h264_gst.c
@@ -202,7 +202,7 @@ static void createTxPipeline(media_q_t *pMediaQ)
}
else
{
- AVB_LOG_ERROR("rtpPayloader NULL in createTxPipeline");
+ AVB_LOG_ERROR("Cannot set mtu on rtppayloader. Make sure that its name is avbrtppay in the pipeline.");
}
if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(pPvtData->pipe, GST_STATE_PLAYING)) {
diff --git a/lib/avtp_pipeline/platform/Linux/intf_mjpeg_gst/mjpeg_gst_listener.ini b/lib/avtp_pipeline/platform/Linux/intf_mjpeg_gst/mjpeg_gst_listener.ini
index 02a8cf99..e1510ad6 100644
--- a/lib/avtp_pipeline/platform/Linux/intf_mjpeg_gst/mjpeg_gst_listener.ini
+++ b/lib/avtp_pipeline/platform/Linux/intf_mjpeg_gst/mjpeg_gst_listener.ini
@@ -98,7 +98,7 @@ intf_nv_repeat = 0
# intf_nv_ignore_timestamp: If set the listener will ignore the timestamp on media queue items.
#intf_nv_ignore_timestamp = 1
-intf_nv_gst_pipeline = appsrc name=avbsrc ! application/x-rtp,media=video,clock-rate=90000,encoding-name=JPEG,payload=96,ssrc=5,clock-base=1,seqnum-base=1 ! rtpjpegdepay ! jpegdec ! ffmpegcolorspace ! omx_scaler ! video/x-raw-yuv,width=1920,height=800 ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! omx_videosink sync=false
+intf_nv_gst_pipeline = appsrc name=avbsrc ! application/x-rtp,media=video,clock-rate=90000,encoding-name=JPEG,payload=96,ssrc=5,clock-base=1,seqnum-base=1 ! rtpjpegdepay ! jpegdec ! ffmpegcolorspace ! autovideosink
intf_nv_blocking_rx = 1
intf_nv_async_rx = 1
diff --git a/lib/avtp_pipeline/platform/Linux/intf_mjpeg_gst/mjpeg_gst_talker.ini b/lib/avtp_pipeline/platform/Linux/intf_mjpeg_gst/mjpeg_gst_talker.ini
index fba0fece..16f1a276 100644
--- a/lib/avtp_pipeline/platform/Linux/intf_mjpeg_gst/mjpeg_gst_talker.ini
+++ b/lib/avtp_pipeline/platform/Linux/intf_mjpeg_gst/mjpeg_gst_talker.ini
@@ -40,7 +40,7 @@ max_interval_frames = 1
# sr_class: A talker only setting. Values are either A or B. If not set an internal
# default is used.
-#sr_class = B
+sr_class = A
# sr_rank: A talker only setting. If not set an internal default is used.
#sr_rank = 1
diff --git a/lib/avtp_pipeline/platform/Linux/intf_mpeg2ts_gst/mpeg2ts_gst_listener.ini b/lib/avtp_pipeline/platform/Linux/intf_mpeg2ts_gst/mpeg2ts_gst_listener.ini
index 68ae616a..e1221afa 100644
--- a/lib/avtp_pipeline/platform/Linux/intf_mpeg2ts_gst/mpeg2ts_gst_listener.ini
+++ b/lib/avtp_pipeline/platform/Linux/intf_mpeg2ts_gst/mpeg2ts_gst_listener.ini
@@ -105,10 +105,10 @@ intf_nv_file_name = output.ts
#intf_nv_repeat = 0
# intf_nv_ignore_timestamp: If set the listener will ignore the timestamp on media queue items.
-intf_nv_ignore_timestamp = 1
+# intf_nv_ignore_timestamp = 1
#gstreamer pipeline
-intf_nv_gst_pipeline = appsrc name=avbsrc ! queue ! mpegtsdemux ! h264parse ! omx_h264dec ! omx_scaler ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! gstperf ! omx_videosink sync=false
+intf_nv_gst_pipeline = appsrc name=avbsrc ! queue ! mpegtsdemux ! h264parse ! ffdec_h264 ! autovideosink
# alternate pipe to test that file is transferred
#intf_nv_gst_pipeline = appsrc name=avbsrc ! filesink location=/dev/shm/listen.ts
diff --git a/lib/avtp_pipeline/platform/Linux/intf_wav_file/wav_file_listener.ini b/lib/avtp_pipeline/platform/Linux/intf_wav_file/wav_file_listener.ini
index 565ce467..f1b6d595 100644
--- a/lib/avtp_pipeline/platform/Linux/intf_wav_file/wav_file_listener.ini
+++ b/lib/avtp_pipeline/platform/Linux/intf_wav_file/wav_file_listener.ini
@@ -90,7 +90,7 @@ intf_lib = ./libopenavb_intf_wav_file.so
intf_fn = openavbIntfWavFileInitialize
# intf_nv_ignore_timestamp: If set the listener will ignore the timestamp on media queue items.
-intf_nv_ignore_timestamp = 1
+# intf_nv_ignore_timestamp = 1
# intf_nv_audio_rate: Audio sample rate, must be consistenet with wav file sample rate
intf_nv_audio_rate = 48000
diff --git a/lib/avtp_pipeline/platform/Linux/openavb_time_osal.c b/lib/avtp_pipeline/platform/Linux/openavb_time_osal.c
index 59f4480d..832f4bc1 100644
--- a/lib/avtp_pipeline/platform/Linux/openavb_time_osal.c
+++ b/lib/avtp_pipeline/platform/Linux/openavb_time_osal.c
@@ -54,7 +54,7 @@ static pthread_mutex_t gOSALTimeInitMutex = PTHREAD_MUTEX_INITIALIZER;
static bool bInitialized = FALSE;
static int gIgbShmFd = -1;
static char *gIgbMmap = NULL;
-static gPtpTimeData gPtpTD;
+gPtpTimeData gPtpTD;
static bool x_timeInit(void) {
AVB_TRACE_ENTRY(AVB_TRACE_TIME);
@@ -88,7 +88,6 @@ static bool x_timeInit(void) {
static bool x_getPTPTime(U64 *timeNsec) {
AVB_TRACE_ENTRY(AVB_TRACE_TIME);
- // TODO_OPENAVB : There may be a reasonable way to avoid calling this each time. Really only need to update it after gPTP SYNC.
if (!gptpscaling(&gPtpTD, gIgbMmap)) {
AVB_LOG_ERROR("GPTP scaling failed");
AVB_TRACE_EXIT(AVB_TRACE_TIME);
@@ -97,13 +96,13 @@ static bool x_getPTPTime(U64 *timeNsec) {
uint64_t now_local;
uint64_t update_8021as;
- unsigned delta_8021as;
- unsigned delta_local;
+ int64_t delta_8021as;
+ int64_t delta_local;
- if (halTimeGetLocaltime(&now_local)) {
+ if (gptplocaltime(&gPtpTD, &now_local)) {
update_8021as = gPtpTD.local_time - gPtpTD.ml_phoffset;
- delta_local = (unsigned)(now_local - gPtpTD.local_time);
- delta_8021as = (unsigned)(gPtpTD.ml_freqoffset * delta_local);
+ delta_local = now_local - gPtpTD.local_time;
+ delta_8021as = gPtpTD.ml_freqoffset * delta_local;
*timeNsec = update_8021as + delta_8021as;
AVB_TRACE_EXIT(AVB_TRACE_TIME);
diff --git a/lib/avtp_pipeline/platform/Linux/rawsock/igb_rawsock.c b/lib/avtp_pipeline/platform/Linux/rawsock/igb_rawsock.c
index 21aea470..92952487 100644
--- a/lib/avtp_pipeline/platform/Linux/rawsock/igb_rawsock.c
+++ b/lib/avtp_pipeline/platform/Linux/rawsock/igb_rawsock.c
@@ -40,9 +40,10 @@ https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175.
#define AVB_LOG_COMPONENT "Raw Socket"
#include "openavb_log.h"
-// how frequently get igb_wallclock() for transmitted frame
-// 10 means every 10th frame
-#define WALLCLOCK_REFRESH 100
+#if IGB_LAUNCHTIME_ENABLED
+// needed for gptplocaltime()
+extern gPtpTimeData gPtpTD;
+#endif
void *igbRawsockOpen(igb_rawsock_t* rawsock, const char *ifname, bool rx_mode, bool tx_mode, U16 ethertype, U32 frame_size, U32 num_frames)
{
@@ -91,7 +92,6 @@ void *igbRawsockOpen(igb_rawsock_t* rawsock, const char *ifname, bool rx_mode, b
// select class B queue by default
rawsock->queue = 1;
- igb_get_wallclock(rawsock->igb_dev, &rawsock->attime, NULL);
}
AVB_TRACE_EXIT(AVB_TRACE_RAWSOCK);
@@ -194,9 +194,9 @@ bool igbRawsockTxFrameReady(void *pvRawsock, U8 *pBuffer, unsigned int len)
rawsock->tx_packet->len = len;
- static int counter = 0;
- if (counter++ % WALLCLOCK_REFRESH == 0) igb_get_wallclock(rawsock->igb_dev, &rawsock->attime, NULL);
- rawsock->tx_packet->attime = rawsock->attime;
+#if IGB_LAUNCHTIME_ENABLED
+ gptplocaltime(&gPtpTD, &rawsock->tx_packet->attime);
+#endif
err = igb_xmit(rawsock->igb_dev, rawsock->queue, rawsock->tx_packet);
if (err) {
diff --git a/lib/avtp_pipeline/platform/Linux/rawsock/igb_rawsock.h b/lib/avtp_pipeline/platform/Linux/rawsock/igb_rawsock.h
index 7abd4e0c..e1fed118 100644
--- a/lib/avtp_pipeline/platform/Linux/rawsock/igb_rawsock.h
+++ b/lib/avtp_pipeline/platform/Linux/rawsock/igb_rawsock.h
@@ -40,7 +40,6 @@ typedef struct {
device_t *igb_dev;
struct igb_packet *tx_packet;
int queue;
- U64 attime;
} igb_rawsock_t;
void *igbRawsockOpen(igb_rawsock_t* rawsock, const char *ifname, bool rx_mode, bool tx_mode, U16 ethertype, U32 frame_size, U32 num_frames);
diff --git a/lib/avtp_pipeline/platform/x86_i210/openavb_ether_hal.c b/lib/avtp_pipeline/platform/x86_i210/openavb_ether_hal.c
index 56c937be..f74565f9 100644
--- a/lib/avtp_pipeline/platform/x86_i210/openavb_ether_hal.c
+++ b/lib/avtp_pipeline/platform/x86_i210/openavb_ether_hal.c
@@ -115,6 +115,10 @@ device_t *igbAcquireDevice()
}
}
+ igbControlLaunchTime(tmp_dev, IGB_LAUNCHTIME_ENABLED);
+
+ AVB_LOGF_INFO("IGB launch time feature is %s", IGB_LAUNCHTIME_ENABLED ? "ENABLED" : "DISABLED");
+
igb_dev = tmp_dev;
unlock:
if (!igb_dev)
@@ -208,3 +212,33 @@ bool igbGetMacAddr(U8 mac_addr[ETH_ALEN])
}
return !err;
}
+
+bool igbControlLaunchTime(device_t *dev, int enable)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_HAL_ETHER);
+
+ const uint32_t E1000_TQAVCTRL = 0x03570;
+ const uint32_t E1000_TQAVCTRL_LAUNCH_VALID = 0x00000200;
+
+ int err;
+ uint32_t regVal;
+
+ err = igb_lock(dev);
+ if (err)
+ goto error;
+
+ igb_readreg(dev, E1000_TQAVCTRL, &regVal);
+
+ if (enable)
+ regVal |= E1000_TQAVCTRL_LAUNCH_VALID;
+ else
+ regVal &= ~E1000_TQAVCTRL_LAUNCH_VALID;
+
+ igb_writereg(dev, E1000_TQAVCTRL, regVal);
+
+ err = igb_unlock(dev);
+
+error:
+ AVB_TRACE_EXIT(AVB_TRACE_HAL_ETHER);
+ return !err;
+}
diff --git a/lib/avtp_pipeline/platform/x86_i210/openavb_ether_hal.h b/lib/avtp_pipeline/platform/x86_i210/openavb_ether_hal.h
index fb09f86b..5d991c09 100644
--- a/lib/avtp_pipeline/platform/x86_i210/openavb_ether_hal.h
+++ b/lib/avtp_pipeline/platform/x86_i210/openavb_ether_hal.h
@@ -38,6 +38,7 @@ https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175.
#define IGB_MTU 256
#define IGB_QUEUES 2
+#define IGB_LAUNCHTIME_ENABLED 0
device_t *igbAcquireDevice();
@@ -49,4 +50,6 @@ void igbRelTxPacket(device_t* dev, int queue, struct igb_packet *tx_packet);
bool igbGetMacAddr(U8 mac_addr[ETH_ALEN]);
+bool igbControlLaunchTime(device_t *dev, int enable);
+
#endif // HAL_ETHER_H
diff --git a/lib/avtp_pipeline/tl/openavb_talker.c b/lib/avtp_pipeline/tl/openavb_talker.c
index 0c5463de..73d6a406 100644
--- a/lib/avtp_pipeline/tl/openavb_talker.c
+++ b/lib/avtp_pipeline/tl/openavb_talker.c
@@ -104,7 +104,7 @@ bool talkerStartStream(tl_state_t *pTLState)
U32 SRKbps = ((unsigned long)pTalkerData->classRate * (unsigned long)pCfg->max_interval_frames * (unsigned long)pStream->frameLen * 8L) / 1000;
U32 DataKbps = ((unsigned long)pTalkerData->wakeRate * (unsigned long)pCfg->max_interval_frames * (unsigned long)pStream->frameLen * 8L) / 1000;
- AVB_LOGF_INFO(STREAMID_FORMAT", sr-rate=%lu, data-rate=%lu, frames=%lu, size=%lu, batch=%ld, sleep=%lldus, sr-Kbps=%d, data-Kbps=%d",
+ AVB_LOGF_INFO(STREAMID_FORMAT", sr-rate=%lu, data-rate=%lu, frames=%u, size=%u, batch=%u, sleep=%" PRId64 ", sr-Kbps=%d, data-Kbps=%d",
STREAMID_ARGS(&pTalkerData->streamID), (unsigned long)(pTalkerData->classRate), (unsigned long)(pTalkerData->wakeRate),
pTalkerData->tSpec.maxIntervalFrames, pTalkerData->tSpec.maxFrameSize,
pCfg->batch_factor, pTalkerData->intervalNS / 1000, SRKbps, DataKbps);