# TCP 用例

Source: [https://docs.qualcomm.com/doc/80-70017-50SC/topic/tcp-use-cases.html](https://docs.qualcomm.com/doc/80-70017-50SC/topic/tcp-use-cases.html)

使用通过 TCP 远程连接的控制应用程序来控制 GStD 框架。

## 前提条件

- 启用 `wlan0`相关说明，可参见[使用 SSH 登录](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-254/how_to.html#use-ssh)。
- 重新启动后，Wi-Fi 应启动并运行。

        ifconfig   // Note down wlan0_IPCopy to clipboard
- 如需配置 TCP 用例，请选择未使用的端口：

        vi /etc/default/gstd
             OPTARGS=" -a wlan0_IP -p 5001"     // Replace the port 5001 if the port is not free
        
             XDG_RUNTIME_DIR=/dev/socket/weston
        
             WAYLAND_DISPLAY=wayland-1
        
        systemctl daemon-reload
        systemctl restart gstdCopy to clipboard

## 单流编码

1. 创建 pipeline：

        gst-client-1.0 -a 10.92.164.1 -p 5001 pipeline_create tcp_enc1 qtiqmmfsrc name=camsrc ! video/x-raw\(memory:GBM\),format=NV12,width=1920,height=1080,framerate=30/1,compression=ubwc,interlace-mode=progressive,colorimetry=bt601 ! v4l2h264enc capture-io-mode=5 output-io-mode=5 ! h264parse ! queue ! mp4mux ! queue ! filesink location=/tmp/tcp_enc1.mp4Copy to clipboard
2. 控制 pipeline：
    - 播放 pipeline：

            gst-client-1.0 -a 10.92.164.1 -p 5001 pipeline_play tcp_enc1Copy to clipboard
    - 发送 EOS：

            gst-client-1.0 -a 10.92.164.1 -p 5001 event_eos tcp_enc1Copy to clipboard
    - 停止 pipeline：

            gst-client-1.0 -a 10.92.164.1 -p 5001 pipeline_stop tcp_enc1Copy to clipboard

## 多流编码

1. 创建 pipeline：

        gst-client-1.0 -a 10.92.164.1 -p 5001 pipeline_create tcp_enc2 qtiqmmfsrc name=camsrc video_0::type=preview ! video/x-raw\(memory:GBM\),format=NV12,width=1920,height=1080,framerate=30/1,compression=ubwc,interlace-mode=progressive,colorimetry=bt601 ! queue ! v4l2h264enc capture-io-mode=5 output-io-mode=5 ! queue ! h264parse ! mp4mux ! queue ! filesink location="/tmp/tcp_mux1.mp4" \ camsrc. ! video/x-raw\(memory:GBM\),format=NV12,width=1920,height=1080,framerate=30/1,compression=ubwc,interlace-mode=progressive,colorimetry=bt601 ! queue ! v4l2h264enc capture-io-mode=5 output-io-mode=5 ! queue ! h264parse ! mp4mux ! queue ! filesink location="/tmp/tcp_mux2.mp4"Copy to clipboard
2. 控制 pipeline：
    - 播放 pipeline：

            gst-client-1.0 -a 10.92.164.1 -p 5001 pipeline_play tcp_enc2Copy to clipboard
    - 发送 EOS：

            gst-client-1.0 -a 10.92.164.1 -p 5001 event_eos tcp_enc2Copy to clipboard
    - 停止 pipeline：

            gst-client-1.0 -a 10.92.164.1 -p 5001 pipeline_stop tcp_enc2Copy to clipboard

## 单显示器

1. 创建 pipeline：

        gst-client-1.0 -a 10.92.164.1 -p 5001 pipeline_create tcp_dis1 qtiqmmfsrc name=camsrc video_0::type=preview ! video/x-raw\(memory:GBM\),format=NV12,width=1920,height=1080,framerate=30/1,compression=ubwc ! waylandsink fullscreen=true async=true sync=falseCopy to clipboard
2. 控制 pipeline：
    - 播放 pipeline：

            gst-client-1.0 -a 10.92.164.1 -p 5001 pipeline_play tcp_dis1Copy to clipboard
    - 暂停 pipeline：

            gst-client-1.0 -a 10.92.164.1 -p 5001 pipeline_pause tcp_dis1Copy to clipboard
    - 停止 pipeline：

            gst-client-1.0 -a 10.92.164.1 -p 5001 pipeline_stop tcp_dis1Copy to clipboard

## 多显示器

1. 创建 pipeline：

        gst-client-1.0 -a 10.92.164.1 -p 5001 pipeline_create tcp_dis2 qtiqmmfsrc name=camsrc video_0::type=preview ! video/x-raw\(memory:GBM\),format=NV12,width=1920,height=1080,framerate=30/1,compression=ubwc ! waylandsink x=0 y=0 width=500 height=400 async=true sync=false camsrc. ! video/x-raw\(memory:GBM\),format=NV12,width=1920,height=1080,framerate=30/1,compression=ubwc ! waylandsink x=510 y=0 width=500 height=400 async=true sync=falseCopy to clipboard
2. 控制 pipeline：
    - 播放 pipeline：

            gst-client-1.0 -a 10.92.164.1 -p 5001 pipeline_play tcp_dis2Copy to clipboard
    - 暂停 pipeline：

            gst-client-1.0 -a 10.92.164.1 -p 5001 pipeline_pause tcp_dis2Copy to clipboard
    - 停止 pipeline：

            gst-client-1.0 -a 10.92.164.1 -p 5001 pipeline_stop tcp_dis2Copy to clipboard

**上一级主题：** [GStD](https://docs.qualcomm.com/doc/80-70017-50SC/topic/gstreamer-daemon.html)

Last Published: Nov 11, 2025

[Previous Topic
本地用例](https://docs.qualcomm.com/bundle/publicresource/80-70017-50SC/topics/local-use-cases.md) [Next Topic
运行 HTTP 用例](https://docs.qualcomm.com/bundle/publicresource/80-70017-50SC/topics/run-http-use-cases.md)