TT#50652 return media duration to SIP proxy in play_media response

Change-Id: Ib09519f960b37ca41a554aa2779f71c91ef9b49d
changes/43/27743/4
Richard Fuchs 7 years ago
parent e1e6fd4297
commit 7da2b523a7

@ -1778,6 +1778,9 @@ const char *call_play_media_ng(bencode_item_t *input, bencode_item_t *output) {
else
goto out;
if (monologue->player->duration)
bencode_dictionary_add_integer(output, "duration", monologue->player->duration);
err = NULL;
out:

@ -220,6 +220,8 @@ found:
if (!mp->ssrc_out)
return -1;
mp->duration = avs->duration * 1000 * avs->time_base.num / avs->time_base.den;
return 0;
}
@ -334,6 +336,9 @@ found:
// call->master_lock held in W
static void media_player_play_start(struct media_player *mp) {
// needed to have usable duration for some formats. ignore errors.
avformat_find_stream_info(mp->fmtctx, NULL);
mp->next_run = rtpe_now;
// give ourselves a bit of a head start with decoding
timeval_add_usec(&mp->next_run, -50000);

@ -33,6 +33,7 @@ struct media_player {
struct timeval next_run;
AVFormatContext *fmtctx;
unsigned long duration; // in milliseconds
AVPacket pkt;
struct codec_handler *handler;
struct ssrc_ctx *ssrc_out;

Loading…
Cancel
Save