Make both `media_player_opts_t.db_id` and `media_player_content_index.db_id`
unsigned because:
- they aren't used with any guards/init values
- most DB-media API functionality actually uses `unsigned long long`
So this makes the ids consistent with the usage of them
in the actual code.
Change-Id: I6c756c537b3c992099a6857683078c169d5e030d
Currently uses "media player" as a name,
but for debugging purposes of thread dumps/logs, it's clearer
to have according name, so just name it "send timer".
Change-Id: If2a9111d014a659514ccb8c40ee919135a57ca9e
Make this sentinel visible via header, because anywhere
where the `kernel_idx` is declared/used,
this won't be usable due to limited visibility to .c file.
Change-Id: I159fe1a87e92656fdd790dd98569cfebe80d4ddd
For comparison reasons. This last unrefactored condition
was missed during the refactoring here: 93c49e9c2e
Change-Id: Iee7c01e776945a34eaa87d6c0d7bba8d405395a8
To not leak on media changes (ssrc differs), release
previous `->ssrc_out`, then overwrite the pointer.
`get_ssrc()` returns an owned reference.
Change-Id: Iaae6e24fe7b6a28bea06fb58794416d6c79894a2
Before to start the media player, check if the
seek process for the start frame failed, because
otherwise it starts from the unexpected position,
and there is no awareness about it.
Just add log for this case.
Change-Id: I36a912a9ef044825b050f8b7a6ad5562571b7d34
So that their naming is self-evident and correlates
with the actual options flag:
- `media-files-expire` -> `media_files_expire_us`
- `db-cache-expire` -> `db_cache_expire_us`
- `db-media-expire` -> `db_media_expire_us`
Change-Id: I76ebe9f92ba22de7c19fbb2ff47d0bf1952e1480
When accessing the array members via the pointer they
are still read-only, but the entries themselves are mutable.
So just make the elements constant pointers.
Also comply with the indentation style, and use tabs, not spaces.
Change-Id: I2165d0bf0b7b3ee4ad053c235dae4f60f36c1a43
In case the allocation of pcre for streams regex
fails, but not for the info, we never free
the latter one, because on returning an error,
just calling `die()`, hence no de-allocation
procedures are fulfilled.
Change-Id: I4a39b2c3043798c59fa6ec2fe0d70b1b1b27517f
Previous approach based on the strhash used
to support an upper case variant of "cli" command.
Just preserve it.
Current NG_COMMANDS based macro generation, uses
only lower cases based on the command name from
the table, so not mess things more, just add
one exception for the "CLI".
Change-Id: I0bb373a50f56a44c13921a24fddf9534379b8e0d
For the following arrays:
- `ng_command_strings`
- `ng_command_strings_esc`
- `ng_command_strings_short`
Because there are still external users of them,
which should be reworked in the future to use the
`ng_command_defs` instead.
Change-Id: I4086513e295b00cc23ee035b004e896a83294bf9
With the newly introduced `ng_command_find()` lookup func.
Add the local `ng_command_def` and maintain via it.
Check whether:
- the handler has been defined
- the handler gets properly selected
- the command is defined (known)
Accordingly update the opmode of the command context.
By default define as `OP_OTHER` always.
For the case when no handler has been defined, introduce
the error reply "No handler found".
Accordingly trigger selected handler after
the command was found.
The main payoff here is that the command processing
flow becomes quite transparent and easy to maintain:
- parse command string
- lookup command definition
- set opmode from table
- call uniform handler
- shared error/success reply handling for all commands
Deprecate strhash based `__csh_lookup()`/`CSH_LOOKUP()`.
Accordingly adap the daemons's and tests Makefile,
remove the strhash objects with the normal control_ng one.
Additionally:
introduce the special `resultstr = "pong"` for the
ping command case, because all other commands have "ok".
Change-Id: Ifff7d7f61ae4d25fd220460f4485d794c9a7cbd5
Instead of the previous approach using the strhash,
introduce if-based lookup from `NG_COMMANDS`.
The usage of strhash is deprecated because it:
- forses string literals in switch cases, hence gives
no possibility to use variables
- makes then shortcuts using macro not possible to be used
- it makes the part with the command find and
actual commands definition duplicate, because
one has to maintain both of them when adding/removing commands
- switch is redundant and feels heavy, meanwhile the same
thing can be generated using marco based on `NG_COMMANDS`
introduced before, which are the main source of the truth
Newer approach:
- avoid usage of for/while cycles (because CPU consuming)
- sorts the lookup based on the cmd name (string) length,
what makes the command find efficient, because exlcludes
unnecessary comparisons
- uses the `memcmp()` at the very last
- for example, for the "offer" command it may run the `memcmp()`
only two times, because there are only two commands with
the length 5 our of supported 35 commands in list now
Additionally:
include `string.h` for `memcmp()` operations.
Change-Id: Iae70de87b88cd444ae162ba2b7c6aa7690731ee3
Introduce a common NG commands table `ng_command_defs`
for all type of things: OP enum, name, escaped name,
short name and most important the handler.
This table operates on and returns a dedicated struct `ng_command_def`,
which has all the information required on the command (like
all type of things mentioned above) and may have either
single-parameter or double-parameter signature (for cases with
the `addr` requiring commands such as the offer command).
Also add unified signatures for X and XA handlers,
they will be used later accordingly. Most of those use single-parameter,
and those exceptional use the second one.
Also add dummy plug-functions for ping and block/unblock silence media.
The ping one doesn't have any particular handler, but because a new
structure of NG commands wants to see a real declaration of the func
handler, just give it. For the block/unblock silence media, there aren't
even handling of commands in the control NG, they are just dummy OPs,
so fulfill the actual NG commands structure, and give them dummy funcs.
Change-Id: I2064ddca1595079959a6c6843119556a8b6bf5d5
Keep enum `ng_opmode` generated from the command list,
and also keep `ng_command_strings[]`, `ng_command_strings_esc[]`
and `ng_command_strings_short[]`.
And add the wrapper func name into the array, to be able
to appeal to it later, when processing any coming NG command.
Change-Id: I6aa725679d2405277f4497db46c3a8010d9ccd56
When iterating through medias, check whether there is something in;
- `->streams.head`
- `->selected_sfd`
- `->socket.local.address.family`
before to blidnly appeal to it.
If transform setup can ever produce incomplete media,
this might crash while building the response.
Change-Id: Ie75f20b111634ee3faa0af58c1eebfddbbcc843e
When iterating through the monologues medias while
looking for the media sink, filter those, which aren't audio.
Such a media type will likely have no audio subscriber,
and most probably will return with:
"There is no sink media capable of DTMF playback"
Change-Id: I86e64105e520f2a6f3ee9bbb0271830ae8d8cc69
For-cycle expects the `sink_ml` for setting the `call_media`
at the upper level of the cycle, but instead the `monologue`
is used, which is supposed to be used in the nested for-cycle.
Looks like a copy-paste typo. Major fix.
Change-Id: I225a51fde7fa8d10bac832ce5fc5444ee544e882
The loop is 1-based, but checks the outside
of bounds with `i <= 1`. If the length is 1 and
iterator is 1, this already fails.
Hence allow `i` to be 1, and also check it's not
beyound the media array length.
Change-Id: I9112fc88155fa53205c04ef35b00f6573b6816b3