美文网首页
BUG分析:

BUG分析:

作者: 小磊长江大 | 来源:发表于2018-05-11 13:44 被阅读0次

问题4:每次进入播放时上报的本次播放视频ID均为0,期望每次进入播放显示的ID不同

MediaPlayer.java

    private void setDataSource(String path, String[] keys, String[] values)
            throws IOException, IllegalArgumentException, SecurityException, IllegalStateException {
        disableProxyListener();
        getSubtitleService();

        final Uri uri = Uri.parse(path);
        if ("file".equals(uri.getScheme())) {
            path = uri.getPath();
        }

        final File file = new File(path);
        mPath = path;
        if (file.exists()) {
            FileInputStream is = new FileInputStream(file);
            FileDescriptor fd = is.getFD();
            setDataSource(fd);
            is.close();
        } else {
            _setDataSource(path, keys, values);
        }

        String mMesg = new String("setDataSource,url:");
        mMesg = mMesg + path ;
        final String tmpPath = path;
        save_log_in_file(PRINT_LOG_SETPLAYER_SOURCE,mMesg);
        cmd = null;
        cmd = new Intent("MEDIA_PLAY_MONITOR_MESSAGE");
        Looper looper = Looper.getMainLooper();
        Handler xHandler = new Handler(looper) {
            @Override
            public void handleMessage(Message msg) {
                switch (msg.what) {
                case 0x2f:
                    Context tmpContetx = ActivityThread.currentApplication()
                            .getApplicationContext();
                    if (!mSendPrepareEvent) {
                        long start = System.currentTimeMillis();
                        Log.d(TAG, "MEDIA_SET_DATASOURCE : "
                                + mSetDataSourceTime);
                        
                        cmd.putExtra("TYPE", "PLAY_PREPARE");
                        cmd.putExtra("START_TIME", start);
                        cmd.putExtra("URL", tmpPath);
                        //setDataSource时并没有ID,ID在prepare后才产生,因此必须拿上一次的ID+1,或者jni层prepare后拿ID
                        int next_id = SystemProperties.getInt("sys.next.player_id",1);
                        cmd.putExtra("ID", next_id);
                        tmpContetx.sendBroadcast(cmd);
                        mSendPrepareEvent = true;
                    }
                    return;
                }
                super.handleMessage(msg);
            }
        };
        Message message = xHandler.obtainMessage(0x2f);
        xHandler.sendMessage(message);
    }

在play start时更新一次ID

case MEDIA_GET_FIRST_PCR:
                if(mContext != null){
                    long start = System.currentTimeMillis();
                    int starttime = getCurrentPosition();
                    cmd.putExtra("TYPE", "PLAY_START");
                    cmd.putExtra("PLAY_TIME", starttime/1000);
                    cmd.putExtra("END_TIME", System.currentTimeMillis());
                    info = getMediaInfo();
                    cmd.putExtra("ID", info.player_id);
                    cmd.putExtra("BITRATE", info.bitrate);
                    cmd.putExtra("DURATION", info.duration);
                    SystemProperties.set("sys.next.player_id",String.valueOf(info.player_id + 1));
                    if(info.total_video_num>=1){
                        cmd.putExtra("WIDTH", info.videoInfo[0].width);
                        cmd.putExtra("HEIGHT", info.videoInfo[0].height);
                    }
                    mContext.sendBroadcast(cmd);
                }
                return;

AmlogicPlayer.cpp

mPlayer_id = player_start(&mPlay_ctl, (unsigned long)this);
    if (mPlayer_id >= 0) {
        LOGV("Start player,pid=%d\n", mPlayer_id);
        char str_id[10];
        sprintf(str_id, "%d", mPlayer_id); 
        property_set("sys.next.player_id",str_id);
        if (fastNotifyMode || (PropIsEnable("media.amplayer.fast_prepare",0) && mPlay_ctl.auto_buffing_enable == 1)) {
            sendEvent(MEDIA_PREPARED);
            prepare_complete = bufferGettime();//added for record prepare time
            ALOGE("PRINT_LOG_PREPARED,time=%d\n", (int)(prepare_complete-prepare_start)/1000);
            sendEvent(PRINT_LOG_PREPARED,(int)(prepare_complete-prepare_start)/1000);
        }
        return NO_ERROR;
    }

相关文章

  • 解决bug的思路

    遇到bug不要惊慌,惊慌失措会显得你很低级,冷静分析bug的原因;首先定位bug的位置,然后从代码的层面去分析问题...

  • BUG分析:

    问题4:每次进入播放时上报的本次播放视频ID均为0,期望每次进入播放显示的ID不同 MediaPlayer.jav...

  • 友盟bug日志分析

    友盟bug日志分析 一、友盟工具分析 1、去友盟后台,我的产品->移动统计->错误分析,找到有哪些bug日志,并把...

  • 如何快速定位、分析、解决非Crash的BUG(iOS 11篇)

    如何快速定位、分析、解决非Crash的BUG(iOS 11篇) 如何快速定位、分析、解决非Crash的BUG(iO...

  • bug分析还能分析些什么?

    昨天手工整理了bug的相关维度,其实都谈不上什么分析。 bug分布,即每个大模块在总bug数中的占比,能分析出哪些...

  • [已解决]Flask Incompatible collecti

    BUG Incompatible collection type: 类名 is not list-like 分析 ...

  • 性能瓶颈分析案例

    性能分析案例一 在性能测试过程中,瓶颈犹如功能测试的bug,瓶颈的分析犹如bug的定位。性能测试工程师好比医生,...

  • Eclipse 调试技巧

    在程序开发过程中,Bug可以说难以避免。如果定位Bug、分析Bug可以说是快速解决问题的关键。而定位Bug最重要的...

  • 2020-02-22面试题

    说说你印象中最印象深刻的bug? 我印象最深的bug: 加载一个水壶饰品放在地板的时候,软件闪退 bug原因分析:...

  • Bug Report该怎么做?

    Bug Report一般有两种说法:一是“微观Bug Report”,是指深入分析单个bug产生的影响、产生的根因...

网友评论

      本文标题:BUG分析:

      本文链接:https://www.haomeiwen.com/subject/vqsfdftx.html