-
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
fix timestamp and duration for received dtmf events for G722 and Opus (#4117) #4159
base: master
Are you sure you want to change the base?
Conversation
pjmedia/src/pjmedia/stream.c
Outdated
@@ -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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
pjmedia/src/pjmedia/stream.c
Outdated
/* Correct duration and timestamp for codecs where clock_rate | ||
* differs from sample rate | ||
*/ | ||
float ts_modifier = 1.0; |
There was a problem hiding this comment.
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.
65f91a8
to
1535801
Compare
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.