Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(439)

Side by Side Diff: source/patched-ffmpeg-mt/libavformat/rtpenc.c

Issue 3384002: ffmpeg source update for sep 09 (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * RTP output format 2 * RTP output format
3 * Copyright (c) 2002 Fabrice Bellard 3 * Copyright (c) 2002 Fabrice Bellard
4 * 4 *
5 * This file is part of FFmpeg. 5 * This file is part of FFmpeg.
6 * 6 *
7 * FFmpeg is free software; you can redistribute it and/or 7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public 8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version. 10 * version 2.1 of the License, or (at your option) any later version.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 case CODEC_ID_PCM_S16BE: 48 case CODEC_ID_PCM_S16BE:
49 case CODEC_ID_PCM_S16LE: 49 case CODEC_ID_PCM_S16LE:
50 case CODEC_ID_PCM_U16BE: 50 case CODEC_ID_PCM_U16BE:
51 case CODEC_ID_PCM_U16LE: 51 case CODEC_ID_PCM_U16LE:
52 case CODEC_ID_PCM_U8: 52 case CODEC_ID_PCM_U8:
53 case CODEC_ID_MPEG2TS: 53 case CODEC_ID_MPEG2TS:
54 case CODEC_ID_AMR_NB: 54 case CODEC_ID_AMR_NB:
55 case CODEC_ID_AMR_WB: 55 case CODEC_ID_AMR_WB:
56 case CODEC_ID_VORBIS: 56 case CODEC_ID_VORBIS:
57 case CODEC_ID_THEORA: 57 case CODEC_ID_THEORA:
58 case CODEC_ID_VP8:
58 return 1; 59 return 1;
59 default: 60 default:
60 return 0; 61 return 0;
61 } 62 }
62 } 63 }
63 64
64 static int rtp_write_header(AVFormatContext *s1) 65 static int rtp_write_header(AVFormatContext *s1)
65 { 66 {
66 RTPMuxContext *s = s1->priv_data; 67 RTPMuxContext *s = s1->priv_data;
67 int max_packet_size, n; 68 int max_packet_size, n;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 s->nal_length_size = (st->codec->extradata[4] & 0x03) + 1; 138 s->nal_length_size = (st->codec->extradata[4] & 0x03) + 1;
138 } 139 }
139 break; 140 break;
140 case CODEC_ID_VORBIS: 141 case CODEC_ID_VORBIS:
141 case CODEC_ID_THEORA: 142 case CODEC_ID_THEORA:
142 if (!s->max_frames_per_packet) s->max_frames_per_packet = 15; 143 if (!s->max_frames_per_packet) s->max_frames_per_packet = 15;
143 s->max_frames_per_packet = av_clip(s->max_frames_per_packet, 1, 15); 144 s->max_frames_per_packet = av_clip(s->max_frames_per_packet, 1, 15);
144 s->max_payload_size -= 6; // ident+frag+tdt/vdt+pkt_num+pkt_length 145 s->max_payload_size -= 6; // ident+frag+tdt/vdt+pkt_num+pkt_length
145 s->num_frames = 0; 146 s->num_frames = 0;
146 goto defaultcase; 147 goto defaultcase;
148 case CODEC_ID_VP8:
149 av_log(s1, AV_LOG_WARNING, "RTP VP8 payload is still experimental\n");
150 break;
147 case CODEC_ID_AMR_NB: 151 case CODEC_ID_AMR_NB:
148 case CODEC_ID_AMR_WB: 152 case CODEC_ID_AMR_WB:
149 if (!s->max_frames_per_packet) 153 if (!s->max_frames_per_packet)
150 s->max_frames_per_packet = 12; 154 s->max_frames_per_packet = 12;
151 if (st->codec->codec_id == CODEC_ID_AMR_NB) 155 if (st->codec->codec_id == CODEC_ID_AMR_NB)
152 n = 31; 156 n = 31;
153 else 157 else
154 n = 61; 158 n = 61;
155 /* max_header_toc_size + the largest AMR payload must fit */ 159 /* max_header_toc_size + the largest AMR payload must fit */
156 if (1 + s->max_frames_per_packet + n > s->max_payload_size) { 160 if (1 + s->max_frames_per_packet + n > s->max_payload_size) {
(...skipping 23 matching lines...) Expand all
180 { 184 {
181 RTPMuxContext *s = s1->priv_data; 185 RTPMuxContext *s = s1->priv_data;
182 uint32_t rtp_ts; 186 uint32_t rtp_ts;
183 187
184 dprintf(s1, "RTCP: %02x %"PRIx64" %x\n", s->payload_type, ntp_time, s->times tamp); 188 dprintf(s1, "RTCP: %02x %"PRIx64" %x\n", s->payload_type, ntp_time, s->times tamp);
185 189
186 s->last_rtcp_ntp_time = ntp_time; 190 s->last_rtcp_ntp_time = ntp_time;
187 rtp_ts = av_rescale_q(ntp_time - s->first_rtcp_ntp_time, (AVRational){1, 100 0000}, 191 rtp_ts = av_rescale_q(ntp_time - s->first_rtcp_ntp_time, (AVRational){1, 100 0000},
188 s1->streams[0]->time_base) + s->base_timestamp; 192 s1->streams[0]->time_base) + s->base_timestamp;
189 put_byte(s1->pb, (RTP_VERSION << 6)); 193 put_byte(s1->pb, (RTP_VERSION << 6));
190 put_byte(s1->pb, 200); 194 put_byte(s1->pb, RTCP_SR);
191 put_be16(s1->pb, 6); /* length in words - 1 */ 195 put_be16(s1->pb, 6); /* length in words - 1 */
192 put_be32(s1->pb, s->ssrc); 196 put_be32(s1->pb, s->ssrc);
193 put_be32(s1->pb, ntp_time / 1000000); 197 put_be32(s1->pb, ntp_time / 1000000);
194 put_be32(s1->pb, ((ntp_time % 1000000) << 32) / 1000000); 198 put_be32(s1->pb, ((ntp_time % 1000000) << 32) / 1000000);
195 put_be32(s1->pb, rtp_ts); 199 put_be32(s1->pb, rtp_ts);
196 put_be32(s1->pb, s->packet_count); 200 put_be32(s1->pb, s->packet_count);
197 put_be32(s1->pb, s->octet_count); 201 put_be32(s1->pb, s->octet_count);
198 put_flush_packet(s1->pb); 202 put_flush_packet(s1->pb);
199 } 203 }
200 204
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 ff_rtp_send_h264(s1, pkt->data, size); 404 ff_rtp_send_h264(s1, pkt->data, size);
401 break; 405 break;
402 case CODEC_ID_H263: 406 case CODEC_ID_H263:
403 case CODEC_ID_H263P: 407 case CODEC_ID_H263P:
404 ff_rtp_send_h263(s1, pkt->data, size); 408 ff_rtp_send_h263(s1, pkt->data, size);
405 break; 409 break;
406 case CODEC_ID_VORBIS: 410 case CODEC_ID_VORBIS:
407 case CODEC_ID_THEORA: 411 case CODEC_ID_THEORA:
408 ff_rtp_send_xiph(s1, pkt->data, size); 412 ff_rtp_send_xiph(s1, pkt->data, size);
409 break; 413 break;
414 case CODEC_ID_VP8:
415 ff_rtp_send_vp8(s1, pkt->data, size);
416 break;
410 default: 417 default:
411 /* better than nothing : send the codec raw data */ 418 /* better than nothing : send the codec raw data */
412 rtp_send_raw(s1, pkt->data, size); 419 rtp_send_raw(s1, pkt->data, size);
413 break; 420 break;
414 } 421 }
415 return 0; 422 return 0;
416 } 423 }
417 424
418 static int rtp_write_trailer(AVFormatContext *s1) 425 static int rtp_write_trailer(AVFormatContext *s1)
419 { 426 {
420 RTPMuxContext *s = s1->priv_data; 427 RTPMuxContext *s = s1->priv_data;
421 428
422 av_freep(&s->buf); 429 av_freep(&s->buf);
423 430
424 return 0; 431 return 0;
425 } 432 }
426 433
427 AVOutputFormat rtp_muxer = { 434 AVOutputFormat rtp_muxer = {
428 "rtp", 435 "rtp",
429 NULL_IF_CONFIG_SMALL("RTP output format"), 436 NULL_IF_CONFIG_SMALL("RTP output format"),
430 NULL, 437 NULL,
431 NULL, 438 NULL,
432 sizeof(RTPMuxContext), 439 sizeof(RTPMuxContext),
433 CODEC_ID_PCM_MULAW, 440 CODEC_ID_PCM_MULAW,
434 CODEC_ID_NONE, 441 CODEC_ID_NONE,
435 rtp_write_header, 442 rtp_write_header,
436 rtp_write_packet, 443 rtp_write_packet,
437 rtp_write_trailer, 444 rtp_write_trailer,
438 }; 445 };
OLDNEW
« no previous file with comments | « source/patched-ffmpeg-mt/libavformat/rtpenc.h ('k') | source/patched-ffmpeg-mt/libavformat/rtpenc_vp8.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698