webrtc opus 设置与编码

webrtc opus bg57iv3 扩展头 格式 audio encoder


Received session description :{

   "sdp" : "v=0

o=- 7489544636758395528 2 IN IP4 127.0.0.1

s=-

t=0 0

a=group:BUNDLE 0 1

a=msid-semantic: WMS stream_id

m=audio 9 RTP/AVPF 111 103 104 9 102 0 8 106 105 13 110 112 113 126

c=IN IP4 0.0.0.0

a=rtcp:9 IN IP4 0.0.0.0

a=ice-ufrag:xUFn

a=ice-pwd:Zq3MQKxIqnkSsr0ESYN8gEFV

a=ice-options:trickle

a=mid:0

a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level

a=extmap:2 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01

a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid

a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id

a=extmap:5 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id

a=sendrecv

a=msid:stream_id audio_label

a=rtcp-mux

a=rtpmap:111 opus/48000/2

a=rtcp-fb:111 transport-cc

a=fmtp:111 minptime=10;useinbandfec=1

a=rtpmap:103 ISAC/16000

a=rtpmap:104 ISAC/32000

a=rtpmap:9 G722/8000

a=rtpmap:102 ILBC/8000

a=rtpmap:0 PCMU/8000

a=rtpmap:8 PCMA/8000

a=rtpmap:106 CN/32000

a=rtpmap:105 CN/16000

a=rtpmap:13 CN/8000

a=rtpmap:110 telephone-event/48000

a=rtpmap:112 telephone-event/32000

a=rtpmap:113 telephone-event/16000

a=rtpmap:126 telephone-event/8000

a=ssrc:1527975052 cname:WiREXAcYmJ5rkNaW

m=video 9 RTP/AVPF 96 97 98 99 100 101 127 124 125

c=IN IP4 0.0.0.0

a=rtcp:9 IN IP4 0.0.0.0

a=ice-ufrag:xUFn

a=ice-pwd:Zq3MQKxIqnkSsr0ESYN8gEFV

a=ice-options:trickle

a=mid:1

a=extmap:14 urn:ietf:params:rtp-hdrext:toffset

a=extmap:13 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time

a=extmap:12 urn:3gpp:video-orientation

a=extmap:2 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01

a=extmap:11 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay

a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type

a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing

a=extmap:8 http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07

a=extmap:9 http://www.webrtc.org/experiments/rtp-hdrext/color-space

a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid

a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id

a=extmap:5 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id

a=recvonly

a=rtcp-mux

a=rtcp-rsize

a=rtpmap:96 VP8/90000

a=rtcp-fb:96 goog-remb

a=rtcp-fb:96 transport-cc

a=rtcp-fb:96 ccm fir

a=rtcp-fb:96 nack

a=rtcp-fb:96 nack pli

a=rtpmap:97 rtx/90000

a=fmtp:97 apt=96

a=rtpmap:98 VP9/90000

a=rtcp-fb:98 goog-remb

a=rtcp-fb:98 transport-cc

a=rtcp-fb:98 ccm fir

a=rtcp-fb:98 nack

a=rtcp-fb:98 nack pli

a=fmtp:98 profile-id=0

a=rtpmap:99 rtx/90000

a=fmtp:99 apt=98

a=rtpmap:100 VP9/90000

a=rtcp-fb:100 goog-remb

a=rtcp-fb:100 transport-cc

a=rtcp-fb:100 ccm fir

a=rtcp-fb:100 nack

a=rtcp-fb:100 nack pli

a=fmtp:100 profile-id=2

a=rtpmap:101 rtx/90000

a=fmtp:101 apt=100

a=rtpmap:127 red/90000

a=rtpmap:124 rtx/90000

a=fmtp:124 apt=127

a=rtpmap:125 ulpfec/90000

",

   "type" : "answer"

}

Opus 格式设置为:

 WebRtcVoiceMediaChannel::SetSendParameters: {codecs: [AudioCodec[111:opus:48000:0:2], AudioCodec[103:ISAC:16000:0:1], AudioCodec[104:ISAC:32000:0:1], AudioCodec[9:G722:8000:0:1], AudioCodec[102:ILBC:8000:0:1], AudioCodec[0:PCMU:8000:0:1], AudioCodec[8:PCMA:8000:0:1], AudioCodec[106:CN:32000:0:1], AudioCodec[105:CN:16000:0:1], AudioCodec[13:CN:8000:0:1], AudioCodec[110:telephone-event:48000:0:1], AudioCodec[112:telephone-event:32000:0:1], AudioCodec[113:telephone-event:16000:0:1], AudioCodec[126:telephone-event:8000:0:1]], extensions: [{uri: urn:ietf:params:rtp-hdrext:ssrc-audio-level, id: 1}, {uri: http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01, id: 2}, {uri: urn:ietf:params:rtp-hdrext:sdes:mid, id: 3}, {uri: urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id, id: 4}, {uri: urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id, id: 5}], extmap-allow-mixed: false, max_bandwidth_bps: -1, mid: 0, options: AudioOptions {}}

(audio_send_stream.cc:258): AudioSendStream::ConfigureStream: {rtp: {ssrc: 1708860063, extmap-allow-mixed: false, extensions: [{uri: http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01, id: 2}, {uri: urn:ietf:params:rtp-hdrext:sdes:mid, id: 3}, {uri: urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id, id: 5}, {uri: urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id, id: 4}, {uri: urn:ietf:params:rtp-hdrext:ssrc-audio-level, id: 1}], c_name: +zQ1fzmm8MR/paky}, rtcp_report_interval_ms: 5000, send_transport: (Transport), media_transport: null, min_bitrate_bps: 32000, max_bitrate_bps: 32000, send_codec_spec: {nack_enabled: false, transport_cc_enabled: true, cng_payload_type: , payload_type: 111, format: {name: opus, clockrate_hz: 48000, num_channels: 2, parameters: {minptime: 10, useinbandfec: 1}}}}

fc7ff708 11debac8 77258033 5019e027 51327245 0653a6ed 4faf51d4 d254a135 2f6f78f4 d269413d 52fa12e4 cdd88727 05fb302f 9739b367 bda9c26b de98514a 982d93c5 d359ddb0 fbfeaecc 19c9e690 e645e35f fa8fd12e fbc131cf 6913aa0a 4facf341 9f2021a3 8fb620

68222a50 0b25ad5f 9c19543b c2d15e0f a1b3170e 0728546a f0ae3e04 2bf4e1ba 98e98220 3f8fd24e 4ba1b6d3 0260ee36 9d91ffee b4e6b429 4dedee9b 5d7bfbbb fa34df8c 67a205cb 36d7b761 44e778e4 cb4685a5 bd

780be749 feef07fc d847401c f2af5d2b 191eec21 018489d0 eecb817c 2c4c8835 658022dd 51639426 c1a19e0b 7f4dce2f a4ce

一些 OPUS 相关定义:

#define OPUS_SIGNAL_VOICE                    3001 /**< Signal being encoded is voice */

#define OPUS_SIGNAL_MUSIC                    3002 /**< Signal being encoded is music */

#define OPUS_BANDWIDTH_NARROWBAND            1101 /**< 4 kHz bandpass @hideinitializer*/

#define OPUS_BANDWIDTH_MEDIUMBAND            1102 /**< 6 kHz bandpass @hideinitializer*/

#define OPUS_BANDWIDTH_WIDEBAND              1103 /**< 8 kHz bandpass @hideinitializer*/

#define OPUS_BANDWIDTH_SUPERWIDEBAND         1104 /**<12 kHz bandpass @hideinitializer*/

#define OPUS_BANDWIDTH_FULLBAND              1105 /**<20 kHz bandpass @hideinitializer*/

 

#define MODE_SILK_ONLY          1000

#define MODE_HYBRID             1001

#define MODE_CELT_ONLY          1002

 

  Name Value Type
this 0x000000000c24df60 {config_={frame_size_ms=20 num_channels=1 application=kVoip (0) ...} payload_type_=...} webrtc::AudioEncoderOpusImpl *
  ◢ webrtc::AudioEncoder {...} webrtc::AudioEncoder
  ▶ __vfptr 0x0000000142125800 {JzlRtcP2p.exe!void(* webrtc::AudioEncoderOpusImpl::`vftable'[27])()} {0x0000000140a09dd5 {JzlRtcP2p.exe!webrtc::AudioEncoderOpusImpl::`vector deleting destructor'(unsigned int)}, ...} void * *
  ◢ config_ {frame_size_ms=20 num_channels=1 application=kVoip (0) ...} webrtc::AudioEncoderOpusConfig
  frame_size_ms 20 int
  num_channels 1 unsigned __int64
  application kVoip (0) webrtc::AudioEncoderOpusConfig::ApplicationMode
  ◢ bitrate_bps {...} absl::optional
  ▶ absl::optional_internal::optional_data {...} absl::optional_internal::optional_data
  absl::optional_internal::optional_ctor_base<0> {...} absl::optional_internal::optional_ctor_base<0>
  absl::optional_internal::optional_assign_base<0> {...} absl::optional_internal::optional_assign_base<0>
  fec_enabled true bool
  cbr_enabled false bool
  max_playback_rate_hz 48000 int
  complexity 9 int
  low_rate_complexity 9 int
  complexity_threshold_bps 12500 int
  complexity_threshold_window_bps 1500 int
  dtx_enabled false bool
  ▶ supported_frame_lengths_ms { size=3 } std::vector >
  uplink_bandwidth_update_interval_ms 200 int
  payload_type -1 int
  payload_type_ 111 const int
  send_side_bwe_with_overhead_ false const bool
  use_link_capacity_for_adaptation_ false const bool
  adjust_bandwidth_ false const bool
  bitrate_changed_ true bool
  packet_loss_rate_ 0.000000000 float
  min_packet_loss_rate_ 0.000000000 const float
  ▶ new_packet_loss_optimizer_ empty const std::unique_ptr >
  ▶ input_buffer_ { size=960 } std::vector >
  ▶ inst_ 0x000000000c1fa2e0 {encoder=0x000000000c2a8070 {celt_enc_offset=38288 silk_enc_offset=18040 silk_mode=...} ...} WebRtcOpusEncInst *
  first_timestamp_in_buffer_ 3840 unsigned int
  num_channels_to_encode_ 1 unsigned __int64
  next_frame_length_ms_ 20 int
  complexity_ 9 int
  ▶ packet_loss_fraction_smoother_ unique_ptr {last_sample_time_ms_=175498943 smoother_={alpha_=0.999899983 filtered_=-1.00000000 max_=-1.00000000 } } std::unique_ptr >
  ▶ audio_network_adaptor_creator_ std::unique_ptr > (const std::basic_string,std::allocator > & config_string, webrtc::RtcEventLog * event_log){...} const std::function > __cdecl(std::basic_string,std::allocator > const &,webrtc::RtcEventLog *)>
  ▶ audio_network_adaptor_ empty std::unique_ptr >
  ▶ overhead_bytes_per_packet_ {...} absl::optional
  ▶ bitrate_smoother_ unique_ptr {init_time_ms_=5000 init_factor_=0.998297989 init_const_=8.50878906 ...} const std::unique_ptr >
  ▶ bitrate_smoother_last_update_time_ {...} absl::optional<__int64>
  ▶ link_capacity_allocation_bps_ {...} absl::optional<__int64>
  consecutive_dtx_frames_ 0 int

 

 

  Name Value Type
st 0x000000000c2a8070 {celt_enc_offset=38288 silk_enc_offset=18040 silk_mode={nChannelsAPI=1 nChannelsInternal=...} ...} OpusEncoder *
  celt_enc_offset 38288 int
  silk_enc_offset 18040 int
  ◢ silk_mode {nChannelsAPI=1 nChannelsInternal=1 API_sampleRate=48000 ...} silk_EncControlStruct
  nChannelsAPI 1 int
  nChannelsInternal 1 int
  API_sampleRate 48000 int
  maxInternalSampleRate 16000 int
  minInternalSampleRate 16000 int
  desiredInternalSampleRate 16000 int
  payloadSize_ms 20 int
  bitRate 22100 int
  packetLossPercentage 0 int
  complexity 9 int
  useInBandFEC 1 int
  LBRR_coded 0 int
  useDTX 0 int
  useCBR 0 int
  maxBits 922 int
  toMono 0 int
  opusCanSwitch 0 int
  reducedDependency 0 int
  internalSampleRate 16000 int
  allowBandwidthSwitch 1 int
  inWBmodeWithoutVariableLP 1 int
  stereoWidth_Q14 15360 int
  switchReady 0 int
  signalType 0 int
  offset 240 int
  application 2048 int
  channels 1 int
  delay_compensation 192 int
  force_channels -1000 int
  signal_type -1000 int
  user_bandwidth -1000 int
  max_bandwidth 1105 int
  user_forced_mode -1000 int
  voice_ratio 82 int
  Fs 48000 int
  use_vbr 1 int
  vbr_constraint 1 int
  variable_duration 5000 int
  bitrate_bps 32000 int
  user_bitrate_bps 32000 int
  lsb_depth 24 int
  encoder_buffer 480 int
  lfe 0 int
  arch 4 int
  use_dtx 0 int
  ◢ analysis {arch=4 application=2048 Fs=48000 ...} TonalityAnalysisState
  arch 4 int
  application 2048 int
  Fs 48000 int
  ▶ angle 0x000000000c2a8138 {0.000000000, 0.371065110, -0.178583264, 0.169607878, -0.336950421, -0.0553655699, ...} float[240]
  ▶ d_angle 0x000000000c2a84f8 {0.000000000, 0.211459041, 0.108894110, -0.0403590798, -0.0484426916, -0.0585320257, ...} float[240]
  ▶ d2_angle 0x000000000c2a88b8 {0.000000000, 0.00185681810, 0.000212006868, 0.000139717609, 0.000239213259, 0.000370358146, ...} float[240]
  ▶ inmem 0x000000000c2a8c78 {-0.00359834707, -0.00321650039, -0.00343828206, -0.00407011248, -0.00430583814, ...} float[720]
  mem_fill 240 int
  ▶ prev_band_tonality 0x000000000c2a97bc {0.0707340315, 0.256839573, 0.0646021217, 0.0535893366, 4.82304631e-06, 0.00638849102, ...} float[18]
  prev_tonality 0.0744439214 float
  prev_bandwidth 16 int
  ▶ E 0x000000000c2a980c {0x000000000c2a980c {2.55750088e-08, 9.36143074e-09, 2.76515277e-09, 1.35677691e-09, ...}, ...} float[8][18]
  ▶ logE 0x000000000c2a9a4c {0x000000000c2a9a4c {-17.4777470, -18.4760418, -19.6706448, -20.3470402, -21.3746700, ...}, ...} float[8][18]
  ▶ lowE 0x000000000c2a9c8c {-17.4777470, -18.4760418, -19.6706448, -20.3470402, -21.3746700, -20.4640789, -20.0291424, ...} float[18]
  ▶ highE 0x000000000c2a9cd4 {-10.1126461, -13.4705744, -15.9786558, -17.1679306, -17.9192219, -16.4453983, -14.3947802, ...} float[18]
  ▶ meanE 0x000000000c2a9d1c {1.69691320e-05, 1.21011362e-06, 3.28179901e-08, 9.97130112e-09, 4.68893901e-09, ...} float[19]
  ▶ mem 0x000000000c2a9d68 {-75.0991974, 4.48027182, 1.93349600, 4.91965246, 1.66545582, 4.41493130, -0.158232212, ...} float[32]
  ▶ cmean 0x000000000c2a9de8 {-73.6217041, 5.10436296, 1.28940845, 4.50601101, 0.000000000, 0.000000000, 0.000000000, ...} float[8]
  ▶ std 0x000000000c2a9e08 {0.282320261, 0.187619641, 0.852573156, 0.488151670, 1.46251786, 0.275115967, 0.825375319, ...} float[9]
  music_prob 0.102564953 float
  vad_prob 0.0822941810 float
  Etracker -0.0210000016 float
  lowECount 1.00000000 float
  E_count 7 int
  last_music 0 int
  count 7 int
  analysis_offset 0 int
  ▶ pspeech 0x000000000c2a9e4c {0.896234274, 0.000000000, 0.000000000, 0.000000000, 0.000000000, 0.000000000, 0.000000000, ...} float[100]
  ▶ pmusic 0x000000000c2a9fdc {0.103052884, 0.000000000, 0.000000000, 0.000000000, 0.000000000, 0.000000000, 0.000000000, ...} float[100]
  speech_confidence 0.100000001 float
  music_confidence 0.899999976 float
  speech_confidence_count 0 int
  music_confidence_count 0 int
  write_pos 7 int
  read_pos 7 int
  read_subframe 0 int
  hp_ener_accum 0.000000000 float
  ▶ downmix_state 0x000000000c2aa18c {-0.00205630972, -0.00201843097, 0.00201843097} float[3]
  ▶ info 0x000000000c2aa198 {{valid=1 tonality=0.0630559996 tonality_slope=0.0293915570 ...}, {valid=1 tonality=...}, ...} AnalysisInfo[100]
  stream_channels 1 int
  hybrid_stereo_width_Q14 16384 short
  variable_HP_smth2_Q15 193536 int
  prev_HB_gain 0.998388469 float
  ▶ hp_mem 0x000000000c2ab788 {0.000429835636, -0.000430019340, 0.000000000, 0.000000000} float[4]
  mode 1001 int
  prev_mode 1001 int
  prev_channels 1 int
  prev_framesize 960 int
  bandwidth 1104 int
  auto_bandwidth 1105 int
  silk_bw_switch 0 int
  first 0 int
  ▶ energy_masking 0x0000000000000000 {???} float *
  ▶ width_mem {XX=0.000000000 XY=0.000000000 YY=0.000000000 ...} StereoWidthState
  ▶ delay_buffer 0x000000000c2ab7d4 {-0.00312746083, -0.00290988642, -0.00281588663, -0.00290483702, -0.00314440276, ...} float[960]
  detected_bandwidth 1104 int
  nb_no_activity_frames 0 int
  peak_signal_energy 0.000117333788 float
  nonfinal_frame 0 int
  rangeFinal 0 unsigned int

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 



 

你可能感兴趣的:(webrtc)