Opened 16 years ago

Closed 16 years ago

#486 closed defect (fixed)

Handle G.722 wong clock rate bug and other codec with inconsistent clock rate

Reported by: nanang Owned by: nanang
Priority: normal Milestone: release-0.9.0
Component: pjmedia Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported:

Description (last modified by nanang)

Some codecs need to be treated special:

  • G.722, because of erroneously assigned in RFC 1890, its actual sampling rate is 16kHz but need to be defined as 8kHz in the SDP and also affecting its RTP timestamp clock rate. (RFC 3551 4.5.2)
  • MPEG audio, for compatibility with other MPEG systems, MPEG Audio uses 90kHz RTP timestamp clock rate separate from the audio sampling clock rate. (RFC 3551 4.5.13 & RFC 3119)

Attachments (3)

ticket486.patch (9.7 KB) - added by nanang 16 years ago.
ticket486.2.patch (11.6 KB) - added by nanang 16 years ago.
ticket486.3.patch (11.5 KB) - added by nanang 16 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 16 years ago by nanang

  • Description modified (diff)

Changed 16 years ago by nanang

comment:2 Changed 16 years ago by nanang

Attachment "ticket486.patch":

  • modified endpoint.c: special case for G.722 sampling rate defined as 8000.
  • modified stream.c:
    • added macro HANDLE_G722_MPEG_BUG to enable/disable special handling for those 'problematic' codecs.
    • renamed variable 'enc_samples_per_frame' into 'enc_samples_per_pkt'
    • added learning mechanism to detect peer RTP clockrate for those 'problematic' codecs, this feature should make pjmedia compatible with more SIP phones (they have different treatment for G.722 codec)
    • added RTP clock rate handling for those codecs, according to peer behaviour.

Changed 16 years ago by nanang

comment:3 Changed 16 years ago by nanang

  • Status changed from new to assigned

Attachement ticket486.2.patch:

  • pjmedia/config.h: introduced macro PJMEDIA_HANDLE_G722_MPEG_BUG, when it defined, pjmedia will enable special handling on SDP and RTP clock rate for problematic codecs. This macro is enabled by default.
  • modified endpoint.c & session.c: special case for G.722 sampling rate defined as 8000 for SDP, and 16000 for session info.
  • modified stream.c:
    • added special handling for G.722
    • added learning mechanism to detect peer RTP clockrate for those 'problematic' codecs, this feature should make pjmedia compatible with more SIP phones (they have different treatment for G.722 codec)
    • renamed variable 'enc_samples_per_frame' into 'enc_samples_per_pkt'

Changed 16 years ago by nanang

comment:4 Changed 16 years ago by nanang

Attachment ticket486.3.patch, same as ticket486.2.patch, with modification:

  • learning iteration, instead of boolean flag (incons_checked), now it uses counter (rtp_rx_check_cnt)
  • changed hardcoded numbers 160/320 to variable stream->xxx.samples_per_frame/pkt, just in case the 722 codec ptime is not 20
  • added jbuf reset after detection finished

comment:5 Changed 16 years ago by bennylp

  • Resolution set to fixed
  • Status changed from assigned to closed
  • Summary changed from Handle audio/speech codec with 'problematic' clockrate to Handle G.722 wong clock rate bug and other codec with inconsistent clock rate

Committed in r1813 with some modifications:

  • changed samples per frame division to use number of frames from previous RTP packet rather than current one.
  • Minor changes in the comments/documentation.

Thanks.

Note: See TracTickets for help on using tickets.