Browse Source

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
commit
7da2b523a7
3 changed files with 9 additions and 0 deletions
  1. +3
    -0
      daemon/call_interfaces.c
  2. +5
    -0
      daemon/media_player.c
  3. +1
    -0
      include/media_player.h

+ 3
- 0
daemon/call_interfaces.c View File

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


+ 5
- 0
daemon/media_player.c View File

@ -220,6 +220,8 @@ found:
if (!mp->ssrc_out) if (!mp->ssrc_out)
return -1; return -1;
mp->duration = avs->duration * 1000 * avs->time_base.num / avs->time_base.den;
return 0; return 0;
} }
@ -334,6 +336,9 @@ found:
// call->master_lock held in W // call->master_lock held in W
static void media_player_play_start(struct media_player *mp) { 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; mp->next_run = rtpe_now;
// give ourselves a bit of a head start with decoding // give ourselves a bit of a head start with decoding
timeval_add_usec(&mp->next_run, -50000); timeval_add_usec(&mp->next_run, -50000);


+ 1
- 0
include/media_player.h View File

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


Loading…
Cancel
Save