Skip to content

Commit

Permalink
refactor(las): remove las's setting from ijkplayer
Browse files Browse the repository at this point in the history
1. remove is-manifest checking
2. pass dynamic buffer length through FFTrackCacheStatistic
3. pass other infos through LasContext
  • Loading branch information
johnwenjunwu committed Apr 23, 2021
1 parent 13f03e8 commit 640f3cb
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 203 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ public IMediaPlayer createPlayer(int playerType) {

if (mManifestString != null) {
ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "iformat", "ijklas");
ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "is-manifest", 1);
ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "find_stream_info", 0);
ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "manifest_string", mManifestString);
}
if (mSettings.getUsingMediaCodec()) {
Expand Down
20 changes: 3 additions & 17 deletions ijkmedia/ijkplayer/ff_ffplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
#include "libavutil/avassert.h"
#include "libavutil/time.h"
#include "libavformat/avformat.h"
#include "ijkavformat/ijklas.h"
#if CONFIG_AVDEVICE
#include "libavdevice/avdevice.h"
#endif
Expand Down Expand Up @@ -3117,13 +3116,9 @@ static int read_thread(void *arg)

if (ffp->iformat_name)
is->iformat = av_find_input_format(ffp->iformat_name);

if (ffp->is_manifest) {
extern AVInputFormat ijkff_las_demuxer;
is->iformat = &ijkff_las_demuxer;
av_dict_set_int(&ffp->format_opts, "las_player_statistic", (intptr_t) (&ffp->las_player_statistic), 0);
ffp->find_stream_info = false;
}

av_dict_set_intptr(&ffp->format_opts, "video_cache_ptr", (intptr_t)&ffp->stat.video_cache, 0);
av_dict_set_intptr(&ffp->format_opts, "audio_cache_ptr", (intptr_t)&ffp->stat.audio_cache, 0);
err = avformat_open_input(&ic, is->filename, is->iformat, &ffp->format_opts);
if (err < 0) {
print_error(is->filename, err);
Expand Down Expand Up @@ -4001,8 +3996,6 @@ FFPlayer *ffp_create()
ffp->meta = ijkmeta_create();

av_opt_set_defaults(ffp);

las_stat_init(&ffp->las_player_statistic);
return ffp;
}

Expand All @@ -4022,7 +4015,6 @@ void ffp_destroy(FFPlayer *ffp)
ffpipenode_free_p(&ffp->node_vdec);
ffpipeline_free_p(&ffp->pipeline);
ijkmeta_destroy_p(&ffp->meta);
las_stat_destroy(&ffp->las_player_statistic);
ffp_reset_internal(ffp);

SDL_DestroyMutexP(&ffp->af_mutex);
Expand Down Expand Up @@ -4637,18 +4629,12 @@ void ffp_audio_statistic_l(FFPlayer *ffp)
{
VideoState *is = ffp->is;
ffp_track_statistic_l(ffp, is->audio_st, &is->audioq, &ffp->stat.audio_cache);
if (ffp->is_manifest) {
las_set_audio_cached_duration_ms(&ffp->las_player_statistic, ffp->stat.audio_cache.duration);
}
}

void ffp_video_statistic_l(FFPlayer *ffp)
{
VideoState *is = ffp->is;
ffp_track_statistic_l(ffp, is->video_st, &is->videoq, &ffp->stat.video_cache);
if (ffp->is_manifest) {
las_set_video_cached_duration_ms(&ffp->las_player_statistic, ffp->stat.video_cache.duration);
}
}

void ffp_statistic_l(FFPlayer *ffp)
Expand Down
4 changes: 0 additions & 4 deletions ijkmedia/ijkplayer/ff_ffplay_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
#include "ff_ffmsg_queue.h"
#include "ff_ffpipenode.h"
#include "ijkmeta.h"
#include "ijkavformat/ijklas.h"

#define DEFAULT_HIGH_WATER_MARK_IN_BYTES (256 * 1024)

Expand Down Expand Up @@ -721,8 +720,6 @@ typedef struct FFPlayer {
char *mediacodec_default_name;
int ijkmeta_delay_init;
int render_wait_start;
int is_manifest;
LasPlayerStatistic las_player_statistic;
} FFPlayer;

#define fftime_to_milliseconds(ts) (av_rescale(ts, 1000, AV_TIME_BASE))
Expand Down Expand Up @@ -833,7 +830,6 @@ inline static void ffp_reset_internal(FFPlayer *ffp)
ffp->mediacodec_default_name = NULL; // option
ffp->ijkmeta_delay_init = 0; // option
ffp->render_wait_start = 0;
ffp->is_manifest = 0;

ijkmeta_reset(ffp->meta);

Expand Down
3 changes: 0 additions & 3 deletions ijkmedia/ijkplayer/ff_ffplay_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,6 @@ static const AVOption ffp_context_options[] = {
OPTION_OFFSET(ijkmeta_delay_init), OPTION_INT(0, 0, 1) },
{ "render-wait-start", "render wait start",
OPTION_OFFSET(render_wait_start), OPTION_INT(0, 0, 1) },
{ "is-manifest", "is manifest string",
OPTION_OFFSET(is_manifest), OPTION_INT(0, 0, 1) },

{ NULL }
};

Expand Down
Loading

0 comments on commit 640f3cb

Please sign in to comment.