[Asterisk-code-review] res_musiconhold: Start playlist after initial announcement (asterisk[18])

Friendly Automation asteriskteam at digium.com
Wed Sep 23 11:25:45 CDT 2020


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/14976 )

Change subject: res_musiconhold: Start playlist after initial announcement
......................................................................

res_musiconhold: Start playlist after initial announcement

Only track our sample offset if we are playing a non-announcement file,
otherwise we will skip that number of samples when we start playing the
first MoH file.

ASTERISK-24329 #close

Change-Id: Ib6b3c84fcaa1063889ab38ba7e7fc50050a3ccfc
---
M res/res_musiconhold.c
1 file changed, 6 insertions(+), 1 deletion(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 3749d7b..46bc4b9 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -477,7 +477,12 @@
 			return -1;
 		}
 
-		state->samples += f->samples;
+		/* Only track our offset within the current file if we are not in the
+		 * the middle of an announcement */
+		if (!state->announcement) {
+			state->samples += f->samples;
+		}
+
 		state->sample_queue -= f->samples;
 		if (ast_format_cmp(f->subclass.format, state->mohwfmt) == AST_FORMAT_CMP_NOT_EQUAL) {
 			ao2_replace(state->mohwfmt, f->subclass.format);

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14976
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: Ib6b3c84fcaa1063889ab38ba7e7fc50050a3ccfc
Gerrit-Change-Number: 14976
Gerrit-PatchSet: 2
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200923/aa57e4fa/attachment-0001.html>


More information about the asterisk-code-review mailing list