-
Notifications
You must be signed in to change notification settings - Fork 782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DTMF duration is wrong for G722 on receiver with RFC2833 #4117
Comments
The event duration calculation is done here. |
Clock Rate is 8000
Sample Rate is 16000
as stated in the standard. This is the case when the payload is created:
https://github.com/pjsip/pjproject/blob/master/pjmedia/src/pjmedia/stream.c#L998-L1000 because the time dependent values are adjusted to respect the different clock_rate of 8000 (half of 16000 sample rate):
https://github.com/pjsip/pjproject/blob/master/pjmedia/src/pjmedia/stream.c#L2742-L2748 On receiver side, there is no correction for the clock rate of 8000, so the duration is 1/2 of the send value;
https://github.com/pjsip/pjproject/blob/master/pjmedia/src/pjmedia/stream.c#L1801-L1802 This is exactly what I experience when I test the same duration on sender side (200ms), since I get a duration of 200 ms with PCMA, and 100 ms with G722, even both length in actual time (Wireshark) are 200ms. If clock_rate would be 8000 on receiver, the duration would be correct. But since the sample rate is 16000, the duration must be corrected in reverse of
|
Thank you for fixing this in #4124 . |
No, unfortunately this is not fixed with #4124, since this only handles those respects this behavior only on sender side. On receiver Side, it must me handled separately. |
Ah sorry, thanks for clarifying. Since in the above post, you already know the fix, would you also create a PR for it? |
Yes, i will create a PR tomorrow. |
see #4159 |
Describe the bug
When a DTMF Signal is transmitted with RFC2833 and DTMF events are used on the receiver, the duration from the callback
cb_on_dtmf_event
differs between G722 and PCMA codecs. When using the PCMA codec, the event is 200ms long and the duration from callback says 200ms (640 inside the packet), but when using the G722 Codec, the event is 200ms long and the duration from the callback says 100ms (640 inside the packet). I tested it with other lengths, and it is always the half in case of G722. Since theclock_rate
of both PCMA and G722 is 8000, I would assume, that a value of 640 inside the packet is correct. Thus there might be a correction missing (like thepjmedia_stream_create
PJMEDIA_HANDLE_G722_MPEG_BUG
)Steps to reproduce
PJSIP version
2.14.1
Context
Should occur on all platforms, that support G722
Log, call stack, etc
The text was updated successfully, but these errors were encountered: