• Android平台轻量级RTSP服务模块编码前后数据源对接探究


    技术背景

    好多开发者可能有个疑惑,什么时候轻量级RTSP服务?为什么需要有轻量级RTSP服务模块?实际上,轻量级RTSP服务解决的核心痛点是不需要用户额外部署RTSP或者RTMP流媒体服务,实现本地的音视频(如摄像头、麦克风)或编码后数据,汇聚到内置RTSP服务,对外提供可供拉流的RTSP URL。

    轻量级RTSP服务,适用于内网环境下,对并发要求不高的场景,支持H.264/H.265,支持RTSP鉴权、单播、组播模式,考虑到单个服务承载能力,我们支持同时创建多个RTSP服务,并支持获取当前RTSP服务会话连接数。

    技术实现

    以大牛直播SDK的Android平台轻量级RTSP服务为例,我们大概介绍下设计的常用的数据源对接接口。

    标准功能

    • 音频编码:AAC;
    • 视频编码:H.264、H.265;
    • 协议:RTSP;
    • [音视频]支持纯音频/纯视频/音视频;
    • [摄像头]支持采集过程中,前后摄像头实时切换;
    • 支持帧率、关键帧间隔(GOP)、码率(bit-rate)设置;
    • 支持软编码、特定机型硬编码;
    • 支持横屏、竖屏采集;
    • 支持Android屏幕采集;
    • 支持RTSP端口设置;
    • 支持RTSP鉴权用户名、密码设置;
    • 支持获取当前RTSP服务会话连接数;
    • 支持Android 5.1及以上版本。

    YV12的数据接口

    YV12的数据接口,主要是用于第三方的设备对接居多,这个接口的u_stride, v_stride分别是(width+1)/2,如果出来的数据需要旋转,通过rotation_degree来控制旋转角度即可。

    1. /**
    2. * YV12数据接口
    3. *
    4. * @param data: YV12 data
    5. *
    6. * @param width: 图像宽
    7. *
    8. * @param height: 图像高
    9. *
    10. * @param y_stride: y面步长
    11. *
    12. * @param v_stride: v面步长
    13. *
    14. * @param u_stride: u面步长
    15. *
    16. * rotation_degree: 顺时针旋转, 必须是0, 90, 180, 270
    17. *
    18. * @return {0} if successful
    19. */
    20. public native int SmartPublisherOnYV12Data(long handle, byte[] data, int width, int height, int y_stride, int v_stride, int u_stride, int rotation_degree);

    YUV数据接口

    支持标准的I420数据接口对接,不再赘述:

    1. /**
    2. * 投递层I420图像
    3. *
    4. * @param index: 层索引, 必须大于等于0
    5. *
    6. * @param left: 层叠加的左上角坐标, 对于第0层的话传0
    7. *
    8. * @param top: 层叠加的左上角坐标, 对于第0层的话传0
    9. *
    10. * @param y_plane: y平面图像数据
    11. *
    12. * @param y_offset: 图像偏移, 这个主要目的是用来做clip的,一般传0
    13. *
    14. * @param y_row_stride: stride information
    15. *
    16. * @param u_plane: u平面图像数据
    17. *
    18. * @param u_offset: 图像偏移, 这个主要目的是用来做clip的,一般传0
    19. *
    20. * @param u_row_stride: stride information
    21. * *
    22. * @param v_plane: v平面图像数据
    23. *
    24. * @param v_offset: 图像偏移, 这个主要目的是用来做clip的,一般传0
    25. *
    26. * @param v_row_stride: stride information
    27. *
    28. * @param width: width, 必须大于1, 且必须是偶数
    29. *
    30. * @param height: height, 必须大于1, 且必须是偶数
    31. *
    32. * @param is_vertical_flip: 是否垂直翻转, 0不翻转, 1翻转
    33. *
    34. * @param is_horizontal_flip:是否水平翻转, 0不翻转, 1翻转
    35. *
    36. * @param scale_width: 缩放宽,必须是偶数, 0或负数不缩放
    37. *
    38. * @param scale_height: 缩放高, 必须是偶数, 0或负数不缩放
    39. *
    40. * @param scale_filter_mode: 缩放质量, 传0使用默认速度,可选等级范围是:[1,3],值越大缩放质量越好, 但速度越慢
    41. *
    42. * @param rotation_degree: 顺时针旋转, 必须是0, 90, 180, 270, 注意:旋转是在缩放, 垂直/水品反转之后再做, 请留意顺序
    43. *
    44. * @return {0} if successful
    45. */
    46. public native int PostLayerImageI420ByteBuffer(long handle, int index, int left, int top,
    47. ByteBuffer y_plane, int y_offset, int y_row_stride,
    48. ByteBuffer u_plane, int u_offset, int u_row_stride,
    49. ByteBuffer v_plane, int v_offset, int v_row_stride,
    50. int width, int height, int is_vertical_flip, int is_horizontal_flip,
    51. int scale_width, int scale_height, int scale_filter_mode,
    52. int rotation_degree);

    NV21转I420并旋转接口

    这个接口也是主要用于特定的数据类型对接,NV21的数据,直接转I420后,对接即可,接口参数比较简单,不再赘述。

    1. /**
    2. * NV21转换到I420并旋转
    3. *
    4. * @param src: nv21 data
    5. *
    6. * @param dst: 输出I420 data
    7. *
    8. * @param width: 图像宽
    9. *
    10. * @param height: 图像高
    11. *
    12. * rotation_degree: 顺时针旋转, 必须是0, 90, 180, 270
    13. *
    14. * @return {0} if successful
    15. */
    16. public native int SmartPublisherNV21ToI420Rotate(long handle, byte[] src, int src_y_stride, int src_uv_stride, byte[] dst,
    17. int dst_y_stride, int dst_u_stride, int dst_v_stride,
    18. int width, int height,
    19. int rotation_degree);

    支持RGBA数据接入

    RGBA的主要用于屏幕共享场景下。

    1. /**
    2. * Set live video data(no encoded data).
    3. *
    4. * @param data: RGBA data
    5. *
    6. * @param rowStride: stride information
    7. *
    8. * @param width: width
    9. *
    10. * @param height: height
    11. *
    12. * @return {0} if successful
    13. */
    14. public native int SmartPublisherOnCaptureVideoRGBAData(long handle, ByteBuffer data, int rowStride, int width, int height);
    15. /**
    16. * 投递裁剪过的RGBA数据
    17. *
    18. * @param data: RGBA data
    19. *
    20. * @param rowStride: stride information
    21. *
    22. * @param width: width
    23. *
    24. * @param height: height
    25. *
    26. * @param clipedLeft: 左; clipedTop: 上; clipedwidth: 裁剪后的宽; clipedHeight: 裁剪后的高; 确保传下去裁剪后的宽、高均为偶数
    27. *
    28. * @return {0} if successful
    29. */
    30. public native int SmartPublisherOnCaptureVideoClipedRGBAData(long handle, ByteBuffer data, int rowStride, int width, int height, int clipedLeft, int clipedTop, int clipedWidth, int clipedHeight);
    31. /**
    32. * Set live video data(no encoded data).
    33. *
    34. * @param data: ABGR flip vertical(垂直翻转) data
    35. *
    36. * @param rowStride: stride information
    37. *
    38. * @param width: width
    39. *
    40. * @param height: height
    41. *
    42. * @return {0} if successful
    43. */
    44. public native int SmartPublisherOnCaptureVideoABGRFlipVerticalData(long handle, ByteBuffer data, int rowStride, int width, int height);

    支持RGB565数据接入(主要用于同屏场景)

    RGB565数据类型也主要用于屏幕采集这块。

    1. /**
    2. * Set live video data(no encoded data).
    3. *
    4. * @param data: RGB565 data
    5. *
    6. * @param row_stride: stride information
    7. *
    8. * @param width: width
    9. *
    10. * @param height: height
    11. *
    12. * @return {0} if successful
    13. */
    14. public native int SmartPublisherOnCaptureVideoRGB565Data(long handle,ByteBuffer data, int row_stride, int width, int height);

    NV12、NV21格式

    1. /**
    2. * 投递层NV21图像
    3. *
    4. * @param index: 层索引, 必须大于等于0
    5. *
    6. * @param left: 层叠加的左上角坐标, 对于第0层的话传0
    7. *
    8. * @param top: 层叠加的左上角坐标, 对于第0层的话传0
    9. *
    10. * @param y_plane: y平面图像数据
    11. *
    12. * @param y_offset: 图像偏移, 这个主要目的是用来做clip的,一般传0
    13. *
    14. * @param y_row_stride: stride information
    15. *
    16. * @param uv_plane: uv平面图像数据
    17. *
    18. * @param uv_offset: 图像偏移, 这个主要目的是用来做clip的,一般传0
    19. *
    20. * @param uv_row_stride: stride information
    21. *
    22. * @param width: width, 必须大于1, 且必须是偶数
    23. *
    24. * @param height: height, 必须大于1, 且必须是偶数
    25. *
    26. * @param is_vertical_flip: 是否垂直翻转, 0不翻转, 1翻转
    27. *
    28. * @param is_horizontal_flip:是否水平翻转, 0不翻转, 1翻转
    29. *
    30. * @param scale_width: 缩放宽,必须是偶数, 0或负数不缩放
    31. *
    32. * @param scale_height: 缩放高, 必须是偶数, 0或负数不缩放
    33. *
    34. * @param scale_filter_mode: 缩放质量, 传0使用默认速度,可选等级范围是:[1,3],值越大缩放质量越好, 但速度越慢
    35. *
    36. * @param rotation_degree: 顺时针旋转, 必须是0, 90, 180, 270, 注意:旋转是在缩放, 垂直/水品反转之后再做, 请留意顺序
    37. *
    38. * @return {0} if successful
    39. */
    40. public native int PostLayerImageNV21ByteBuffer(long handle, int index, int left, int top,
    41. ByteBuffer y_plane, int y_offset, int y_row_stride,
    42. ByteBuffer uv_plane, int uv_offset, int uv_row_stride,
    43. int width, int height, int is_vertical_flip, int is_horizontal_flip,
    44. int scale_width, int scale_height, int scale_filter_mode,
    45. int rotation_degree);
    46. /**
    47. * 投递层NV21图像, 详细说明请参考PostLayerImageNV21ByteBuffer
    48. *
    49. * @return {0} if successful
    50. */
    51. public native int PostLayerImageNV21ByteArray(long handle, int index, int left, int top,
    52. byte[] y_plane, int y_offset, int y_row_stride,
    53. byte[] uv_plane, int uv_offset, int uv_row_stride,
    54. int width, int height, int is_vertical_flip, int is_horizontal_flip,
    55. int scale_width, int scale_height, int scale_filter_mode,
    56. int rotation_degree);
    57. /**
    58. * 投递层NV12图像, 详细说明请参考PostLayerImageNV21ByteBuffer
    59. *
    60. * @return {0} if successful
    61. */
    62. public native int PostLayerImageNV12ByteBuffer(long handle, int index, int left, int top,
    63. ByteBuffer y_plane, int y_offset, int y_row_stride,
    64. ByteBuffer uv_plane, int uv_offset, int uv_row_stride,
    65. int width, int height, int is_vertical_flip, int is_horizontal_flip,
    66. int scale_width, int scale_height, int scale_filter_mode,
    67. int rotation_degree);
    68. /**
    69. * 投递层NV12图像, 详细说明请参考PostLayerImageNV21ByteBuffer
    70. *
    71. * @return {0} if successful
    72. */
    73. public native int PostLayerImageNV12ByteArray(long handle, int index, int left, int top,
    74. byte[] y_plane, int y_offset, int y_row_stride,
    75. byte[] uv_plane, int uv_offset, int uv_row_stride,
    76. int width, int height, int is_vertical_flip, int is_horizontal_flip,
    77. int scale_width, int scale_height, int scale_filter_mode,
    78. int rotation_degree);

    RGBA8888、RGBX8888接口

    1. /**
    2. * 投递层RGBA8888图像,如果不需要Aplpha通道的话, 请使用RGBX8888接口, 效率高
    3. *
    4. * @param index: 层索引, 必须大于等于0, 注意:如果index是0的话,将忽略Alpha通道
    5. *
    6. * @param left: 层叠加的左上角坐标, 对于第0层的话传0
    7. *
    8. * @param top: 层叠加的左上角坐标, 对于第0层的话传0
    9. *
    10. * @param rgba_plane: rgba 图像数据
    11. *
    12. * @param offset: 图像偏移, 这个主要目的是用来做clip的, 一般传0
    13. *
    14. * @param row_stride: stride information
    15. *
    16. * @param width: width, 必须大于1, 如果是奇数, 将减1
    17. *
    18. * @param height: height, 必须大于1, 如果是奇数, 将减1
    19. *
    20. * @param is_vertical_flip: 是否垂直翻转, 0不翻转, 1翻转
    21. *
    22. * @param is_horizontal_flip:是否水平翻转, 0不翻转, 1翻转
    23. *
    24. * @param scale_width: 缩放宽,必须是偶数, 0或负数不缩放
    25. *
    26. * @param scale_height: 缩放高, 必须是偶数, 0或负数不缩放
    27. *
    28. * @param scale_filter_mode: 缩放质量, 传0使用默认速度,可选等级范围是:[1,3],值越大缩放质量越好, 但速度越慢
    29. *
    30. * @param rotation_degree: 顺时针旋转, 必须是0, 90, 180, 270, 注意:旋转是在缩放, 垂直/水品反转之后再做, 请留意顺序
    31. *
    32. * @return {0} if successful
    33. */
    34. public native int PostLayerImageRGBA8888ByteBuffer(long handle, int index, int left, int top,
    35. ByteBuffer rgba_plane, int offset, int row_stride, int width, int height,
    36. int is_vertical_flip, int is_horizontal_flip,
    37. int scale_width, int scale_height, int scale_filter_mode,
    38. int rotation_degree);
    39. /**
    40. * 投递层RGBA8888图像, 详细说明请参考PostLayerImageRGBA8888ByteBuffer
    41. *
    42. * @return {0} if successful
    43. */
    44. public native int PostLayerImageRGBA8888ByteArray(long handle, int index, int left, int top,
    45. byte[] rgba_plane, int offset, int row_stride, int width, int height,
    46. int is_vertical_flip, int is_horizontal_flip,
    47. int scale_width, int scale_height, int scale_filter_mode,
    48. int rotation_degree);
    49. /**
    50. * 投递层RGBA8888图像, 详细说明请参考PostLayerImageRGBA8888ByteBuffer
    51. *
    52. * @return {0} if successful
    53. */
    54. public native int PostLayerImageRGBA8888Native(long handle, int index, int left, int top,
    55. long rgba_plane, int offset, int row_stride, int width, int height,
    56. int is_vertical_flip, int is_horizontal_flip,
    57. int scale_width, int scale_height, int scale_filter_mode,
    58. int rotation_degree);
    59. /**
    60. * 投递层RGBX8888图像
    61. *
    62. * @param index: 层索引, 必须大于等于0
    63. *
    64. * @param left: 层叠加的左上角坐标, 对于第0层的话传0
    65. *
    66. * @param top: 层叠加的左上角坐标, 对于第0层的话传0
    67. *
    68. * @param rgbx_plane: rgbx 图像数据
    69. *
    70. * @param offset: 图像偏移, 这个主要目的是用来做clip的,一般传0
    71. *
    72. * @param row_stride: stride information
    73. *
    74. * @param width: width, 必须大于1, 如果是奇数, 将减1
    75. *
    76. * @param height: height, 必须大于1, 如果是奇数, 将减1
    77. *
    78. * @param is_vertical_flip: 是否垂直翻转, 0不翻转, 1翻转
    79. *
    80. * @param is_horizontal_flip:是否水平翻转, 0不翻转, 1翻转
    81. *
    82. * @param scale_width: 缩放宽,必须是偶数, 0或负数不缩放
    83. *
    84. * @param scale_height: 缩放高, 必须是偶数, 0或负数不缩放
    85. *
    86. * @param scale_filter_mode: 缩放质量, 传0使用默认速度,可选等级范围是:[1,3],值越大缩放质量越好, 但速度越慢
    87. *
    88. * @param rotation_degree: 顺时针旋转, 必须是0, 90, 180, 270, 注意:旋转是在缩放, 垂直/水品反转之后再做, 请留意顺序
    89. *
    90. * @return {0} if successful
    91. */
    92. public native int PostLayerImageRGBX8888ByteBuffer(long handle, int index, int left, int top,
    93. ByteBuffer rgbx_plane, int offset, int row_stride, int width, int height,
    94. int is_vertical_flip, int is_horizontal_flip,
    95. int scale_width, int scale_height, int scale_filter_mode,
    96. int rotation_degree);
    97. /**
    98. * 投递层RGBX8888图像, 详细说明请参考PostLayerImageRGBX8888ByteBuffer
    99. *
    100. * @return {0} if successful
    101. */
    102. public native int PostLayerImageRGBX8888ByteArray(long handle, int index, int left, int top,
    103. byte[] rgbx_plane, int offset, int row_stride, int width, int height,
    104. int is_vertical_flip, int is_horizontal_flip,
    105. int scale_width, int scale_height, int scale_filter_mode,
    106. int rotation_degree);
    107. /**
    108. * 投递层RGBX8888图像, 详细说明请参考PostLayerImageRGBX8888ByteBuffer
    109. *
    110. * @return {0} if successful
    111. */
    112. public native int PostLayerImageRGBX8888Native(long handle, int index, int left, int top,
    113. long rgbx_plane, int offset, int row_stride, int width, int height,
    114. int is_vertical_flip, int is_horizontal_flip,
    115. int scale_width, int scale_height, int scale_filter_mode,
    116. int rotation_degree);
    117. /**
    118. * 投递层RGB888图像
    119. *
    120. * @param index: 层索引, 必须大于等于0
    121. *
    122. * @param left: 层叠加的左上角坐标, 对于第0层的话传0
    123. *
    124. * @param top: 层叠加的左上角坐标, 对于第0层的话传0
    125. *
    126. * @param rgb_plane: rgb888 图像数据
    127. *
    128. * @param offset: 图像偏移, 这个主要目的是用来做clip的,一般传0
    129. *
    130. * @param row_stride: stride information
    131. *
    132. * @param width: width, 必须大于1, 如果是奇数, 将减1
    133. *
    134. * @param height: height, 必须大于1, 如果是奇数, 将减1
    135. *
    136. * @param is_vertical_flip: 是否垂直翻转, 0不翻转, 1翻转
    137. *
    138. * @param is_horizontal_flip:是否水平翻转, 0不翻转, 1翻转
    139. *
    140. * @param scale_width: 缩放宽,必须是偶数, 0或负数不缩放
    141. *
    142. * @param scale_height: 缩放高, 必须是偶数, 0或负数不缩放
    143. *
    144. * @param scale_filter_mode: 缩放质量, 传0使用默认速度,可选等级范围是:[1,3],值越大缩放质量越好, 但速度越慢
    145. *
    146. * @param rotation_degree: 顺时针旋转, 必须是0, 90, 180, 270, 注意:旋转是在缩放, 垂直/水品反转之后再做, 请留意顺序
    147. *
    148. * @return {0} if successful
    149. */
    150. public native int PostLayerImageRGB888Native(long handle, int index, int left, int top,
    151. long rgb_plane, int offset, int row_stride, int width, int height,
    152. int is_vertical_flip, int is_horizontal_flip,
    153. int scale_width, int scale_height, int scale_filter_mode,
    154. int rotation_degree);

    编码后音视频数据

    像前文所说,如无人机等264/HEVC数据,或者本地解析的MP4音视频数据,均可通过实时流的形式,接入到GB28181平台,设计接口如下:

    1. /**
    2. * 设置编码后视频数据(H.264)
    3. *
    4. * @param codec_id, H.264对应 1
    5. *
    6. * @param data 编码后的video数据
    7. *
    8. * @param size data length
    9. *
    10. * @param is_key_frame 是否I帧, if with key frame, please set 1, otherwise, set 0.
    11. *
    12. * @param timestamp video timestamp
    13. *
    14. * @param pts Presentation Time Stamp, 显示时间戳
    15. *
    16. * @return {0} if successful
    17. */
    18. public native int SmartPublisherPostVideoEncodedData(long handle, int codec_id, ByteBuffer data, int size, int is_key_frame, long timestamp, long pts);
    19. /**
    20. * 设置编码后视频数据(H.264)
    21. *
    22. * @param codec_id, H.264对应 1
    23. *
    24. * @param data 编码后的video数据
    25. *
    26. *@param offset data的偏移
    27. *
    28. * @param size data length
    29. *
    30. * @param is_key_frame 是否I帧, if with key frame, please set 1, otherwise, set 0.
    31. *
    32. * @param timestamp video timestamp
    33. *
    34. * @param pts Presentation Time Stamp, 显示时间戳
    35. *
    36. * @return {0} if successful
    37. */
    38. public native int SmartPublisherPostVideoEncodedDataV2(long handle, int codec_id,
    39. ByteBuffer data, int offset, int size,
    40. int is_key_frame, long timestamp, long pts,
    41. byte[] sps, int sps_len,
    42. byte[] pps, int pps_len);
    43. /**
    44. * 设置编码后视频数据(H.264),如需录制编码后的数据,用此接口,且设置实际宽高
    45. *
    46. * @param codec_id, H.264对应 1
    47. *
    48. * @param data 编码后的video数据
    49. *
    50. *@param offset data的偏移
    51. *
    52. * @param size data length
    53. *
    54. * @param is_key_frame 是否I帧, if with key frame, please set 1, otherwise, set 0.
    55. *
    56. * @param timestamp video timestamp
    57. *
    58. * @param pts Presentation Time Stamp, 显示时间戳
    59. *
    60. * @param width, height: 编码后视频宽高
    61. *
    62. * @return {0} if successful
    63. */
    64. public native int SmartPublisherPostVideoEncodedDataV3(long handle, int codec_id,
    65. ByteBuffer data, int offset, int size,
    66. int is_key_frame, long timestamp, long pts,
    67. byte[] sps, int sps_len,
    68. byte[] pps, int pps_len,
    69. int width, int height);
    70. /**
    71. * 设置音频数据(AAC/PCMA/PCMU/SPEEX)
    72. *
    73. * @param codec_id:
    74. *
    75. * NT_MEDIA_CODEC_ID_AUDIO_BASE = 0x10000,
    76. * NT_MEDIA_CODEC_ID_PCMA = NT_MEDIA_CODEC_ID_AUDIO_BASE,
    77. * NT_MEDIA_CODEC_ID_PCMU,
    78. * NT_MEDIA_CODEC_ID_AAC,
    79. * NT_MEDIA_CODEC_ID_SPEEX,
    80. * NT_MEDIA_CODEC_ID_SPEEX_NB,
    81. * NT_MEDIA_CODEC_ID_SPEEX_WB,
    82. * NT_MEDIA_CODEC_ID_SPEEX_UWB,
    83. *
    84. * @param data audio数据
    85. *
    86. * @param size data length
    87. *
    88. * @param is_key_frame 是否I帧, if with key frame, please set 1, otherwise, set 0, audio忽略
    89. *
    90. * @param timestamp video timestamp
    91. *
    92. * @param parameter_info 用于AAC special config信息填充
    93. *
    94. * @param parameter_info_size parameter info size
    95. *
    96. * @return {0} if successful
    97. */
    98. public native int SmartPublisherPostAudioEncodedData(long handle, int codec_id, ByteBuffer data, int size, int is_key_frame, long timestamp,ByteBuffer parameter_info, int parameter_info_size);
    99. /**
    100. * 设置音频数据(AAC/PCMA/PCMU/SPEEX)
    101. *
    102. * @param codec_id:
    103. *
    104. * NT_MEDIA_CODEC_ID_AUDIO_BASE = 0x10000,
    105. * NT_MEDIA_CODEC_ID_PCMA = NT_MEDIA_CODEC_ID_AUDIO_BASE,
    106. * NT_MEDIA_CODEC_ID_PCMU,
    107. * NT_MEDIA_CODEC_ID_AAC,
    108. * NT_MEDIA_CODEC_ID_SPEEX,
    109. * NT_MEDIA_CODEC_ID_SPEEX_NB,
    110. * NT_MEDIA_CODEC_ID_SPEEX_WB,
    111. * NT_MEDIA_CODEC_ID_SPEEX_UWB,
    112. *
    113. * @param data audio数据
    114. *
    115. * @param offset data的偏移
    116. *
    117. * @param size data length
    118. *
    119. * @param is_key_frame 是否I帧, if with key frame, please set 1, otherwise, set 0, audio忽略
    120. *
    121. * @param timestamp video timestamp
    122. *
    123. * @param parameter_info 用于AAC special config信息填充
    124. *
    125. * @param parameter_info_size parameter info size
    126. *
    127. * @return {0} if successful
    128. */
    129. public native int SmartPublisherPostAudioEncodedDataV2(long handle, int codec_id,
    130. ByteBuffer data, int offset, int size,
    131. int is_key_frame, long timestamp,
    132. byte[] parameter_info, int parameter_info_size);
    133. /**
    134. * 设置音频数据(AAC/PCMA/PCMU/SPEEX)
    135. *
    136. * @param codec_id:
    137. *
    138. * NT_MEDIA_CODEC_ID_AUDIO_BASE = 0x10000,
    139. * NT_MEDIA_CODEC_ID_PCMA = NT_MEDIA_CODEC_ID_AUDIO_BASE,
    140. * NT_MEDIA_CODEC_ID_PCMU,
    141. * NT_MEDIA_CODEC_ID_AAC,
    142. * NT_MEDIA_CODEC_ID_SPEEX,
    143. * NT_MEDIA_CODEC_ID_SPEEX_NB,
    144. * NT_MEDIA_CODEC_ID_SPEEX_WB,
    145. * NT_MEDIA_CODEC_ID_SPEEX_UWB,
    146. *
    147. * @param data audio数据
    148. *
    149. * @param offset data的偏移
    150. *
    151. * @param size data length
    152. *
    153. * @param is_key_frame 是否I帧, if with key frame, please set 1, otherwise, set 0, audio忽略
    154. *
    155. * @param timestamp video timestamp
    156. *
    157. * @param parameter_info 用于AAC special config信息填充
    158. *
    159. * @param parameter_info_size parameter info size
    160. *
    161. * @param sample_rate 采样率,如果需要录像的话必须传正确的值
    162. *
    163. *@param channels 通道数, 如果需要录像的话必须传正确的值, 一般是1或者2
    164. *
    165. * @return {0} if successful
    166. */
    167. public native int SmartPublisherPostAudioEncodedDataV3(long handle, int codec_id,
    168. ByteBuffer data, int offset, int size,
    169. int is_key_frame, long timestamp,
    170. byte[] parameter_info, int parameter_info_size,
    171. int sample_rate, int channels);
  • 相关阅读:
    【无标题】快速控制原型(RCP)丨内置式交流永磁同步电机开发试验系统
    golang语言的gofly快速开发框架如何设置多样的主题说明
    正则表达式
    code编译时报错undefined reference to ...
    【Java第29期】:Tomcat的安装和使用
    Vue3最佳实践 第六章 Pinia,Vuex与axios,VueUse 1(Pinia)
    使用MySQL存储过程提高数据库效率和可维护性
    物流路由线路配载前端算法逻辑实现方案
    Blend for Visual Studio 概述
    Vue项目的记录(十六)
  • 原文地址:https://blog.csdn.net/renhui1112/article/details/133810781