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


Java StatsObserver类代码示例

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


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

示例1: getStats

import org.webrtc.StatsObserver; //导入依赖的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.StatsObserver; //导入依赖的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.StatsObserver; //导入依赖的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: getStats

import org.webrtc.StatsObserver; //导入依赖的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

示例5: onIceServers

import org.webrtc.StatsObserver; //导入依赖的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

示例6: onIceServers

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

  // 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;
            boolean success = finalPC.getStats(new StatsObserver() {
                public void onComplete(StatsReport[] reports) {
                  for (StatsReport report : reports) {
                    Log.d(TAG, "Stats: " + report.toString());
                  }
                  vsv.postDelayed(runnableThis, 10000);
                }
              }, null);
            if (!success) {
              throw new RuntimeException("getStats() return false!");
            }
          }
        }
      };
    vsv.postDelayed(repeatedStatsLogger, 10000);
  }

  {
    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(new VideoCallbacks(
          vsv, VideoStreamsView.Endpoint.LOCAL)));
      lMS.addTrack(videoTrack);
    }
    lMS.addTrack(factory.createAudioTrack("ARDAMSa0"));
    pc.addStream(lMS, new MediaConstraints());
  }
  logAndToast("Waiting for ICE candidates...");
}
 
开发者ID:kenneththorman,项目名称:appspotdemo-mono,代码行数:58,代码来源:AppRTCDemoActivity.java


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