【问题标题】:Streaming jpegs via a web service通过 Web 服务流式传输 jpeg
【发布时间】:2014-07-27 17:53:54
【问题描述】:

我正在从 IP 摄像机捕获 jpeg。 我通过网络服务将它上传到我的服务器。 然后我将图像渲染到画布上。 然后,用户可以通过浏览器查看动作。

我一直在使用 4 个 IP 摄像头,每个通道的分辨率为 360x288。字节数组大小通常为 15kb。

切换到分辨率为 720x576 的单摄像头,字节数组的有效负载增加到单摄像头 360x288 的 4 倍。

我在这里注意到了这个问题和答案:

Splitting a byte[] into multiple byte[] arrays in C#

给出勾选答案的人建议根本不要使用字节数组。只是流它。目前,我正在使用 WCF TCP 绑定,我想知道如何在此设置中实现此流式传输选项?

如何将其用于连续图像(而不是单个视频文件)?

代码会是什么样子?我在谷歌上搜索,但将大字节数组拆分为 2 个较小的数组并单独上传,然后在服务器上重新组合不是更好吗?

我正在使用 c#

【问题讨论】:

    标签: c# wcf image-processing streaming bytearray


    【解决方案1】:

    我建议使用流式方法,因为它比在服务器端重建图像文件的所有工作要简单得多。

    NetTcpBinding支持Streamed的TransferMode。主要限制是不能使用 Message 的 SecurityMode

    你可以这样配置它:

    <configuration>
        <system.serviceModel>
            <services>
                <service name="PhotoUploadService">
                    <endpoint name="" binding="netTcpBinding"
                        address="net.tcp://localhost:8000"
                        contract="IPhotoUploadService"
                        bindingConfiguration="streamedTcpBinding" />
                </service>
            </services>
            <bindings>
                <netTcpBinding>
                    <binding name="streamedTcpBinding" 
                      transferMode="Streamed" 
                      maxReceivedMessageSize="2147483647"
                      maxBufferSize="65536" />
                </netTcpBinding>
            </bindings>
        </system.serviceModel>
    </configuration>
    

    【讨论】:

      猜你喜欢
      • 2011-05-23
      • 1970-01-01
      • 1970-01-01
      • 2015-10-28
      • 1970-01-01
      • 1970-01-01
      • 2014-01-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多