口腔溃疡什么症状| 吃什么尿酸降得快| 总是干咳是什么原因| 心态崩了什么意思| 科班出身是什么意思| 置换补贴什么意思| 隐形眼镜没有护理液用什么代替| rem是什么意思| 199年属什么生肖| 溺爱什么意思| 脑梗塞吃什么食物好| 女生什么时候最容易怀孕| 黄粱是什么意思| 肾阴虚有什么症状表现| 什么时候种白菜| 一黑一白是什么蛇| camel是什么牌子| 小心地什么| 比宇宙还大的是什么| 糖尿病适合吃什么水果| 孩子记忆力差是什么原因| 诸行无常是什么意思| 腾冲有什么好玩的景点| 山东都有什么大学| 胃炎伴糜烂是什么意思| 酸碱度偏低是什么原因| 什么霄云外| 备货是什么意思| 肺有问题会出现什么症状| 带状疱疹什么不能吃| 马子是什么意思| 产后能吃什么水果| 水煮鱼用什么鱼| 荷花和莲花有什么区别| 口腔溃疡反复发作是什么原因| 山药炖什么好吃| 血压高吃什么好| 什么补肾效果最好| 日光性皮炎用什么药膏| 盎司是什么单位| 结肠炎吃什么药最见效| 肝不好看什么科| 闰六月有什么讲究| 哺乳期感冒了能吃什么药| 遗精是什么感觉| 2005年什么年| qt是什么意思| 层出不穷是什么意思| 多巴胺是什么意思| 哺乳期抽烟对宝宝有什么影响| 2月24是什么星座| 怀孕有什么表现| dna由什么组成| 血脂查什么项目| 哪吒他妈叫什么名字| 量贩装是什么意思| 胆固醇高吃什么食物最好| 不眠夜是什么意思| 前列腺炎吃什么好| 人得猫癣用什么药| 多囊是什么症状| 个人简历籍贯填什么| 什么凝视| 婴儿42天检查什么项目| 紫癜是什么病| 月经黑褐色是什么原因| 六月份生日是什么星座| 鼻腔有臭味是什么原因| 结肠炎是什么原因引起的| 欧阳修字什么号什么| 色斑是什么原因引起的| 产检挂什么科| 梦见打死蛇是什么预兆| 张柏芝什么星座| 什么是天乙贵人| 什么是职业道德| 珍珠米是什么米| 脑萎缩挂什么科| 百忧解是什么药| 为什么不建议年轻人做肠镜| 胰头占位是什么病| 医学ca是什么意思| 煮花生放什么调料好吃| 0.5是什么意思| 细菌性阴道炎吃什么药| 孕期吃什么好| 甘油三酯高吃什么药| otc是什么| 女性胃火旺吃什么药| 透声差是什么意思| esd是什么| 淋巴挂什么科室| 猫咪能吃什么水果| 香港的别称是什么| 哈达是什么| 两边太阳胀痛什么原因引起的| 什么情况下会流前列腺液| 长期吃泡面有什么危害| pc是什么单位| 干咳吃什么药效果好| 衬衫配什么裤子好看| 世界八大奇迹分别是什么| 怀孕第一天有什么症状| 淡盐水是什么| 突然耳朵疼是什么原因| 肃穆是什么意思| 美国什么时候建国的| 今年7岁属什么生肖| 百日咳是什么引起的| 1985年出生是什么命| 血管痉挛是什么症状| 脂肪肝轻度是什么意思| 老年人喝什么蛋白粉好| 小腹胀痛什么原因| 三叉神经痛挂什么科就诊| 肛裂是什么感觉| 西洋参跟花旗参有什么区别| 山见念什么| 积水是什么意思| 1月13日是什么星座| 早搏是什么症状| 尿特别黄是什么原因| 感冒了吃什么食物最好| 秦始皇为什么要焚书坑儒| 孕妇梦见下雪是什么征兆| 四月十六日是什么星座| 8月7号是什么星座| 唯字五行属什么| 谣言是什么意思| 榴莲对孕妇有什么好处| 深静脉血栓有什么症状| 黄占读什么| 风俗是什么意思| 妊娠期是指什么时候| 生物制剂对人体有什么副作用| 地图舌吃什么好得快| 眼睛流泪用什么药| 茶壶嘴为什么不能对着人| 手足口病用什么药最好| 唯字五行属什么| 什么除草剂三年不长草| 青云志3什么时候上映| 总胆红素偏高是什么病| 右侧卵巢囊性结构是什么意思| 地什么人什么| 2004年是什么生肖| 爱戴是什么意思| 西南方向是什么方位| 股票洗盘是什么意思| 翻车鱼为什么叫翻车鱼| 吃杨梅有什么好处和功效| 马马虎虎指什么生肖| 为什么会一直放屁| 脂肪肝吃什么药治疗| 巨细胞病毒是什么病| 告辞是什么意思| 可见原始心管搏动是什么意思| 什么人不能喝蜂蜜| 武汉有什么好玩的| 1978年是什么年| 浮现是什么意思| 胃镜是什么| 什么叫雷达| 撒贝宁是什么民族| 孩子肚子疼挂什么科| 荸荠又叫什么| 束在什么情况下读su| 发生火灾时的正确做法是什么| 瘘管是什么症状| 西安什么山| 一个巾一个占念什么| 犹太人为什么不受欢迎| 21三体高风险是什么意思| 定海神针是什么意思| 出cos是什么意思| 耳鼻喉科属于什么科| serum是什么意思| 冰箱里有什么细菌| 宫缩什么感觉| 薏米有什么作用| 龟兔赛跑的故事告诉我们什么道理| 什么的图案| 使用年限是什么意思| 低压108有什么危险| 干细胞移植是什么意思| 1025是什么星座| 荷字五行属什么| 几斤几两是什么意思| 小儿咳嗽吃什么药好| 亵玩是什么意思| cm和mm有什么区别| 丙烯是什么| 卡密什么意思| 液蜡是什么| 淋巴结增大是什么原因严重吗| 冰点是什么意思| 疤痕增生是什么引起的| 横空出世什么意思| 右手有痣代表什么| 缺维生素e有什么症状| 脊背疼是什么原因| 抗核抗体阳性说明什么| 书五行属性是什么| 咳嗽肺疼是什么原因| 吃了西瓜不能吃什么| 眼睛总有眼屎是什么原因| mg是什么元素| 乌龟用什么呼吸| 为什么打哈欠会流泪| 黑裤子配什么颜色的鞋| 比萨斜塔为什么是斜的| mri是什么检查项目| 医生为什么喜欢开地塞米松| 东成西就是什么生肖| 寄生虫感染吃什么药| 缺钾最忌讳吃什么| 咳嗽干呕是什么原因| 一个壳一个心念什么| 女人排卵是什么时候| 璟字五行属什么| 潮喷是什么意思| 孕早期宫缩是什么感觉| 子宫直肠陷凹什么意思| 月经来了痛经吃什么药| 虎毒不食子是什么意思| 蛋清加蜂蜜敷脸有什么好处| 眼睛干痒用什么眼药水| 肋骨下面是什么部位| 2型糖尿病是什么意思| 肾阴虚是什么原因造成的| 拔智齿后要注意什么| 孕期什么时候补铁| 有什么方法可以快速入睡| 首鼠两端是什么意思| 金字旁加全字念什么| 老人手抖是什么病的预兆| 上火便秘吃什么药| 经期适合吃什么| 菊花和什么一起泡最好| 天天喝奶茶有什么危害| 做颈动脉彩超挂什么科| 意什么风发| 什么是可转债| 尿肌酐低是什么原因| 容忍是什么意思| usim卡是什么卡| 吃过期药有什么危害| 独角仙吃什么食物| 丑五行属什么| 农历六月初四是什么日子| 什么叫做亚健康| 欣喜若狂的近义词是什么| 什么叫野鸡大学| 放屁臭鸡蛋味什么原因| 血压低会出现什么症状| 玺什么意思| 小孩脚底脱皮是什么原因造成的| 全脂牛奶是什么意思| 后羿是一个什么样的人| 盲从什么意思| 待产是什么意思| 产检挂什么科| 03属什么| jdv是什么牌子| 百度

银行薪资待遇揭秘-中信银行每个星期都要接受业务


Directory: ../../../ffmpeg/
File: src/libavformat/rtpdec_vp9.c
Date: 2025-08-04 00:43:16
Exec Total Coverage
Lines: 0 129 0.0%
Functions: 0 3 0.0%
Branches: 0 68 0.0%

Line Branch Exec Source
1 /*
2 * RTP parser for VP9 payload format (draft version 02) - experimental
3 * Copyright (c) 2015 Thomas Volkert <thomas@homer-conferencing.com>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #include "libavutil/intreadwrite.h"
23
24 #include "avio_internal.h"
25 #include "rtpdec_formats.h"
26
27 #define RTP_VP9_DESC_REQUIRED_SIZE 1
28
29 struct PayloadContext {
30 AVIOContext *buf;
31 uint32_t timestamp;
32 };
33
34 static av_cold int vp9_init(AVFormatContext *ctx, int st_index,
35 PayloadContext *data)
36 {
37 av_log(ctx, AV_LOG_WARNING,
38 "RTP/VP9 support is still experimental\n");
39
40 return 0;
41 }
42
43 static int vp9_handle_packet(AVFormatContext *ctx, PayloadContext *rtp_vp9_ctx,
44 AVStream *st, AVPacket *pkt, uint32_t *timestamp,
45 const uint8_t *buf, int len, uint16_t seq,
46 int flags)
47 {
48 int has_pic_id, has_layer_idc, has_ref_idc, has_ss_data;
49 av_unused int pic_id = 0, non_key_frame = 0, inter_picture_layer_frame;
50 av_unused int layer_temporal = -1, layer_spatial = -1, layer_quality = -1;
51 int ref_fields = 0, has_ref_field_ext_pic_id = 0;
52 int first_fragment, last_fragment;
53 int rtp_m;
54 int res = 0;
55
56 /* drop data of previous packets in case of non-continuous (lossy) packet stream */
57 if (rtp_vp9_ctx->buf && rtp_vp9_ctx->timestamp != *timestamp)
58 ffio_free_dyn_buf(&rtp_vp9_ctx->buf);
59
60 /* sanity check for size of input packet: 1 byte payload at least */
61 if (len < RTP_VP9_DESC_REQUIRED_SIZE + 1) {
62 av_log(ctx, AV_LOG_ERROR, "Too short RTP/VP9 packet, got %d bytes\n", len);
63 return AVERROR_INVALIDDATA;
64 }
65
66 /*
67 * decode the required VP9 payload descriptor according to section 4.2 of the spec.:
68 *
69 * 0 1 2 3 4 5 6 7
70 * +-+-+-+-+-+-+-+-+
71 * |I|P|L|F|B|E|V|-| (REQUIRED)
72 * +-+-+-+-+-+-+-+-+
73 *
74 * I: PictureID present
75 * P: Inter-picture predicted layer frame
76 * L: Layer indices present
77 * F: Flexible mode
78 * B: Start of VP9 frame
79 * E: End of picture
80 * V: Scalability Structure (SS) present
81 */
82 has_pic_id = !!(buf[0] & 0x80);
83 inter_picture_layer_frame = !!(buf[0] & 0x40);
84 has_layer_idc = !!(buf[0] & 0x20);
85 has_ref_idc = !!(buf[0] & 0x10);
86 first_fragment = !!(buf[0] & 0x08);
87 last_fragment = !!(buf[0] & 0x04);
88 has_ss_data = !!(buf[0] & 0x02);
89
90 rtp_m = !!(flags & RTP_FLAG_MARKER);
91
92 /* sanity check for markers: B should always be equal to the RTP M marker */
93 if (last_fragment != rtp_m) {
94 av_log(ctx, AV_LOG_ERROR, "Invalid combination of B and M marker (%d != %d)\n", last_fragment, rtp_m);
95 return AVERROR_INVALIDDATA;
96 }
97
98 /* pass the extensions field */
99 buf += RTP_VP9_DESC_REQUIRED_SIZE;
100 len -= RTP_VP9_DESC_REQUIRED_SIZE;
101
102 /*
103 * decode the 1-byte/2-byte picture ID:
104 *
105 * 0 1 2 3 4 5 6 7
106 * +-+-+-+-+-+-+-+-+
107 * I: |M|PICTURE ID | (RECOMMENDED)
108 * +-+-+-+-+-+-+-+-+
109 * M: | EXTENDED PID | (RECOMMENDED)
110 * +-+-+-+-+-+-+-+-+
111 *
112 * M: The most significant bit of the first octet is an extension flag.
113 * PictureID: 8 or 16 bits including the M bit.
114 */
115 if (has_pic_id) {
116 /* check for 1-byte or 2-byte picture index */
117 if (buf[0] & 0x80) {
118 if (len < 2) {
119 av_log(ctx, AV_LOG_ERROR, "Too short RTP/VP9 packet\n");
120 return AVERROR_INVALIDDATA;
121 }
122 pic_id = AV_RB16(buf) & 0x7fff;
123 buf += 2;
124 len -= 2;
125 } else {
126 pic_id = buf[0] & 0x7f;
127 buf++;
128 len--;
129 }
130 }
131
132 /*
133 * decode layer indices
134 *
135 * 0 1 2 3 4 5 6 7
136 * +-+-+-+-+-+-+-+-+
137 * L: | T | S | Q | R | (CONDITIONALLY RECOMMENDED)
138 * +-+-+-+-+-+-+-+-+
139 *
140 * T, S and Q are 2-bit indices for temporal, spatial, and quality layers.
141 * If "F" is set in the initial octet, R is 2 bits representing the number
142 * of reference fields this frame refers to.
143 */
144 if (has_layer_idc) {
145 if (len < 1) {
146 av_log(ctx, AV_LOG_ERROR, "Too short RTP/VP9 packet\n");
147 return AVERROR_INVALIDDATA;
148 }
149 layer_temporal = buf[0] & 0xC0;
150 layer_spatial = buf[0] & 0x30;
151 layer_quality = buf[0] & 0x0C;
152 if (has_ref_idc) {
153 ref_fields = buf[0] & 0x03;
154 if (ref_fields)
155 non_key_frame = 1;
156 }
157 buf++;
158 len--;
159 }
160
161 /*
162 * decode the reference fields
163 *
164 * 0 1 2 3 4 5 6 7
165 * +-+-+-+-+-+-+-+-+ -\
166 * F: | PID |X| RS| RQ| (OPTIONAL) .
167 * +-+-+-+-+-+-+-+-+ . - R times
168 * X: | EXTENDED PID | (OPTIONAL) .
169 * +-+-+-+-+-+-+-+-+ -/
170 *
171 * PID: The relative Picture ID referred to by this frame.
172 * RS and RQ: The spatial and quality layer IDs.
173 * X: 1 if this layer index has an extended relative Picture ID.
174 */
175 if (has_ref_idc) {
176 while (ref_fields) {
177 if (len < 1) {
178 av_log(ctx, AV_LOG_ERROR, "Too short RTP/VP9 packet\n");
179 return AVERROR_INVALIDDATA;
180 }
181
182 has_ref_field_ext_pic_id = buf[0] & 0x10;
183
184 /* pass ref. field */
185 if (has_ref_field_ext_pic_id) {
186 if (len < 2) {
187 av_log(ctx, AV_LOG_ERROR, "Too short RTP/VP9 packet\n");
188 return AVERROR_INVALIDDATA;
189 }
190
191 /* ignore ref. data */
192
193 buf += 2;
194 len -= 2;
195 } else {
196
197 /* ignore ref. data */
198
199 buf++;
200 len--;
201 }
202 ref_fields--;
203 }
204 }
205
206 /*
207 * decode the scalability structure (SS)
208 *
209 * 0 1 2 3 4 5 6 7
210 * +-+-+-+-+-+-+-+-+
211 * V: | PATTERN LENGTH|
212 * +-+-+-+-+-+-+-+-+ -\
213 * | T | S | Q | R | (OPTIONAL) .
214 * +-+-+-+-+-+-+-+-+ -\ .
215 * | PID |X| RS| RQ| (OPTIONAL) . . - PAT. LEN. times
216 * +-+-+-+-+-+-+-+-+ . - R times .
217 * X: | EXTENDED PID | (OPTIONAL) . .
218 * +-+-+-+-+-+-+-+-+ -/ -/
219 *
220 * PID: The relative Picture ID referred to by this frame.
221 * RS and RQ: The spatial and quality layer IDs.
222 * X: 1 if this layer index has an extended relative Picture ID.
223 */
224 if (has_ss_data) {
225 int n_s, y, g, i;
226 if (len < 1) {
227 av_log(ctx, AV_LOG_ERROR, "Too short RTP/VP9 packet\n");
228 return AVERROR_INVALIDDATA;
229 }
230 n_s = buf[0] >> 5;
231 y = !!(buf[0] & 0x10);
232 g = !!(buf[0] & 0x08);
233 buf++;
234 len--;
235 if (n_s > 0) {
236 avpriv_report_missing_feature(ctx, "VP9 scalability structure with multiple layers");
237 return AVERROR_PATCHWELCOME;
238 }
239 if (y) {
240 if (len < 4 * (n_s + 1)) {
241 av_log(ctx, AV_LOG_ERROR, "Too short RTP/VP9 packet\n");
242 return AVERROR_INVALIDDATA;
243 }
244 for (i = 0; i < n_s + 1; i++) {
245 av_unused int w, h;
246 w = AV_RB16(buf);
247 h = AV_RB16(buf + 2);
248 buf += 4;
249 len -= 4;
250 }
251 }
252 if (g) {
253 int n_g;
254 if (len < 1) {
255 av_log(ctx, AV_LOG_ERROR, "Too short RTP/VP9 packet\n");
256 return AVERROR_INVALIDDATA;
257 }
258 n_g = buf[0];
259 buf++;
260 len--;
261 for (i = 0; i < n_g; i++) {
262 av_unused int t, u, r, j;
263 if (len < 1) {
264 av_log(ctx, AV_LOG_ERROR, "Too short RTP/VP9 packet\n");
265 return AVERROR_INVALIDDATA;
266 }
267 t = buf[0] >> 5;
268 u = !!(buf[0] & 0x10);
269 r = (buf[0] >> 2) & 0x03;
270 buf++;
271 len--;
272 if (len < r) {
273 av_log(ctx, AV_LOG_ERROR, "Too short RTP/VP9 packet\n");
274 return AVERROR_INVALIDDATA;
275 }
276 for (j = 0; j < r; j++) {
277 av_unused int p_diff = buf[0];
278 buf++;
279 len--;
280 }
281 }
282 }
283 }
284
285 /*
286 * decode the VP9 payload header
287 *
288 * spec. is tbd
289 */
290 //XXX: implement when specified
291
292 /* sanity check: 1 byte payload as minimum */
293 if (len < 1) {
294 av_log(ctx, AV_LOG_ERROR, "Too short RTP/VP9 packet\n");
295 return AVERROR_INVALIDDATA;
296 }
297
298 /* start frame buffering with new dynamic buffer */
299 if (!rtp_vp9_ctx->buf) {
300 /* sanity check: a new frame should have started */
301 if (first_fragment) {
302 res = avio_open_dyn_buf(&rtp_vp9_ctx->buf);
303 if (res < 0)
304 return res;
305 /* update the timestamp in the frame packet with the one from the RTP packet */
306 rtp_vp9_ctx->timestamp = *timestamp;
307 } else {
308 /* frame not started yet, need more packets */
309 return AVERROR(EAGAIN);
310 }
311 }
312
313 /* write the fragment to the dyn. buffer */
314 avio_write(rtp_vp9_ctx->buf, buf, len);
315
316 /* do we need more fragments? */
317 if (!last_fragment)
318 return AVERROR(EAGAIN);
319
320 /* close frame buffering and create resulting A/V packet */
321 res = ff_rtp_finalize_packet(pkt, &rtp_vp9_ctx->buf, st->index);
322 if (res < 0)
323 return res;
324
325 return 0;
326 }
327
328 static void vp9_close_context(PayloadContext *vp9)
329 {
330 ffio_free_dyn_buf(&vp9->buf);
331 }
332
333 const RTPDynamicProtocolHandler ff_vp9_dynamic_handler = {
334 .enc_name = "VP9",
335 .codec_type = AVMEDIA_TYPE_VIDEO,
336 .codec_id = AV_CODEC_ID_VP9,
337 .priv_data_size = sizeof(PayloadContext),
338 .init = vp9_init,
339 .close = vp9_close_context,
340 .parse_packet = vp9_handle_packet
341 };
342

两岁宝宝拉肚子吃什么药 尿酸高的人不能吃什么 小肠气是什么病 做梦梦见出车祸是什么征兆 肾腺瘤是什么病严重吗
七星鱼吃什么食物 查血清能查出什么病 麻腮风疫苗是预防什么 loa是什么胎位 红酒兑什么好喝
脂肪肝是什么原因造成的 征文是什么 大米发霉是什么样子 为什么突然得了荨麻疹 橘子是什么季节的水果
芙字五行属什么 男生生理期是什么表现 3月12日是什么星座 慢性病是什么意思 经常吐口水是什么原因
暴发火眼吃什么药hcv9jop6ns2r.cn 坐南朝北是什么意思hcv7jop6ns2r.cn 怡什么意思hcv8jop3ns0r.cn 排斥一个人什么意思helloaicloud.com 查心电图挂什么科chuanglingweilai.com
破屋什么意思hcv9jop2ns4r.cn 吃了小龙虾不能吃什么xinjiangjialails.com 1月19号是什么星座hcv7jop5ns1r.cn 红枸杞有什么功效hcv8jop5ns6r.cn 什么高什么低hcv7jop9ns4r.cn
鱼鳞云代表什么天气bjcbxg.com 低盐饮食有利于预防什么hcv8jop4ns1r.cn 预检是什么意思hcv9jop6ns1r.cn 胆碱酯酶偏高说明什么hcv8jop7ns5r.cn 无创是什么helloaicloud.com
饱的偏旁叫什么hcv9jop2ns1r.cn 男人精子少吃什么药youbangsi.com 五月底是什么星座xinjiangjialails.com 止咳化痰什么药最好hcv9jop4ns3r.cn 颈部有肿块看什么科室hcv8jop3ns3r.cn
百度