dsp.c: Fix and improve potentially inaccurate log message.#596
Conversation
|
cherry-pick-to: 18 |
| int freqmode; | ||
| int dtmf_began; | ||
| int display_inband_dtmf_warning; | ||
| unsigned int display_inband_dtmf_warning:1; |
There was a problem hiding this comment.
Unrelated change that snuck in? If not can you explain the rationale for this change?
There was a problem hiding this comment.
It is related; I reviewed all the code where this is used and set, and it only needs to be a bitfield, not an int.
I considered renaming the variable too for clarity but guess I didn't do that.
There was a problem hiding this comment.
But you aren't changing any code that reads or sets this structure member, so it's not clear to me what the benefit is. Does it change the generated code? Due to alignment concerns I don't think it would change the size of the struct either?
There was a problem hiding this comment.
It's more semantic. You can look at the struct and know that it's a boolean variable, which was not conveyed before. I think it helps with code clarity to do this, regardless of space savings, since it serves as documentation.
If more bitfields are added in the future, then it would actually reduce memory usage.
There was a problem hiding this comment.
If more bitfields are added in the future, then it would actually reduce memory usage.
I don't think that is correct, but I will defer to your expertise on this.
There was a problem hiding this comment.
I don't like change for the sake of change. If that time ever comes, then it can be changed at that point. Right now it is premature to touch it or care about it. Just changing the log message is fine.
There was a problem hiding this comment.
It wasn't really for a future hypothetical performance benefit, it was more for making the code more self-documenting, since that variable is already a misnomer. I've changed it back but added a documentation note about this.
There was a problem hiding this comment.
Looks like busymaybe could be a bitfield too. I would add the same comment there so people aren't confused.
64fa75c to
4abd555
Compare
| int freqmode; | ||
| int dtmf_began; | ||
| int display_inband_dtmf_warning; | ||
| unsigned int display_inband_dtmf_warning:1; |
There was a problem hiding this comment.
I don't like change for the sake of change. If that time ever comes, then it can be changed at that point. Right now it is premature to touch it or care about it. Just changing the log message is fine.
4abd555 to
65b7d1f
Compare
If ast_dsp_process is called with a codec besides slin, ulaw, or alaw, a warning is logged that in-band DTMF is not supported, but this message is not always appropriate or correct, because ast_dsp_process is much more generic than just DTMF detection. This logs a more generic message in those cases, and also improves codec-mismatch logging throughout dsp.c by ensuring incompatible codecs are printed out. Resolves: asterisk#595
65b7d1f to
b8ada4b
Compare
|
Successfully merged to branch master and cherry-picked to ["18","20","21"] |
If ast_dsp_process is called with a codec besides slin, ulaw, or alaw, a warning is logged that in-band DTMF is not supported, but this message is not always appropriate or correct, because ast_dsp_process is much more generic than just DTMF detection.
This logs a more generic message in those cases, and also improves codec-mismatch logging throughout dsp.c by ensuring incompatible codecs are printed out.
Resolves: #595