当前位置: 首页>>代码示例>>Java>>正文


Java StatsReport类代码示例

本文整理汇总了Java中org.webrtc.StatsReport的典型用法代码示例。如果您正苦于以下问题:Java StatsReport类的具体用法?Java StatsReport怎么用?Java StatsReport使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StatsReport类属于org.webrtc包,在下文中一共展示了StatsReport类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getStats

import org.webrtc.StatsReport; //导入依赖的package包/类
void getStats(String trackId, final Callback cb) {
    MediaStreamTrack track = null;
    if (trackId == null
            || trackId.isEmpty()
            || (track = webRTCModule.mMediaStreamTracks.get(trackId))
                != null) {
        peerConnection.getStats(
                new StatsObserver() {
                    @Override
                    public void onComplete(StatsReport[] reports) {
                        cb.invoke(convertWebRTCStats(reports));
                    }
                },
                track);
    } else {
        Log.e(TAG, "peerConnectionGetStats() MediaStreamTrack not found for id: " + trackId);
    }
}
 
开发者ID:angellsl10,项目名称:react-native-webrtc,代码行数:19,代码来源:PeerConnectionObserver.java

示例2: TODO

import org.webrtc.StatsReport; //导入依赖的package包/类
@SuppressWarnings("deprecation") // TODO(sakal): getStats is deprecated.
public boolean getStats() {
  if (peerConnection == null || isError) {
    return false;
  }
  boolean success = peerConnection.getStats(new StatsObserver() {
    @Override
    public void onComplete(final StatsReport[] reports) {
      events.onPeerConnectionStatsReady(reports);
    }
  }, null);
  if (!success) {
    Log.e(TAG, "getStats() returns false!");
    return false;
  }
  return true;
}
 
开发者ID:RestComm,项目名称:restcomm-android-sdk,代码行数:18,代码来源:PeerConnectionClient.java

示例3: getStats

import org.webrtc.StatsReport; //导入依赖的package包/类
private void getStats() {
    if (peerConnection == null || isError) {
        return;
    }
    boolean success = peerConnection.getStats(new StatsObserver() {
        @Override
        public void onComplete(final StatsReport[] reports) {
            events.onPeerConnectionStatsReady(reports);
        }
    }, null);
    if (!success) {
        Log.e(TAG, "getStats() returns false!");
    }
}
 
开发者ID:nhancv,项目名称:nc-android-webrtcpeer,代码行数:15,代码来源:PeerConnectionClient.java

示例4: getReportMap

import org.webrtc.StatsReport; //导入依赖的package包/类
private Map<String, String> getReportMap(StatsReport report) {
  Map<String, String> reportMap = new HashMap<String, String>();
  for (StatsReport.Value value : report.values) {
    reportMap.put(value.name, value.value);
  }
  return reportMap;
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:8,代码来源:HudFragment.java

示例5: getStats

import org.webrtc.StatsReport; //导入依赖的package包/类
private void getStats() {
  if (peerConnection == null || isError) {
    return;
  }
  boolean success = peerConnection.getStats(new StatsObserver() {
    @Override
    public void onComplete(final StatsReport[] reports) {
      events.onPeerConnectionStatsReady(reports);
    }
  }, null);
  if (!success) {
    Log.e(TAG, "getStats() returns false!");
  }
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:15,代码来源:PeerConnectionClient.java

示例6: onPeerConnectionStatsReady

import org.webrtc.StatsReport; //导入依赖的package包/类
@Override
public void onPeerConnectionStatsReady(final StatsReport[] reports) {
  runOnUiThread(new Runnable() {
    @Override
    public void run() {
      if (!isError && iceConnected) {
        hudFragment.updateEncoderStatistics(reports);
      }
    }
  });
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:12,代码来源:CallActivity.java

示例7: getReportMap

import org.webrtc.StatsReport; //导入依赖的package包/类
private Map<String, String> getReportMap(StatsReport report) {
    Map<String, String> reportMap = new HashMap<String, String>();
    for (StatsReport.Value value : report.values) {
        reportMap.put(value.name, value.value);
    }
    return reportMap;
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:8,代码来源:HudFragment.java

示例8: onPeerConnectionStatsReady

import org.webrtc.StatsReport; //导入依赖的package包/类
@Override
public void onPeerConnectionStatsReady(final StatsReport[] reports) {
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (!isError && iceConnected) {
                hudFragment.updateEncoderStatistics(reports);
            }
        }
    });
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:12,代码来源:CallActivity.java

示例9: onPeerConnectionStatsReady

import org.webrtc.StatsReport; //导入依赖的package包/类
@Override
public void onPeerConnectionStatsReady(final StatsReport[] reports) {
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (!isError && iceConnected) {
                updateEncoderStatistics(reports);
            }
        }
    });
}
 
开发者ID:GoBelieveIO,项目名称:voip_android,代码行数:12,代码来源:WebRTCActivity.java

示例10: updateHUD

import org.webrtc.StatsReport; //导入依赖的package包/类
private void updateHUD(StatsReport[] reports) {
  StringBuilder builder = new StringBuilder();
  for (StatsReport report : reports) {
    // bweforvideo to show statistics for video Bandwidth Estimation,
    // which is global per-session.
    if (report.id.equals("bweforvideo")) {
      for (StatsReport.Value value : report.values) {
        String name = value.name.replace("goog", "")
            .replace("Available", "").replace("Bandwidth", "")
            .replace("Bitrate", "").replace("Enc", "");

        builder.append(name).append("=").append(value.value)
            .append(" ");
      }
      builder.append("\n");
    } else if (report.type.equals("googCandidatePair")) {
      String activeConnectionStats = getActiveConnectionStats(report);
      if (activeConnectionStats == null) {
        continue;
      }
      builder.append(activeConnectionStats);
    } else {
      continue;
    }
    builder.append("\n");
  }
  hudView.setText(builder.toString() + hudView.getText());
}
 
开发者ID:gaku,项目名称:WebRTCDemo,代码行数:29,代码来源:AppRTCDemoActivity.java

示例11: onPeerConnectionStatsReady

import org.webrtc.StatsReport; //导入依赖的package包/类
@Override
public void onPeerConnectionStatsReady(final StatsReport[] reports)
{
   Handler mainHandler = new Handler(device.getMainLooper());
   Runnable myRunnable = new Runnable() {
      @Override
      public void run()
      {
         // by the time stats are returned (when requested at disconnect(), iceConnected might have transitioned to disconnected
         webrtcReportsJsonString = webrtcStatsReports2JsonString(reports);
         try {
            //String statsJsonString = webrtcReportsJsonString;
            String statsJsonString = "WebRTC getStats() reports in json format: " + new JSONObject(webrtcReportsJsonString).toString(3);
            //RCLogger.i(TAG, "Stats: " + statsJsonString);

            // Logcat enforces a max size to logged messages, so to avoid getting truncated logs, let's break
            // the json reports that tend to be huge in 1000-byte chunks
            final int CHUNK_SIZE = 1000;
            for (int i = 0; i <= statsJsonString.length() / CHUNK_SIZE; i++) {
               int start = i * CHUNK_SIZE;
               int end = (i + 1) * CHUNK_SIZE;
               end = end > statsJsonString.length() ? statsJsonString.length() : end;

               RCLogger.i(TAG, statsJsonString.substring(start, end));
            }
         } catch (JSONException e) {
            e.printStackTrace();
         }

         handleDisconnect(null);
      }
   };
   mainHandler.post(myRunnable);
}
 
开发者ID:RestComm,项目名称:restcomm-android-sdk,代码行数:35,代码来源:RCConnection.java

示例12: onCallStatsReceived

import org.webrtc.StatsReport; //导入依赖的package包/类
public void onCallStatsReceived(StatsReport[] report , CallStatsAPIListener listener)
{
	//Log.d(TAG,"Call stats received");
	for(int i = 0;i<report.length;i++)
	{
		//Log.d(TAG,"report "+report[i].toString());
	}
	
	listener.onSucess();
}
 
开发者ID:callstats-io,项目名称:callstats.java,代码行数:11,代码来源:CallStatsAPIListener.java

示例13: updateHUD

import org.webrtc.StatsReport; //导入依赖的package包/类
private void updateHUD(StatsReport[] reports) {
  StringBuilder builder = new StringBuilder();
  for (StatsReport report : reports) {
    if (!report.id.equals("bweforvideo")) {
      continue;
    }
    for (StatsReport.Value value : report.values) {
      String name = value.name.replace("goog", "").replace("Available", "")
          .replace("Bandwidth", "").replace("Bitrate", "").replace("Enc", "");
      builder.append(name).append("=").append(value.value).append(" ");
    }
    builder.append("\n");
  }
  hudView.setText(builder.toString() + hudView.getText());
}
 
开发者ID:actorapp,项目名称:droidkit-webrtc,代码行数:16,代码来源:AppRTCDemoActivity.java

示例14: onPeerConnectionStatsReady

import org.webrtc.StatsReport; //导入依赖的package包/类
@Override
public void onPeerConnectionStatsReady(StatsReport[] reports) {}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:3,代码来源:PeerConnectionClientTest.java

示例15: onIceServers

import org.webrtc.StatsReport; //导入依赖的package包/类
@Override
public void onIceServers(List<PeerConnection.IceServer> iceServers) {
  factory = new PeerConnectionFactory();

  MediaConstraints pcConstraints = appRtcClient.pcConstraints();
  pcConstraints.optional.add(
      new MediaConstraints.KeyValuePair("RtpDataChannels", "true"));
  pc = factory.createPeerConnection(iceServers, pcConstraints, pcObserver);

  createDataChannelToRegressionTestBug2302(pc);  // See method comment.

  // Uncomment to get ALL WebRTC tracing and SENSITIVE libjingle logging.
  // NOTE: this _must_ happen while |factory| is alive!
  // Logging.enableTracing(
  //     "logcat:",
  //     EnumSet.of(Logging.TraceLevel.TRACE_ALL),
  //     Logging.Severity.LS_SENSITIVE);

  {
    final PeerConnection finalPC = pc;
    final Runnable repeatedStatsLogger = new Runnable() {
        public void run() {
          synchronized (quit[0]) {
            if (quit[0]) {
              return;
            }
            final Runnable runnableThis = this;
            if (hudView.getVisibility() == View.INVISIBLE) {
              vsv.postDelayed(runnableThis, 1000);
              return;
            }
            boolean success = finalPC.getStats(new StatsObserver() {
                public void onComplete(final StatsReport[] reports) {
                  runOnUiThread(new Runnable() {
                      public void run() {
                        updateHUD(reports);
                      }
                    });
                  for (StatsReport report : reports) {
                    Log.d(TAG, "Stats: " + report.toString());
                  }
                  vsv.postDelayed(runnableThis, 1000);
                }
              }, null);
            if (!success) {
              throw new RuntimeException("getStats() return false!");
            }
          }
        }
      };
    vsv.postDelayed(repeatedStatsLogger, 1000);
  }

  {
    logAndToast("Creating local video source...");
    MediaStream lMS = factory.createLocalMediaStream("ARDAMS");
    if (appRtcClient.videoConstraints() != null) {
      VideoCapturer capturer = getVideoCapturer();
      videoSource = factory.createVideoSource(
          capturer, appRtcClient.videoConstraints());
      VideoTrack videoTrack =
          factory.createVideoTrack("ARDAMSv0", videoSource);
      videoTrack.addRenderer(new VideoRenderer(localRender));
      lMS.addTrack(videoTrack);
    }
    if (appRtcClient.audioConstraints() != null) {
      lMS.addTrack(factory.createAudioTrack(
          "ARDAMSa0",
          factory.createAudioSource(appRtcClient.audioConstraints())));
    }
    pc.addStream(lMS, new MediaConstraints());
  }
  logAndToast("Waiting for ICE candidates...");
}
 
开发者ID:gaku,项目名称:WebRTCDemo,代码行数:75,代码来源:AppRTCDemoActivity.java


注:本文中的org.webrtc.StatsReport类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。