本篇是讀完RTMP Specification 1.0 後的心得整理。會以 spec為主並搭配 wireshark rtmp_sample 封包為例,介紹一個基本的 RTMP 播放流程。
2016年6月6日 星期一
2016年6月3日 星期五
[Embedded] 檢視 message queue 資訊
Linux 下的 IPC 運作若使用 message queue,有兩種 message queue 可用,分別是 SYSTEM V MESSAGE QUEUE 與 POSSIX MESSAGE QUEUE,本篇將介紹如何確認 message queue 中的資訊。
2016年6月1日 星期三
使用 wireshark 的 lua script
Wireshark 支援 lua script ,可以讓我們自行撰寫需要的 disector,簡單的說就是可以讓我自行定義封包要怎麼切割以及顯示。這是個非常有用的功能。
本次練習的環境為
本次練習的環境為
- OS X EI Capitan v10.11.3 64bit
- wireshark 2.0.2 64bit
[Study] Google必修的圖表簡報術
本書作者 Cole Nussbaumer Knaflic 曾任Google人力分析團隊總監,她從心理學的角度介紹設計簡報的一些技巧。推薦大家應該看一下。摘要閱讀心得如下:
2016年4月10日 星期日
Online Password Digest of WSS v1.1 Username Token Profile
The WSS 1.1 Username Token Profile allows digest passwords to be sent in a wsse:UsernameToken of a SOAP message. The formula is
Password_Digest = Base64 ( SHA-1 ( nonce + created + password ) )Below list 2 test vector
Test Vector 1
You can use this form to check the correctness of your password digest.
Reference:Nonce : juVKtZ22NkCZfPadWjVAs2UAAAAAAA==Test Vector 2
created: 2016-03-24T06:16:28.732Z
password = 1234
PasswordDigest: oXq1ma7BR1vYdHBW01Hn1Aa1ppQ=
Nonce : Mdr8Vh3rBzmt1s+3b+nvNJWIlKk=
created: 2016-03-12T11:54:16Z
password = 1234
PasswordDigest: s/bk3KbayLIJb4mK95+g+Feu7+Y=
You can use this form to check the correctness of your password digest.
2016年3月9日 星期三
iOS - Enable AirPlay for your APP
之前寫了一個簡單的音樂APP,可以在同時使用 AudioUnit 同時進行錄音與播放。使用手機測試錄音與播放是沒問題的,但是當我想要將程式改為在手機端錄音,透過 AirPlay 在電視上播放時卻發生問題,問題現象是手機上不會出現 AirPlay 選項。
以下記錄使用 Audio Unit 各種實驗與其結果:
1. 先了解 Audio 運作時可以設定的各種模式
摘錄 Apple 定義的 AudioSession Category/Mode 設定值
Table B-1 Audio session category behavior Category identifiers Silenced by the Ring/Silent switch and by screen locking see note Interrupts non-mixable apps audio Allows audio input (recording) and output (playback)AVAudioSessionCategoryAmbient Yes No Output onlyAVAudioSessionCategoryAudioProcessing – Yes No input and no outputAVAudioSessionCategoryMultiRoute No Yes Input and outputAVAudioSessionCategoryPlayAndRecord No Yes by default; no by using override switch Input and outputAVAudioSessionCategoryPlayback No Yes by default; no by using override switch Output onlyAVAudioSessionCategoryRecord No (recording continues with the screen locked) Yes Input onlyAVAudioSessionCategorySoloAmbient Yes Yes Output only
Table B-2 Modes and associated categories Mode identifiers Compatible categoriesAVAudioSessionModeDefault AllAVAudioSessionModeVoiceChatAVAudioSessionCategoryPlayAndRecordAVAudioSessionModeGameChatAVAudioSessionCategoryPlayAndRecordAVAudioSessionModeVideoRecordingAVAudioSessionCategoryPlayAndRecordAVAudioSessionCategoryRecordAVAudioSessionModeMoviePlayback AVAudioSessionCategoryPlaybackAVAudioSessionModeMeasurementAVAudioSessionCategoryPlayAndRecordAVAudioSessionCategoryRecordAVAudioSessionCategoryPlaybackAVAudioSessionModeVideoChatAVAudioSessionCategoryPlayAndRecord
因為此 APP 同時有 Audio In/Audio Out,所以能夠選擇的設定如下
- AVAudioSessionCategoryMultiRoute
- AVAudioSessionCategoryPlayAndRecord
- AVAudioSessionModeDefault
- AVAudioSessionModeVoiceChat
- AVAudioSessionModeGameChat
- AVAudioSessionModeVideoRecording
- AVAudioSessionModeMeasurement
- AVAudioSessionModeVideoChat
2. 測試不同 Audio Session Mode 與 Audio Unit 同時啟用時所造成的影響
以下僅為個人實驗結果,當 APP 啟動後,若設定為下列 Category/Mode 不會出現 Airplay選項。
- AVAudioSessionCategoryMultiRoute
- AVAudioSessionCategoryPlayAndRecord
- AVAudioSessionModeGameChat
- AVAudioSessionModeVideoRecording
- AVAudioSessionModeVoiceChat
圖例如下:
當 APP 啟動後,若設定為下列 Category/Mode 可以出現 Airplay選項。
- AVAudioSessionModeDefault
- AVAudioSessionModeMeasurement
- AVAudioSessionModeVideoChat
此時已經可以正常播放音樂,圖例如下:![]()
但是一旦當APP開始進行錄音時,卻會變成只有 "iPhone" 與 "iPhone擴音"可選
圖例如下:
設定方式舉例如下:
[[sharedInstance] setCategory: AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker|AVAudioSessionCategoryOptionMixWithOthers error:&setCategoryErr];
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionModeDefault error:&setCategoryErr];
經過上述實驗,我會懷疑是否使用Audio Unit 進行錄音時,便無法使用Airplay。
3. 設定 APP Capabilities,設定 Background Modes 支援 Audio and Airplay,如下圖:
此作法也是沒用。
結論:本來想作好此功能之後,可以把家裡電視跟舊iPhone結合成卡拉OK,沒想到一直試不出來,只好作罷。如果有好心人試出這個功能,麻煩請教教我啊,謝謝。
參考資料
- Audio Session Categories and Modes
- Jawbone/AudioSessionManager
- AudioSessionProgrammingGuide
- EnrichYourAppforAirPlay
[Embedded] how to check heap corruption
上週的 linux news 提到 iOS 上的一個問題,Analysis of iOS & OS X Vulnerability: CVE-2016-1722,指出了 heap overflow 的問題。這篇新聞提醒了自己,應該要將之前的實戰經驗做一下整理了。本篇會針對如何找到 heap corruption 的方法作一整理。
訂閱:
文章 (Atom)



