improved codec ids

This commit is contained in:
Roman Arutyunyan 2012-05-12 19:03:41 +04:00
parent f17fd5a032
commit c3067ced06
3 changed files with 15 additions and 4 deletions

View file

@ -7,7 +7,7 @@
const char * audio_codecs[] = {
"Uncompressed",
"",
"ADPCM",
"MP3",
"",
@ -18,7 +18,8 @@ const char * audio_codecs[] = {
"",
"",
"HE-ACC",
"Speex"
"Speex",
"Uncompressed"
};
@ -29,6 +30,7 @@ const char * video_codecs[] = {
"ScreenVideo",
"On2-VP6",
"On2-VP6-Alpha",
"",
"H264",
};

View file

@ -12,7 +12,9 @@
/* Audio codecs */
enum {
NGX_RTMP_AUDIO_UNCOMPRESSED = 0,
/* Uncompressed codec id is actually 0,
* but we use another value for consistency */
NGX_RTMP_AUDIO_UNCOMPRESSED = 12,
NGX_RTMP_AUDIO_ADPCM = 1,
NGX_RTMP_AUDIO_MP3 = 2,
NGX_RTMP_AUDIO_NELLY8 = 5,

View file

@ -515,6 +515,11 @@ ngx_rtmp_live_data_frame(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
}
ngx_memzero(&v, sizeof(v));
/* use -1 as a sign of unchanged data;
* 0 is a valid value for uncompressed audio */
v.audio_codec_id = -1;
if (ngx_rtmp_receive_amf(s, in, in_elts,
sizeof(in_elts) / sizeof(in_elts[0])))
{
@ -542,7 +547,9 @@ ngx_rtmp_live_data_frame(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
meta->video_data_rate = v.video_data_rate;
meta->video_codec_id = v.video_codec_id;
meta->audio_data_rate = v.audio_data_rate;
meta->audio_codec_id = v.audio_codec_id;
meta->audio_codec_id = (v.audio_codec_id == -1
? 0 : v.audio_codec_id == 0
? NGX_RTMP_AUDIO_UNCOMPRESSED : v.audio_codec_id);
ngx_log_debug8(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"live: data frame: "