• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java StatsObserver类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LookupException类代码示例发布时间:2022-05-22
下一篇:
Java VideoMediaHeaderBox类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap