正在显示
2 个修改的文件
包含
119 行增加
和
119 行删除
trunk/src/core/srs_core.hpp
100644 → 100755
| 1 | -/* | ||
| 2 | -The MIT License (MIT) | ||
| 3 | - | ||
| 4 | -Copyright (c) 2013-2014 winlin | ||
| 5 | - | ||
| 6 | -Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| 7 | -this software and associated documentation files (the "Software"), to deal in | ||
| 8 | -the Software without restriction, including without limitation the rights to | ||
| 9 | -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
| 10 | -the Software, and to permit persons to whom the Software is furnished to do so, | ||
| 11 | -subject to the following conditions: | ||
| 12 | - | ||
| 13 | -The above copyright notice and this permission notice shall be included in all | ||
| 14 | -copies or substantial portions of the Software. | ||
| 15 | - | ||
| 16 | -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 17 | -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| 18 | -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| 19 | -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| 20 | -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 21 | -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 22 | -*/ | ||
| 23 | - | ||
| 24 | -#ifndef SRS_CORE_HPP | ||
| 25 | -#define SRS_CORE_HPP | ||
| 26 | - | ||
| 27 | -/* | ||
| 28 | -#include <srs_core.hpp> | ||
| 29 | -*/ | ||
| 30 | - | ||
| 31 | -// current release version | ||
| 32 | -#define VERSION_MAJOR 2 | ||
| 33 | -#define VERSION_MINOR 0 | ||
| 34 | -#define VERSION_REVISION 75 | ||
| 35 | -// server info. | ||
| 36 | -#define RTMP_SIG_SRS_KEY "SRS" | ||
| 37 | -#define RTMP_SIG_SRS_ROLE "origin/edge server" | ||
| 38 | -#define RTMP_SIG_SRS_NAME RTMP_SIG_SRS_KEY"(Simple RTMP Server)" | ||
| 39 | -#define RTMP_SIG_SRS_URL_SHORT "github.com/winlinvip/simple-rtmp-server" | ||
| 40 | -#define RTMP_SIG_SRS_URL "https://"RTMP_SIG_SRS_URL_SHORT | ||
| 41 | -#define RTMP_SIG_SRS_WEB "http://blog.csdn.net/win_lin" | ||
| 42 | -#define RTMP_SIG_SRS_EMAIL "winlin@vip.126.com" | ||
| 43 | -#define RTMP_SIG_SRS_LICENSE "The MIT License (MIT)" | ||
| 44 | -#define RTMP_SIG_SRS_COPYRIGHT "Copyright (c) 2013-2014 winlin" | ||
| 45 | -#define RTMP_SIG_SRS_PRIMARY "winlin" | ||
| 46 | -#define RTMP_SIG_SRS_AUTHROS "wenjie.zhao" | ||
| 47 | -#define RTMP_SIG_SRS_CONTRIBUTORS_URL RTMP_SIG_SRS_URL"/blob/master/AUTHORS.txt" | ||
| 48 | -#define RTMP_SIG_SRS_HANDSHAKE RTMP_SIG_SRS_KEY"("RTMP_SIG_SRS_VERSION")" | ||
| 49 | -#define RTMP_SIG_SRS_RELEASE RTMP_SIG_SRS_URL"/tree/1.0release" | ||
| 50 | -#define RTMP_SIG_SRS_HTTP_SERVER RTMP_SIG_SRS_URL"/wiki/v1_CN_HTTPServer#feature" | ||
| 51 | -#define RTMP_SIG_SRS_ISSUES(id) RTMP_SIG_SRS_URL"/issues/"#id | ||
| 52 | -#define RTMP_SIG_SRS_VERSION __SRS_XSTR(VERSION_MAJOR)"."__SRS_XSTR(VERSION_MINOR)"."__SRS_XSTR(VERSION_REVISION) | ||
| 53 | - | ||
| 54 | -// internal macros, covert macro values to str, | ||
| 55 | -// see: read https://gcc.gnu.org/onlinedocs/cpp/Stringification.html#Stringification | ||
| 56 | -#define __SRS_XSTR(v) __SRS_STR(v) | ||
| 57 | -#define __SRS_STR(v) #v | ||
| 58 | - | ||
| 59 | -/** | ||
| 60 | -* the core provides the common defined macros, utilities, | ||
| 61 | -* user must include the srs_core.hpp before any header, or maybe | ||
| 62 | -* build failed. | ||
| 63 | -*/ | ||
| 64 | - | ||
| 65 | -// for 32bit os, 2G big file limit for unistd io, | ||
| 66 | -// ie. read/write/lseek to use 64bits size for huge file. | ||
| 67 | -#ifndef _FILE_OFFSET_BITS | ||
| 68 | - #define _FILE_OFFSET_BITS 64 | ||
| 69 | -#endif | ||
| 70 | - | ||
| 71 | -// for int64_t print using PRId64 format. | ||
| 72 | -#ifndef __STDC_FORMAT_MACROS | ||
| 73 | - #define __STDC_FORMAT_MACROS | ||
| 74 | -#endif | ||
| 75 | - | ||
| 76 | -// for srs-librtmp, @see https://github.com/winlinvip/simple-rtmp-server/issues/213 | ||
| 77 | -#ifndef _WIN32 | ||
| 78 | -#include <inttypes.h> | ||
| 79 | -#endif | ||
| 80 | - | ||
| 81 | -#include <assert.h> | ||
| 82 | -#define srs_assert(expression) assert(expression) | ||
| 83 | - | ||
| 84 | -#include <stddef.h> | ||
| 85 | -#include <sys/types.h> | ||
| 86 | - | ||
| 87 | -// generated by configure. | ||
| 88 | -#include <srs_auto_headers.hpp> | ||
| 89 | - | ||
| 90 | -// free the p and set to NULL. | ||
| 91 | -// p must be a T*. | ||
| 92 | -#define srs_freep(p) \ | ||
| 93 | - if (p) { \ | ||
| 94 | - delete p; \ | ||
| 95 | - p = NULL; \ | ||
| 96 | - } \ | ||
| 97 | - (void)0 | ||
| 98 | -// sometimes, the freepa is useless, | ||
| 99 | -// it's recomments to free each elem explicit. | ||
| 100 | -// so we remove the srs_freepa utility. | ||
| 101 | - | ||
| 102 | -/** | ||
| 103 | -* disable copy constructor of class, | ||
| 104 | -* to avoid the memory leak or corrupt by copy instance. | ||
| 105 | -*/ | ||
| 106 | -#define disable_default_copy(className)\ | ||
| 107 | - private:\ | ||
| 108 | - /** \ | ||
| 109 | - * disable the copy constructor and operator=, donot allow directly copy. \ | ||
| 110 | - */ \ | ||
| 111 | - className(const className&); \ | ||
| 112 | - className& operator= (const className&) | ||
| 113 | - | ||
| 114 | -#endif | ||
| 115 | - | 1 | +/* |
| 2 | +The MIT License (MIT) | ||
| 3 | + | ||
| 4 | +Copyright (c) 2013-2014 winlin | ||
| 5 | + | ||
| 6 | +Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| 7 | +this software and associated documentation files (the "Software"), to deal in | ||
| 8 | +the Software without restriction, including without limitation the rights to | ||
| 9 | +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
| 10 | +the Software, and to permit persons to whom the Software is furnished to do so, | ||
| 11 | +subject to the following conditions: | ||
| 12 | + | ||
| 13 | +The above copyright notice and this permission notice shall be included in all | ||
| 14 | +copies or substantial portions of the Software. | ||
| 15 | + | ||
| 16 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 17 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| 18 | +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| 19 | +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| 20 | +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 21 | +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 22 | +*/ | ||
| 23 | + | ||
| 24 | +#ifndef SRS_CORE_HPP | ||
| 25 | +#define SRS_CORE_HPP | ||
| 26 | + | ||
| 27 | +/* | ||
| 28 | +#include <srs_core.hpp> | ||
| 29 | +*/ | ||
| 30 | + | ||
| 31 | +// current release version | ||
| 32 | +#define VERSION_MAJOR 2 | ||
| 33 | +#define VERSION_MINOR 0 | ||
| 34 | +#define VERSION_REVISION 76 | ||
| 35 | +// server info. | ||
| 36 | +#define RTMP_SIG_SRS_KEY "SRS" | ||
| 37 | +#define RTMP_SIG_SRS_ROLE "origin/edge server" | ||
| 38 | +#define RTMP_SIG_SRS_NAME RTMP_SIG_SRS_KEY"(Simple RTMP Server)" | ||
| 39 | +#define RTMP_SIG_SRS_URL_SHORT "github.com/winlinvip/simple-rtmp-server" | ||
| 40 | +#define RTMP_SIG_SRS_URL "https://"RTMP_SIG_SRS_URL_SHORT | ||
| 41 | +#define RTMP_SIG_SRS_WEB "http://blog.csdn.net/win_lin" | ||
| 42 | +#define RTMP_SIG_SRS_EMAIL "winlin@vip.126.com" | ||
| 43 | +#define RTMP_SIG_SRS_LICENSE "The MIT License (MIT)" | ||
| 44 | +#define RTMP_SIG_SRS_COPYRIGHT "Copyright (c) 2013-2014 winlin" | ||
| 45 | +#define RTMP_SIG_SRS_PRIMARY "winlin" | ||
| 46 | +#define RTMP_SIG_SRS_AUTHROS "wenjie.zhao" | ||
| 47 | +#define RTMP_SIG_SRS_CONTRIBUTORS_URL RTMP_SIG_SRS_URL"/blob/master/AUTHORS.txt" | ||
| 48 | +#define RTMP_SIG_SRS_HANDSHAKE RTMP_SIG_SRS_KEY"("RTMP_SIG_SRS_VERSION")" | ||
| 49 | +#define RTMP_SIG_SRS_RELEASE RTMP_SIG_SRS_URL"/tree/1.0release" | ||
| 50 | +#define RTMP_SIG_SRS_HTTP_SERVER RTMP_SIG_SRS_URL"/wiki/v1_CN_HTTPServer#feature" | ||
| 51 | +#define RTMP_SIG_SRS_ISSUES(id) RTMP_SIG_SRS_URL"/issues/"#id | ||
| 52 | +#define RTMP_SIG_SRS_VERSION __SRS_XSTR(VERSION_MAJOR)"."__SRS_XSTR(VERSION_MINOR)"."__SRS_XSTR(VERSION_REVISION) | ||
| 53 | + | ||
| 54 | +// internal macros, covert macro values to str, | ||
| 55 | +// see: read https://gcc.gnu.org/onlinedocs/cpp/Stringification.html#Stringification | ||
| 56 | +#define __SRS_XSTR(v) __SRS_STR(v) | ||
| 57 | +#define __SRS_STR(v) #v | ||
| 58 | + | ||
| 59 | +/** | ||
| 60 | +* the core provides the common defined macros, utilities, | ||
| 61 | +* user must include the srs_core.hpp before any header, or maybe | ||
| 62 | +* build failed. | ||
| 63 | +*/ | ||
| 64 | + | ||
| 65 | +// for 32bit os, 2G big file limit for unistd io, | ||
| 66 | +// ie. read/write/lseek to use 64bits size for huge file. | ||
| 67 | +#ifndef _FILE_OFFSET_BITS | ||
| 68 | + #define _FILE_OFFSET_BITS 64 | ||
| 69 | +#endif | ||
| 70 | + | ||
| 71 | +// for int64_t print using PRId64 format. | ||
| 72 | +#ifndef __STDC_FORMAT_MACROS | ||
| 73 | + #define __STDC_FORMAT_MACROS | ||
| 74 | +#endif | ||
| 75 | + | ||
| 76 | +// for srs-librtmp, @see https://github.com/winlinvip/simple-rtmp-server/issues/213 | ||
| 77 | +#ifndef _WIN32 | ||
| 78 | +#include <inttypes.h> | ||
| 79 | +#endif | ||
| 80 | + | ||
| 81 | +#include <assert.h> | ||
| 82 | +#define srs_assert(expression) assert(expression) | ||
| 83 | + | ||
| 84 | +#include <stddef.h> | ||
| 85 | +#include <sys/types.h> | ||
| 86 | + | ||
| 87 | +// generated by configure. | ||
| 88 | +#include <srs_auto_headers.hpp> | ||
| 89 | + | ||
| 90 | +// free the p and set to NULL. | ||
| 91 | +// p must be a T*. | ||
| 92 | +#define srs_freep(p) \ | ||
| 93 | + if (p) { \ | ||
| 94 | + delete p; \ | ||
| 95 | + p = NULL; \ | ||
| 96 | + } \ | ||
| 97 | + (void)0 | ||
| 98 | +// sometimes, the freepa is useless, | ||
| 99 | +// it's recomments to free each elem explicit. | ||
| 100 | +// so we remove the srs_freepa utility. | ||
| 101 | + | ||
| 102 | +/** | ||
| 103 | +* disable copy constructor of class, | ||
| 104 | +* to avoid the memory leak or corrupt by copy instance. | ||
| 105 | +*/ | ||
| 106 | +#define disable_default_copy(className)\ | ||
| 107 | + private:\ | ||
| 108 | + /** \ | ||
| 109 | + * disable the copy constructor and operator=, donot allow directly copy. \ | ||
| 110 | + */ \ | ||
| 111 | + className(const className&); \ | ||
| 112 | + className& operator= (const className&) | ||
| 113 | + | ||
| 114 | +#endif | ||
| 115 | + |
| @@ -925,7 +925,7 @@ int __srs_write_aac_adts_frame(Context* context, | @@ -925,7 +925,7 @@ int __srs_write_aac_adts_frame(Context* context, | ||
| 925 | // 7bits left. | 925 | // 7bits left. |
| 926 | 926 | ||
| 927 | // channelConfiguration; 4 bslbf | 927 | // channelConfiguration; 4 bslbf |
| 928 | - ch |= (aac_channel << 3) & 0x70; | 928 | + ch |= (aac_channel << 3) & 0x78; |
| 929 | // 3bits left. | 929 | // 3bits left. |
| 930 | 930 | ||
| 931 | // only support aac profile 1-4. | 931 | // only support aac profile 1-4. |
| @@ -939,11 +939,11 @@ int __srs_write_aac_adts_frame(Context* context, | @@ -939,11 +939,11 @@ int __srs_write_aac_adts_frame(Context* context, | ||
| 939 | // extensionFlag; 1 bslbf | 939 | // extensionFlag; 1 bslbf |
| 940 | context->aac_specific_config += ch; | 940 | context->aac_specific_config += ch; |
| 941 | 941 | ||
| 942 | + char* sh = (char*)context->aac_specific_config.data(); | ||
| 943 | + int nb_sh = (int)context->aac_specific_config.length(); | ||
| 942 | if ((ret = __srs_write_audio_raw_frame(context, | 944 | if ((ret = __srs_write_audio_raw_frame(context, |
| 943 | sound_format, sound_rate, sound_size, sound_type, | 945 | sound_format, sound_rate, sound_size, sound_type, |
| 944 | - 0, (char*)context->aac_specific_config.data(), | ||
| 945 | - context->aac_specific_config.length(), | ||
| 946 | - timestamp)) != ERROR_SUCCESS | 946 | + 0, sh, nb_sh, timestamp)) != ERROR_SUCCESS |
| 947 | ) { | 947 | ) { |
| 948 | return ret; | 948 | return ret; |
| 949 | } | 949 | } |
-
请 注册 或 登录 后发表评论