@Override public void callBackPlaybackVideoData( byte[] videobuf, int h264Data, int len, int width, int height, int time, int frameType, int originframeLen) { // TODO Auto-generated method stub i1++; if (exit == false) { exit = true; new MyThread().start(); } this.time = time; videodata = videobuf; videoDataLen = len; nVideoWidth = width; nVideoHeight = height; time1 = this.time * 1000; timeShow = setDeviceTime(time1, tzStr); if (h264Data == 1) { // H264 mHandler.sendEmptyMessage(1); } else { // MJPEG mHandler.sendEmptyMessage(2); } /// 音频数据 if (h264Data == 0 && frameType == 6) { // Log.e("vst ", "h264Data == 0 && FrameType == 6 "); /* * if (!isOpen) { StartAudio(); isOpen = true; } */ if (!audioPlayer.isAudioPlaying()) { return; } CustomBufferHead head = new CustomBufferHead(); CustomBufferData data = new CustomBufferData(); head.length = len; // Log.e("vst ", "h264Data == 0 && FrameType == 6 " + "len" + len); head.startcode = AUDIO_BUFFER_START_CODE; data.head = head; data.data = videobuf; AudioBuffer.addData(data); Message msg = new Message(); Bundle b = new Bundle(); b.putInt("oneFramesize", originframeLen); msg.setData(b); return; } }
private void StopAudio() { synchronized (this) { AudioBuffer.ClearAll(); audioPlayer.AudioPlayStop(); } }