[工作點滴] pure public or hybrid cloud for surveillance system?

The pure public cloud is no doubt that we build the web services on public and the hybrid combine the private part. According to the information on wiki, the public cloud aka external cloud is related to the service is provided by third party. There is a picture on wiki can describe exactly what we talk about. Basically, there are four deployment models on wiki. The private cloud can’t satisfy the requirements of the surveillance system. We do not talk about the community cloud also because it’s not real on surveillance system. There is a famous network camera company named Dropcam that deployment as pure public cloud system. When we install the the devices, we have to create an account and register them. As I know, Dropcam use the Amazon Web Service as the infrastructure. I just plot some simple block diagrams to describe it. ...

February 16, 2013 · 2 分鐘 · 328 字 · ChenFu Kuo

監控系統該選純公有雲還是混合雲?

純公有雲 (Public Cloud) 毫無疑問是在大眾網路上建構服務,而混合雲 (Hybrid Cloud) 則結合了私有雲 (Private) 部分。根據維基百科的說明,公有雲又稱「外部雲」,是指由第三方提供的服務。維基百科上的圖示能精準地描述我們所談論的概念。 基本上,維基百科列出了四種部署模型。私有雲無法滿足監控系統的各項需求。我們也不探討社群雲 (Community Cloud),因為那在監控實務中並不常見。 有一家著名的網路攝錄影機公司名為 Dropcam,它是採用純公有雲模型的典型案例。安裝設備時,我們必須建立帳號並註冊。據我所知,Dropcam 使用 Amazon Web Service (AWS) 作為基礎設施。我畫了一些簡單的方塊圖來描述這個架構。 Dropcam 的模式(圖左下)中,所有服務皆由 Dropcam 提供並託管於 AWS。Dropcam 的角色不再僅是設備製造商,更是服務提供者。這種方式使整體系統變得最簡單且直觀。 而其他三種方塊圖則越來越複雜。一些監控公司仍希望基於傳統模式擴展系統,這可能導致整體架構變得像圖片上方那樣極其複雜,他們很快就會陷入泥淖。 不過,仍有一個大哉問:並非所有人都喜歡將私有影像內容餵給服務提供者。這也是為什麼傳統監控系統依然存在並掌握大部分市場佔有率的原因。但我認為這種情況在近幾年將會發生巨變。 經過研究與學習,我傾向將部署簡化為兩種。一種是 Dropcam 的模式,優點如前文所述。另一種則是因為目前純公有雲仍有部分弱點尚無法克服。 究竟是左邊還是右邊比較好?讓我們拭目以待。

February 16, 2013 · 1 分鐘 · 32 字 · ChenFu Kuo

[心情隨筆] Happy lunar new year

Today is the end of the Dragon year and we use to have a good supper on this day. It’s brand new lunar year tomorrow and we call it Snake year. Sometimes, we’d call it Small Dragon year rather than Snake year because because Dragon is much more significant in traditional. Hope my family and friends have a brand new good Small Dragon Year.

February 9, 2013 · 1 分鐘 · 64 字 · ChenFu Kuo

[工作點滴] I2S bus channels setting in gstreamer alsasrc plugin

My colleague did some experiments on gstreamer alsasrc and osssrc plugins and he found that alsasrc consume lots of cpu resource(around 16% on the chip we use). He asked me why the test tool that provided from chip vendor is quite efficient(around 1~2%). It was a big gap to me and I started to find why is that. After hours checking, I found that the plugin may cause a busy wait in a while loop when the parameters set to non-blocking mode. I do a simple code modification and execute again but the cpu rate just lower to 12%. I’m a little frustrated about it but still had some enhancement. So I started to try different parameters combination because he told that he found three differences from alsasrc plugin and the test code. 1. The setting of alsasrc is non-block mode but the test code is set to block mode. 2. The channels setting of alsasrc is 1 but the test code is set to 2. 3. The buffer size is limit in test code but alsasrc do not have that limit. For 1: I thought the non-block mode should be much more efficient but the busy wait should change. For 2: This is really weird because when I set the channels to be 2 in alsasrc plugin, the cpu rate become quite low. So I start to wondering if this is the characteristics of the I2S bus. I googled on the internet but did not find any information to describe that we have to set the channels parameter to be 2 in alsasrc plugin of gstreamer when the audio data bus is I2S. So I’ll confirm it later. For 3: I think it’s reasonable to limit the buffer size.

February 8, 2013 · 2 分鐘 · 290 字 · ChenFu Kuo

GStreamer alsasrc 插件中的 I2S 匯流排聲道設定

我的一位同事在測試 GStreamer 的 alsasrc 與 osssrc 插件時發現,alsasrc 消耗了相當驚人的 CPU 資源(在我們使用的晶片上約占 16%)。他詢問我,為何晶片供應商提供的測試工具卻能維持極高的效率(約僅占 1~2%)。這巨大的效能差距引起了我的好奇,我決定深入研究原因。 經過數小時的調查,我發現當參數設定為「非阻塞模式 (non-blocking mode)」時,該插件可能會在 While 迴圈中導致忙碌等待 (busy wait)。我對程式碼進行了簡單修改並重新執行,結果 CPU 使用率降低到 12%。雖然略有改進,但我依然感到有些沮喪。 於是,我開始嘗試不同的參數組合,因為我同事發現了 alsasrc 與測試工具間的三個差異點: alsasrc 設定為「非阻塞模式」,而測試工具為「阻塞模式 (block mode)」。 alsasrc 的聲道設定為 1,而測試工具設定為 2。 測試工具限制了緩衝區大小 (buffer size),而 alsasrc 沒有這項限制。 針對第一點:我原以為非阻塞模式應該更有效率,但關鍵在於必須改善其忙碌等待的機制。 針對第二點:這非常奇特,因為當我在 alsasrc 插件將聲道數設定為 2 時,CPU 使用率竟然大幅降低。這讓我開始懷疑這是否與 I2S 匯流排的特性有關。我在網路上搜尋,並未發現任何資料指明「當音訊匯流排為 I2S 時,必須在 GStreamer 的 alsasrc 插件中將聲道參數設為 2」。稍後我會進一步確認此現象。 針對第三點:我認為限制緩衝區大小以優化效能是合理的做法。

February 8, 2013 · 1 分鐘 · 55 字 · ChenFu Kuo

[工作點滴] RabbitMQ setup and test

RabbitMQ setup and test Server side: My desktop PC is windows 7 and we download the rabbitmq server from http://www.rabbitmq.com/. The installation guide is here http://www.rabbitmq.com/install-windows.html. I use extra ethernet card and set the ip address to be 192.168.1.19 and make sure the firewall would not block the port 5672. Client side: we put the send and listen on same device. I use the package from https://github.com/alanxz/rabbitmq-c. We can follow the guide in the link to cross build and install on the embedded device we use. ...

February 7, 2013 · 1 分鐘 · 86 字 · ChenFu Kuo

[工作點滴] The realtime of transport stream on Miracast

When I google the internet with realtime and transport stream, I could not find the information I want. The word ‘realtime’ must construct on the relative thinking. For example, there is camera and screen and the camera’s video can be showed on the screen with quite small latency. We assume the latency is under 150ms or 300ms whatever and we can call this is realtime or not when we can have comparisons. The structure of the transport stream or what we call MPEG-TS is not that simple. What I say is compare with raw encoded media direct push to intermedia. Maybe the transport stream is design for broadcasting usage, so the media stream can be selected and video can be smooth played are much more important than realtime. Because people would not feel any latency happened when they just watch TV. If we want to convert raw encoded media to transport stream. First, we have to packetize the raw encoded media to packetized elementary stream(PES). Second, we handle the PES by the muxing, splitting to small slice AV data…etc to program stream or what we call transport stream. Finally, we send the transport stream to internet or satellite for people to receive and watch it on display. These steps create lots of latency and make us feel it’s not realtime enough. Let’s go back to the definition of the Miracast. It is to convert the raw encoded media stream to transport stream and then encapsulate the stream to RTP. Finally go through the wifi directly to display. I’m not sure how many latency will be created? Maybe someone can tell me.

February 6, 2013 · 2 分鐘 · 271 字 · ChenFu Kuo

[工作點滴] Airplay, DLNA and Miracast

Today, there is a supplier come to our company to introduce their solution with DLNA and Miracast support. I survey the internet and found three kinds of protocols are discussed on the market. The DLNA has been talked for a long time and Apple is DLNA member originally. But Apple left DLNA and create the proprietary Airplay protocol. The Miracast is created by Wifi Alliance. It seems that Android alliance choose the Miracast to fight with Apple? ...

February 5, 2013 · 1 分鐘 · 78 字 · ChenFu Kuo

[工作點滴] STL notes

國外工程師用boost c++ library來進行相關專案的開發, 進而看到一些相關的STL語法, 所以還是得抽空K一下相關資料, 至少要把code看懂. From wiki: http://en.wikipedia.org/wiki/Standard_Template_Library The Standard Template Library (STL) is a C++ software library that influenced many parts of the C++ Standard Library. It provides four components called algorithms, containers, functional, and iterators. The STL provides a ready-made set of common classes for C++, such as containers and associative arrays, that can be used with any built-in type and with any user-defined type that supports some elementary operations (such as copying and assignment). STL algorithms are independent of containers, which significantly reduces the complexity of the library. ...

February 5, 2013 · 1 分鐘 · 171 字 · ChenFu Kuo

[工作點滴] Linux工具小記錄

打patch的command diff -Naur [from-file] [to-file] > [YourFileName.patch] -N In directory comparison, if a file is found in only one directory, treat it as present but empty in the other directory. -a Treat all files as text and compare them line-by-line, even if they do not seem to be text. -u Use the unified output format. -r When comparing directories, recursively compare any subdirectories found. SVN版本控制下要移除所有目錄底下.svn $ rm -rf find . -type d -name .svn ...

February 4, 2013 · 1 分鐘 · 86 字 · ChenFu Kuo