Skip to content
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

fix timestamp and duration for received dtmf events for G722 and Opus (#4117) #4159

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

R-Jeske
Copy link
Contributor

@R-Jeske R-Jeske commented Nov 14, 2024

This fixes: #4117: DTMF duration is wrong for G722 on receiver with RFC2833

For G722 and Opus, the sample rate may differ from the clock rate. Thus, the calculation of duration and timestamp of a received RFC2833 DTMF event must be recalculated based on the real clock rate specified as specified in the standards.

@@ -1841,10 +1855,23 @@ static void handle_incoming_dtmf( pjmedia_stream *stream,
* the DTMF digits in the buffer.
*/
if (stream->dtmf_event_cb) {
/* Correct duration and timestamp for codecs where clock_rate
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is essentially the same code as above, should we put it in the outer block instead, to avoid duplication?

Copy link
Contributor Author

@R-Jeske R-Jeske Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, i agree. I've added a commit to reduce redundancy: 65f91a8

/* Correct duration and timestamp for codecs where clock_rate
* differs from sample rate
*/
float ts_modifier = 1.0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Only one small modification required. The variable declaration needs to be at the beginning of the block.

@R-Jeske R-Jeske force-pushed the fix_timestamp_and_duration_for_dtmf branch from 65f91a8 to 1535801 Compare November 15, 2024 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DTMF duration is wrong for G722 on receiver with RFC2833
4 participants