Mercurial > libavformat.hg
comparison rtmpproto.c @ 5402:99aeb2e385df libavformat
Full-header RTMP packets contain real timestamp, others contain timestamp
difference, so make all read packets store absolute timestamp.
As a consequence, we don't need to track audio/video timestamps separately
any longer in protocol handler.
author | kostya |
---|---|
date | Tue, 01 Dec 2009 16:08:44 +0000 |
parents | 9313acce85fc |
children | b7ef0aa415d0 |
comparison
equal
deleted
inserted
replaced
5401:432e1b6e1568 | 5402:99aeb2e385df |
---|---|
61 ClientState state; ///< current state | 61 ClientState state; ///< current state |
62 int main_channel_id; ///< an additional channel ID which is used for some invocations | 62 int main_channel_id; ///< an additional channel ID which is used for some invocations |
63 uint8_t* flv_data; ///< buffer with data for demuxer | 63 uint8_t* flv_data; ///< buffer with data for demuxer |
64 int flv_size; ///< current buffer size | 64 int flv_size; ///< current buffer size |
65 int flv_off; ///< number of bytes read from current buffer | 65 int flv_off; ///< number of bytes read from current buffer |
66 uint32_t video_ts; ///< current video timestamp in milliseconds | |
67 uint32_t audio_ts; ///< current audio timestamp in milliseconds | |
68 } RTMPContext; | 66 } RTMPContext; |
69 | 67 |
70 #define PLAYER_KEY_OPEN_PART_LEN 30 ///< length of partial key used for first client digest signing | 68 #define PLAYER_KEY_OPEN_PART_LEN 30 ///< length of partial key used for first client digest signing |
71 /** Client key used for digest signing */ | 69 /** Client key used for digest signing */ |
72 static const uint8_t rtmp_player_key[] = { | 70 static const uint8_t rtmp_player_key[] = { |
513 if (rpkt.type == RTMP_PT_VIDEO || rpkt.type == RTMP_PT_AUDIO || | 511 if (rpkt.type == RTMP_PT_VIDEO || rpkt.type == RTMP_PT_AUDIO || |
514 (rpkt.type == RTMP_PT_NOTIFY && !memcmp("\002\000\012onMetaData", rpkt.data, 13))) { | 512 (rpkt.type == RTMP_PT_NOTIFY && !memcmp("\002\000\012onMetaData", rpkt.data, 13))) { |
515 uint8_t *p; | 513 uint8_t *p; |
516 uint32_t ts = rpkt.timestamp; | 514 uint32_t ts = rpkt.timestamp; |
517 | 515 |
518 if (rpkt.type == RTMP_PT_VIDEO) { | |
519 rt->video_ts += rpkt.timestamp; | |
520 ts = rt->video_ts; | |
521 } else if (rpkt.type == RTMP_PT_AUDIO) { | |
522 rt->audio_ts += rpkt.timestamp; | |
523 ts = rt->audio_ts; | |
524 } | |
525 // generate packet header and put data into buffer for FLV demuxer | 516 // generate packet header and put data into buffer for FLV demuxer |
526 rt->flv_off = 0; | 517 rt->flv_off = 0; |
527 rt->flv_size = rpkt.data_size + 15; | 518 rt->flv_size = rpkt.data_size + 15; |
528 rt->flv_data = p = av_realloc(rt->flv_data, rt->flv_size); | 519 rt->flv_data = p = av_realloc(rt->flv_data, rt->flv_size); |
529 bytestream_put_byte(&p, rpkt.type); | 520 bytestream_put_byte(&p, rpkt.type); |