82 Matching Annotations
  1. Feb 2024
    1. client的TCP协议栈发送 ZeroWindow 标志给服务端。也就是接收端的 buffer 堆满了(但是服务端这个时候看到的bytes in fly是0,因为都ack了)

      接收端缓冲区满是因为应用程序没有及时读取,不是因为网络延时高

  2. Dec 2023
  3. Nov 2023
    1. 一些显而易见的访问无效内存操作可能会被编译器优化而会漏报。

      最好将 -Os 改成 -O

  4. Sep 2023
    1. 然后使用我发布的 public key 对 (1) 拿到的秘文进行解密,对比 hash 值,如果一样,说明确实 private key 的持有者加密的;

      浏览器内置了CA提供的公钥

    2. 使用 private key 加密

      CA签发给网站的是对证书进行hash后的加密值

  5. Mar 2023
    1. an integral (积分) hash is computed for each item, then this hash is used as an index in a table where the items are stored. If many items end up in the same slot (槽) , they are chained, as in a linked list. Conceptually, it looks like this:

      为每个项目计算一个积分哈希值,然后这个哈希值被用作存储项目的表格中的索引。如果许多项目最终出现在同一个槽中,它们就会被链起来,就像在一个链接列表中一样。从概念上讲,它看起来像这样。

    2. Just like in the initial code, we search the map using std::map::find, but now we store the result in a local variable. The result is an iterator that we can compare with entries.end(), as before. Now, if the iterator is not the end iterator, then we can get the value from the map by dereferencing the iterator and accessing its second member.

      通过将 find 返回的结构体保存在 iter 中避免重复调用 find

    1. Sometimes, a very small Time-To-Live (TTL) can result in important data being removed from the CDN, resulting in longer round-trips back to your video origin server.

      有时,非常小的生存时间 (TTL) 会导致重要数据从 CDN 中删除,从而导致返回视频源服务器的往返时间更长。

    2. A good rule of thumb (拇指) is to start with the lowest bitrate rendition and slowly increase the quality based on the network condition, and then, you can expect low startup delays.

      一个好的经验法则是从最低比特率再现开始,然后根据网络状况慢慢提高质量,然后,您可以预期较低的启动延迟。

    3. If you are using ABR video streaming, the video probably has four or five renditions and the player will pick one of the renditions after inspecting (检查) the network conditions. You can expect a long startup delay if this rendition is wrong (w.r.t the network condition).

      如果您使用的是 ABR 视频流,视频可能有四到五个版本,播放器会在检查网络状况后选择其中一个版本。如果此再现错误(w.r.t 网络条件),您可能会遇到很长的启动延迟。

  6. Feb 2023
    1. 如果你查看了我们之前输出的帧相关信息,你会发现图像类型信息包含在pict_type 中。

      可以查看对应的帧是 I 帧 还是 P 帧

    1. The new standard will be called MPEG-5 Essential (必不可少) Video Coding (EVC) and is expected to reach FDIS in January 2020

      第14代视频编码标准

    2. Thirteen is a large number for video coding standards but this number should be measured (措施) against the number of years covered – close to 40. In this long period of time we have gone from 3 initial (初始) standards that were mostly application/industry-specific (H.120, MPEG-1 and H.261) to a series of generic (i.e. industry-neutral) standards (MPEG-2, MPEG-4 Visual, MPEG-4 AVC and HEVC) and then to a group of standards that sought (寻求) to achieve Option 1 status (WebVC, IVC and VCB). Other proprietary video coding formats that have found significant (显著) use in the market point to the fact that MPEG cannot stay forever (永远) in its ivory tower of “best video coding standards no matter what”. MPEG has to face the reality of a market that becomes more and more diversified and where – unlike the golden age of a single coding standard – there is no longer one size that fits all

      十三对于视频编码标准来说是一个很大的数字,但这个数字应该根据涵盖的年数来衡量——接近 40 年。在这段漫长的时间里,我们已经从 3 个主要针对特定​​应用程序/行业的初始标准(H. 120、MPEG-1 和 H.261)到一系列通用(即行业中立)标准(MPEG-2、MPEG-4 Visual、MPEG-4 AVC 和 HEVC),然后到一组旨在实现的标准选项 1 状态(WebVC、IVC 和 VCB)。在市场上发现重要用途的其他专有视频编码格式表明 MPEG 不能永远停留在其“无论如何都是最佳视频编码标准”的象牙塔中。 MPEG 必须面对一个市场变得越来越多样化的现实——与单一编码标准的黄金时代不同

    3. For the third time MPEG and ITU are collaborating in the development of a new video coding standard with the target of a 50% reduction (还原) of bitrate compared to HEVC. The development of Versatile (多才多艺) Video Coding (VVC),

      第 14 代视频编码标准 VVC,预期比 HEVC 提升 50% 的编码效率

    4. After that HEVC has been enriched with a number of features that at the time of development were not supported by previous standards such as High Dynamic Range (HDR) and Wide Colour Gamut (WCG)

      H.265 支持 HDR 和 WCG 等特性

      同时因为专利授权等问题,无法得到推广

    5. the HEVC Verification Tests showed that the standard had achieved 60% improvement on AVC, 10% more than originally planned

      比 H.264 编码效率提升了 60%

    6. In 2010 MPEG and VCEG extended their collaboration (协作) to a new project: High Efficiency (效率) Video Coding (HEVC)

      HEVC/H.265 是第9代视频编码标准

    7. The standard is called Advanced Video Coding by both MPEG and ITU, but is labelled as AVC by MPEG and as H.264 by ITU-T.

      H.264 是第 7 代视频编码标准

    8. MPEG-4 Visual suffered (受苦) a devastating (摧毁) blow (吹) by a patent pool that decided to impose (施加) “content fees (费) ” on their licensing term

      H.263 免费,MPEG-4 Visual 需要支付专利费

    9. H.263 focused on low bitrate video communication, while MPEG-4 Visual kept on making real the vision (视觉) of extending video coding to more industries

      H.263专注于低码率视频通信,而MPEG-4 Visual则不断实现将视频编码扩展到更多行业的愿景

    10. The conjunction (连词) of the two standards is a very tiny code that simply tells the decoder that a bitstream is H.263 or MPEG-4 Visual

      ITU-T 制定了 H.263

      MPEG 制定了 MPEG-4

    11. The first international standard that used video coding techniques (技术) – ITU-T Recommendation (推荐) H.120

      第1代视频编码标准

    1. The memfd_create function returns a file descriptor which can be used to create memory mappings using the mmap function. It is similar to the shm_open function in the sense that these mappings are not backed by actual files. However, the descriptor returned by memfd_create does not correspond to a named object; the name argument is used for debugging purposes only (e.g., will appear in /proc), and separate invocations of memfd_create with the same name will not return descriptors for the same region of memory. The descriptor can also be used to create alias mappings within the same process

      memfd_create函数返回一个文件描述符,它可以用来使用mmap函数创建内存映射。它与shm_open函数类似,因为这些映射没有实际文件的支持。然而,memfd_create返回的描述符并不对应于一个命名的对象;名称参数仅用于调试目的(例如,将出现在/proc中),以相同的名称单独调用memfd_create将不会返回同一内存区域的描述符。该描述符也可以用来在同一进程中创建别名映射

    2. This function returns a file descriptor that can be used to allocate shared memory via mmap. Unrelated processes can use same name to create or open existing shared memory objects.

      该函数返回一个文件描述符,可用于通过mmap分配共享内存。不相关的进程可以使用相同的名称来创建或打开现有的共享内存对象。

    3. This function can be used to provide the system with advice about the intended usage patterns of the memory region starting at addr and extending length bytes.

      这个函数可以用来向系统提供关于从addr开始的内存区域的预期使用模式的建议,并延长长度字节。

    4. Not all file descriptors may be mapped. Sockets, pipes, and most devices only allow sequential access and do not fit into the mapping abstraction. In addition, some regular files may not be mmapable, and older kernels may not support mapping at all. Thus, programs using mmap should have a fallback method to use should it fail.

      不是所有的文件描述符都可以被映射。套接字、管道和大多数设备只允许顺序访问,不适合映射抽象。此外,一些普通的文件可能不能被映射,而旧的内核可能根本不支持映射。因此,使用mmap的程序应该有一个后备方法,以便在它失败时使用。

    5. This function is only available on a few systems. Except for performing optional optimizations one should not rely on this function.

      这个函数只在少数系统上可用。除了执行可选的优化之外,人们不应该依赖这个函数。

    6. This function can be used to change the size of an existing memory area. address and length must cover a region entirely mapped in the same mmap statement. A new mapping with the same characteristics will be returned with the length new_length.

      这个函数可以用来改变现有内存区域的大小。地址和长度必须涵盖在同一个mmap语句中完全映射的区域。一个具有相同特征的新映射将被返回,长度为new_length。

    7. only entire pages can be removed. If length is not an even number of pages, it will be rounded up

      去映射的内存大小必须是页的整数倍,不足的部分会强制按页大小对齐

    8. To determine the default size of a page the machine uses one should use

      确认机器的默认页大小

    1. Processes can insert control over this issue by using the msync() function. This function takes a flags parameter that can initiate a synchronous, blocking write (MS_SYNC) or an asynchronous, non-blocking one (MS_ASYNC). In the case of the asynchronous write, the data will get copied to disk at a later point; however, the updated data would be immediately available to any process that reads from the file with read().

      即使不调用 msync 被修改的数据也能写回文件,但是写回的时机不可控,通过 msync 可以控制写回文件的时机。同时通过 flags 参数可以控制同步或异步写入

    2. When a file is mapped into memory with mmap(), the kernel will occasionally (偶尔) trigger (触发) a write to copy updated portions (部分) back to disk

      内核会随机触发写操作,降更新部分写回磁盘

    3. Note that setting up the regions in both processes is an expensive operation in terms of execution time; however, once the region is set up, data is exchanged immediately

      请注意,就执行时间而言,在两个进程中设置区域是一个昂贵的操作;然而,一旦区域被设置好,数据就会立即被交换。

    4. That is, when one process writes to the region, that data is immediately accessible by the other process without having to invoke a system call.

      在一个进程内的修改立刻可以在另一个进程生效,无需调用额外的系统调用

    5. Memory-mapped files allow for multiple processes to share read-only access to a common file

      内存映射的文件允许多个进程共享对一个共同文件的只读访问权

    1. This is offset from where the file mapping started. In simple terms, the mapping connects to (offset) to (offset+length-1) bytes for the file open on filedes descriptor.

      控制映射地址在文件中的起始偏移量

    2. When this flag is used, the system has to be forced to use the exact (确切) mapping address specified in the address If this is not possible, then the mapping will be failed.

      当使用这个标志时,系统必须强制使用地址中指定的准确的映射地址 如果这不可能,那么映射将被失败。

    3. Anonymous mapping means the mapping is not connected to any files. This mapping is used as the basic primitive (原始) to extend the heap .

      这种映射被用作扩展堆的基本原素。

    4. MAP_PRIVATE: When this flag is used, the mapping will not be seen by any other processes, and the changes made will not be written to the file.

      当使用这个标志时,其他进程不会看到该映射,所做的修改也不会被写入文件。

    1. The standard also describes the process of registering new payload types with IANA; additional payload formats and payload types are defined in the following specifications:

      RFC 3551 定义以外的负载类型,通过下面的 RFC 文档定义

  7. Nov 2022
    1. WebRTC, on the other hand, is becoming more and more popular. However, it still faces one major limitation : it is not widely supported by most encoders. The same goes for other streaming software, like production (生产) and mixing tools.

      WebRTC正变得越来越流行。然而,它仍然面临一个主要的限制:它没有被大多数编码器广泛支持。其他流媒体软件也是如此,如制作和混合工具。

    2. Different circumstances (情况) call for unique streaming setups and protocols. Currently, HLS delivery with RTMP ingest is the chosen combination (组合) in many streaming setups. That is because it ticks (蜱) the boxes of low latency, ultra-compatibility, and affordability.

      不同的情况需要独特的流媒体设置和协议。目前,HLS传输和RTMP摄取是许多流媒体设置中选择的组合。这是因为它满足了低延迟、超兼容性和可负担性等条件。

    3. Aside (一旁) from streaming with real-time latency, WebRTC is very secure . It is encrypted with SRTP and other gold-standard security measures (措施) . Like HLS, WebRTC is capable of adaptive bitrate streaming, so you can deliver multiple (多个) renditions of your stream with the optimal quality (质量) for each viewer .

      除了具有实时延迟的流媒体之外,WebRTC还非常安全。它是通过SRTP和其他黄金标准的安全措施进行加密的。像HLS一样,WebRTC能够自适应比特率流,所以你可以为每个观众提供具有最佳质量的流的多个版本。

    4. Although WebRTC is technically a project, it is typically lumped (肿块) in with protocols since their functionality is very similar .

      虽然WebRTC在技术上是一个项目,但由于其功能非常相似,通常被归入协议。

      WebRTC 不仅仅是一个协议还是一个项目

    5. It is also important to point out one major downfall of HLS: when used alone, it causes a latency of 15-30 seconds, which means that the HLS delivery/HLS ingest combination (组合) is not capable of streaming with latency as low as some as other setups.

      存在较大的延迟

    6. HLS can be used for both delivery and ingest, but it is currently more prominent (突出) for delivery since it is not widely compatible with most encoders.

      HLS 与大多数编解码器不兼容

    7. This protocol also supports adaptive bitrate streaming, which is very important at the professional broadcasting level. In addition to being adaptive, HLS is also dynamic . That means that at any given moment, the bitrate of each individual viewer’s stream will adjust to best suit the connection conditions .

      该协议还支持自适应比特率流,这在专业广播层面非常重要。除了自适应之外,HLS也是动态的。这意味着,在任何时候,每个观众的流媒体的比特率将调整到最适合连接条件。

      根据带宽选择不同的码率的视频源

    8. HLS is absolutely essential in most modern streaming setups since the HTML5 video player is the only type of universally compatible video player. Since HTML5 video players come with so many benefits , most broadcasters consider it the only viable (可行) option .

      HLS在大多数现代流媒体设置中是绝对必要的,因为HTML5视频播放器是唯一一种普遍兼容的视频播放器。由于HTML5视频播放器有如此多的好处,大多数广播公司认为它是唯一可行的选择。

    9. Unfortunately, RTMP is not compatible with more modern video players, including HTML5, so it is no longer used for delivery in any streaming setups. However, it is very effective in its ingestion role , so it is quite valuable in streaming. As with many types of technology, the role of RTMP continues to change.

      不幸的是,RTMP与更多的现代视频播放器(包括HTML5)不兼容,所以它不再用于任何流媒体设置中的传输。然而,它的摄取作用非常有效,因此在流媒体中相当有价值。与许多技术类型一样,RTMP的作用也在不断变化。

    10. There are several variations of RTMP that serve slightly (稍) different purposes. (change formatting) 

      RTMP 有多个变种协议

    11. It is now used for ingesting media from the encoder or other source to a video streaming platform.

      它现在被用于从编码器或其他来源摄取媒体到视频流平台。

    12. Real-Time Messaging Protocol (RTMP) is a streaming protocol that was originally used to deliver video content to Adobe’s Flash player. This protocol is known for its capability of low latency streaming.

      实时信息传输协议(RTMP)是一个流媒体协议,最初用于向Adobe的Flash播放器传输视频内容。该协议以其低延迟流的能力而闻名

    1. Prior (事先) to making any SNMP request from an authoritative SNMP engine, you will need to send it a discovery packet, basically an empty SNMP version 3 packet and wait for the REPORT message agent will send you. REPORT that you will receive includes authoritative SNMP engine ID, SNMP engine boots and SNMP engine time values that you need to use in subsequent requests.

      在向权威SNMP引擎提出任何SNMP请求之前,你需要向它发送一个发现包,基本上是一个空的SNMP版本3数据包,并等待agent将发送给你的REPORT消息。你将收到的REPORT包括权威SNMP引擎ID、SNMP引擎启动和SNMP引擎时间值,你需要在后续的请求中使用。

  8. Oct 2022
    1. The FFmpeg's "-re" flag means to "Read input at native frame rate.

      -re 选项表示按文件帧率进程串流,如果不用该选项可能导致播放帧率大于实际帧率,播放本地文件时常用

  9. Aug 2022
    1. 为了维护 CPU 时间,Linux 通过事先定义的节拍率(内核中表示为 HZ),触发时间中断,并使用全局变量 Jiffies 记录了开机以来的节拍数。每发生一次时间中断,Jiffies 的值就加 1。

      节拍率 HZ 是内核的可配选项,可以设置为 100、250、1000 等。不同的系统可能设置不同数值,你可以通过查询 /boot/config 内核选项来查看它的配置值。

      grep 'CONFIG_HZ=' /boot/config-$(uname -r) CONFIG_HZ=250

      CONFIG_HZ=250 表示每秒触发 250 次时间中断

      $ grep 'CONFIG_HZ=' /boot/config-$(uname -r) CONFIG_HZ=250

      /proc/stat 提供的就是系统的 CPU 和任务统计信息

  10. Jul 2022
    1. Linux 软中断

      软中断通常以内核线程的方式运行,每个 CPU 都对应一个软中断内核线程,这个软中断内核线程就叫做 ksoftirqd/CPU 编号。 通过 ps aux | grep softirq 可以查看软中段线程的运行情况(ps 的输出中,名字括在中括号里的,一般都是内核线程)。

      /proc/softirqs 提供了软中断的运行情况

      常见的软中断

      内核调度。

      网卡接收到数据包后,通过硬中断的方式,通知内核有新的数据到了,中断处理程序快速将网卡中的数据读到内存中。

      接下来通过软件中断,依据网络协议栈,逐层处理内存中数据。

  11. Jun 2022
    1. ARM、PowerPC (除PowerPC 970外)、DEC Alpha,SPARC V9,MIPS,PA-RISC and IA64等的字节序是可配置的

      ARM 平台字节序可配置

    1. asctime()将参数timeptr所指的tm结构中的信息转换成真实世界所使用的时间日期表示方法,然后将结果以字符串形态返回

      不含时区

    2. ctime()将参数timep所指的time_t结构中的信息转换成真实世界所使用的时间日期表示方法,然后将结果以字符串形态返回

      打印出的值,带时区

    3. gettimeofday(取得目前的时间)

      返回目前的时间,并提供时区信息

    1. 因程序逻辑需要而产生的信号(如SIGUSR1/ SIGUSR2和实时信号),被处理后程序继续正常运行,可考虑使用sigwait同步模型规避信号处理函数执行上下文不确定性带来的潜在风险。而对于硬件致命错误等导致程序运行终止的信号(如SIGSEGV),必须按照传统的异步方式使用 signal()或sigaction()注册信号处理函数进行非阻塞处理,以提高响应的实时性。在应用程序中,可根据所处理信号的不同而同时使用这两种信号处理模型。

      sigwait 属于同步信号处理模型,signal 和 sigaction 属于异步信号处理模型

    1. Signal 6 (SIGABRT) = SIGABRT is commonly used by libc and other libraries to abort the program in case of critical errors. For example, glibc sends an SIGABRT in case of a detected double-free or other heap corruptions

      signal 6 常见场景:1. double free 2. 堆越界

    1. The LD_LIBRARY_PATH environment variable defines the path to libraries

      LD_LIBRARY_PATH 环境变量定义了库的查找目录

    2. The ldd utility prints shared object dependencies

      ldd 工具可以用于打印依赖的动态库

    3. -l (lowercase L) sets the name of the library you want to link against

      -l 选项指定待链接的库名字

    4. -L (capital L) adds an additional library path to GCC's search locations

      -L 选项制定库查找路径

    5. The -c option prevents GCC from running a linker

      -c 选项阻止编译器执行链接动作

    6. By default, GCC assumes that libraries are in a system library path, such as /lib64 and /usr/lib64

      GCC 默认动态库查找路径

    1. GB28181中对PT的定义

      96~127 动态负载类型,同样是 H264 负载,不同应用场景所定义的 PT 值不同,一般由客户端决定

  12. May 2022
    1. This model describes a mechanism by which two RTP participants agree to a common subset of SDP codecs and settings

      这个模型描述了一种机制,通过这种机制,两个 RTP 参与者达成一致 使用 SDP 描述中编解码器和设置的一个公共子集

    2. Multiple media & Payload Types

      单个 SDP 定义多个媒体轨道

    3. It describes things such as the peer's host IP address, time bases, and summary description. Most of these values are optional, so they can be set to zero (0) or empty strings with a dash (-)

      有些字段是可选的,可以字段可以设置为 0 或 ‘-’

    4. These features might or might not be supported by both peers in an RTP session, and must be explicitly negotiated and enabled. This is typically done with the SDP negotiation, that we'll cover next.

      在 RTP 会话中,这些特性可能受到对等方的支持,也可能不受支持,并且必须显式地协商和启用。这通常是在 SDP 谈判中完成的,我们将在下面讨论这个问题。

    5. Again, this starts being an arbitrary random number, and then grows monotonically at the speed given by the media clock rate (defined by the Payload Type). Represents the instant of time when the media source was packetized into the RTP packet; the protocol doesn't use absolute timestamp values, but it uses differences between timestamps to calculate elapsed time between packets, which allows synchronization of multiple media streams (think lip sync between video and audio tracks), and also to calculate network latency and jitter

      时间戳 : 同样,这开始是一个任意的随机数,然后按照媒体时钟速率(由 Payload Type 定义)给出的速度单调增长。表示媒体源被打包到 RTP 数据包中的瞬间; 该协议没有使用绝对时间戳值,但是它使用时间戳之间的差异来计算数据包之间的运行时间,这允许多媒体流的同步(想想视频和音频轨道之间的唇同步) ,并且还计算网络延迟和抖动。

    6. This starts as an arbitrary random number, which then increments by one for each RTP data packet sent. Receivers can use these numbers to detect packet loss and to sort packets in case they are received out of order.

      序列号,首先是一个任意的随机数,然后每发送一个 RTP 数据包,随机数就递增一个。接收者可以使用这些数字来检测数据包丢失,并对数据包进行排序,以防收到的数据包不按顺序排列

    1. AES uses a fixed block size of 16-bytes. If a file is not a multiple of a block size, then AES uses padding to complete the block

      AES 加密后的数据是以 16 字节为一个块的,多个块的组合,如果原始数据不是块大小的整数倍,则会发生填充(数据量会变大)

    2. Anecdotal evidence suggests that files larger than 1 MB encrypted with AES tend to be around 35% larger than before encryption

      对大于 1MB 的文件进行加密,加密后的文件大概率会比原始数据大 35%