ICE STUN and TURN


Assuming host A B both behind NAT on the internet.
STUN: Session Traversal Utilities for NAT
A B talk to STUN server to know each other’s external IP and port state for hole punching.
The goal is to let A B directly talk to each other on UCP and sometimes TCP, if NAT is not symmetric.
This public IP is also needed in RTSP SDP when RTP over UDP.
STUN server itself communicates over UDP by default.
TURN: Traversal Using Relays around NAT
A first asks TURN server a permission, and then A sends all data to TURN, which is relayed to B.
Used for some NAT TCP, when hole punching doesn’t work.
ICE: Interactive Connectivity Establishment
Just a combination of STUN and TURN, and automatically switches between the two.

Advertisements

Vue on sale


Sony PlayStation Vue’s Core Plan is on sale for just $40, regular $50
and they have beautiful office locally in SF.

https://www.cordcuttersnews.com/playstation-vue-is-on-sale-ending-soon

Adaptive Streaming on Player Side


I beleive this is how the player switches from one resolution to another on HLS, but I have not found any documentation describing this process on the internet to verify.
First of all, simply switching from, e.g. HighRes0008.ts to LowRes0008.ts, doesn’t work.
1. Most often, HighRes0008.ts desn’t start with a IDR, which make descoding this segment impossible.
2. Even it starts with IDR, they may not be lined up on the frame level.
How the player switch:
1. In preparation to switch to lower resolution, player traces backward on the low resolution play list until it reaches an IDR.
2. based on the PTS on the high resolution playlist, it decides the PTS on the low resolution playlist, which is being switched to. Assuming the destination frame number ID is frame# 481.
3. decodes the low resolution playlist, from IDR to frame# 481, and renders that frame when time comes.
.ts segment contains PES, which in turn contains ES. The PTS is in the PES header.
PCR is only at the .ts layer, which I don’t think is needed in this use case, as long as PTS for audio and video are based on same PCR.
The same layer structure applies to audio too: TS – PES – ES (e.g. hold AAC data)

Special Years


I notice 1900 1970 and 1601 are used in time presentation.
1900: ts.tm_year is number of year since 1900.
ts is a struct, returned by localtime and gmtime, and get converted to string by asctime
1970: time_t is the number of seconds since start of this year UTC. returned by time and mktime(tm)
This is called Epoch AKA Unix timestamps and POSIX time. converted to string by ctime.
1601: FILETIME on Windows, 64bit, is the number of 0.1ms since start of this year in UTC
This year is the start of a 400-year cycle in Gregorian calendar.