MT#59038 support repeat starts of the same player

Change-Id: I492e5cae7b8192808fa127ec45c79e27cf30d30d
pull/1808/head
Richard Fuchs 1 year ago
parent 151c45ddd7
commit cb39c9a7e8

@ -935,13 +935,15 @@ static const rtp_payload_type *media_player_play_init(struct media_player *mp) {
// call->master_lock held in W
static void media_player_play_start(struct media_player *mp, const rtp_payload_type *dst_pt) {
// needed to have usable duration for some formats. ignore errors.
avformat_find_stream_info(mp->coder.fmtctx, NULL);
if (!mp->coder.fmtctx->streams || !mp->coder.fmtctx->streams[0])
avformat_find_stream_info(mp->coder.fmtctx, NULL);
mp->coder.avstream = mp->coder.fmtctx->streams[0];
if (!mp->coder.avstream) {
ilog(LOG_ERR, "No AVStream present in format context");
return;
}
if (__ensure_codec_handler(mp, dst_pt))
return;
@ -960,6 +962,9 @@ static void media_player_play_start(struct media_player *mp, const rtp_payload_t
ilog(LOG_DEBUG, "Seeking to position %lli", mp->opts.start_pos);
av_seek_frame(mp->coder.fmtctx, 0, mp->opts.start_pos, 0);
}
else // in case this is a repeated start
av_seek_frame(mp->coder.fmtctx, 0, 0, 0);
media_player_read_packet(mp);
}
#endif

Loading…
Cancel
Save