nus-yam/ex-repair huggingface dataset:
Program: 35675
Project: 35675
Buggy source:
private void processUsersInRoom(List<HashMap<String,String>> users){
  List<String> newSessions=new ArrayList<>();
  Set<String> oldSesssions=new HashSet<>();
  for (  HashMap<String,String> participant : users) {
    Object inCallObject=participant.get("String_Node_Str");
    if (!participant.get("String_Node_Str").equals(callSession)) {
      if ((boolean)inCallObject) {
        newSessions.add(participant.get("String_Node_Str"));
      }
 else {
        oldSesssions.add(participant.get("String_Node_Str"));
      }
    }
  }
  for (  MagicPeerConnectionWrapper magicPeerConnectionWrapper : magicPeerConnectionWrapperList) {
    oldSesssions.add(magicPeerConnectionWrapper.getSessionId());
  }
  oldSesssions.removeAll(newSessions);
  newSessions.removeAll(oldSesssions);
  if (leavingCall) {
    return;
  }
  for (  String sessionId : newSessions) {
    alwaysGetPeerConnectionWrapperForSessionId(sessionId);
  }
  for (  String sessionId : oldSesssions) {
    endPeerConnection(sessionId);
  }
}

Fixed version (ground truth):
private void processUsersInRoom(List<HashMap<String,String>> users){
  List<String> newSessions=new ArrayList<>();
  Set<String> oldSesssions=new HashSet<>();
  for (  HashMap<String,String> participant : users) {
    if (!participant.get("String_Node_Str").equals(callSession)) {
      Object inCallObject=participant.get("String_Node_Str");
      if ((boolean)inCallObject) {
        newSessions.add(participant.get("String_Node_Str"));
      }
 else {
        oldSesssions.add(participant.get("String_Node_Str"));
      }
    }
  }
  for (  MagicPeerConnectionWrapper magicPeerConnectionWrapper : magicPeerConnectionWrapperList) {
    oldSesssions.add(magicPeerConnectionWrapper.getSessionId());
  }
  oldSesssions.removeAll(newSessions);
  newSessions.removeAll(oldSesssions);
  if (leavingCall) {
    return;
  }
  for (  String sessionId : newSessions) {
    alwaysGetPeerConnectionWrapperForSessionId(sessionId);
  }
  for (  String sessionId : oldSesssions) {
    endPeerConnection(sessionId);
  }
}
Program: 35677
Project: 35677
Buggy source:
@Override public void onAnimationEnd(Animator animation){
  super.onAnimationEnd(animation);
  messageView.setVisibility(View.GONE);
}

Fixed version (ground truth):
@Override public void onAnimationEnd(Animator animation){
  super.onAnimationEnd(animation);
  if (messageView != null) {
    messageView.setVisibility(View.GONE);
  }
}
Program: 35678
Project: 35678
Buggy source:
@Override public void onStop(){
  super.onStop();
  eventBus.unregister(this);
  try {
    videoCapturer.stopCapture();
  }
 catch (  InterruptedException e) {
    Log.e(TAG,"String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void onStop(){
  super.onStop();
  eventBus.unregister(this);
  if (videoCapturer != null) {
    try {
      videoCapturer.stopCapture();
    }
 catch (    InterruptedException e) {
      Log.e(TAG,"String_Node_Str");
    }
  }
}
Program: 35679
Project: 35679
Buggy source:
private void startVideoCapture(){
  Resources r=getResources();
  int px=(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,120,r.getDisplayMetrics());
  videoCapturerAndroid.startCapture(px,px,30);
}

Fixed version (ground truth):
private void startVideoCapture(){
  if (videoCapturer != null) {
    Resources r=getResources();
    int px=(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,120,r.getDisplayMetrics());
    videoCapturerAndroid.startCapture(px,px,30);
  }
}
Program: 35681
Project: 35681
Buggy source:
@Override public void onNext(Void aVoid){
  userUtils.deleteUser(userEntity.getUsername(),userEntity.getBaseUrl());
}

Fixed version (ground truth):
@Override public void onNext(Void aVoid){
  userUtils.deleteUser(userEntity.getUsername(),userEntity.getBaseUrl()).subscribe(new CompletableObserver(){
    @Override public void onSubscribe(    Disposable d){
    }
    @Override public void onComplete(){
    }
    @Override public void onError(    Throwable e){
    }
  }
);
}
Program: 35682
Project: 35682
Buggy source:
@Override public RecordingsViewHolder onCreateViewHolder(ViewGroup parent,int viewType){
  View itemView=inflater.inflate(R.layout.record_list_item,parent,false);
  return new RecordingsViewHolder(itemView);
}

Fixed version (ground truth):
@Override public RecordingsViewHolder onCreateViewHolder(ViewGroup parent,int viewType){
  return new RecordingsViewHolder(inflater.inflate(R.layout.record_list_item,parent,false));
}
Program: 35683
Project: 35683
Buggy source:
@Override public void onBindViewHolder(final RecordingsViewHolder holder,int position){
  RecordingItem currentRecording=playListPresenter.getListItemAt(position);
  long itemDuration=currentRecording.getLength();
  long minutes=TimeUnit.MILLISECONDS.toMinutes(itemDuration);
  long seconds=TimeUnit.MILLISECONDS.toSeconds(itemDuration) - TimeUnit.MINUTES.toSeconds(minutes);
  holder.fillSeekBar.setMaxVal(itemDuration);
  holder.vName.setText(currentRecording.getName());
  holder.vLength.setText(String.format(mContext.getString(R.string.play_time_format),minutes,seconds));
  holder.vDateAdded.setText(DateUtils.formatDateTime(mContext,currentRecording.getTime(),DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_NUMERIC_DATE | DateUtils.FORMAT_SHOW_TIME| DateUtils.FORMAT_SHOW_YEAR));
  holder.cardView.setOnClickListener(view -> playListPresenter.onListItemClick(position));
  holder.cardView.setOnLongClickListener(v -> {
    playListPresenter.onListItemLongClick(position);
    return false;
  }
);
  if (currentRecording.isPlaying) {
    if (currentRecording.isPaused) {
      holder.fillSeekBar.pauseProgress();
    }
 else {
      holder.fillSeekBar.startProgress();
    }
  }
 else {
    holder.fillSeekBar.stopProgress();
  }
}

Fixed version (ground truth):
@Override public void onBindViewHolder(final RecordingsViewHolder holder,int position){
  RecordingItem currentRecording=playListPresenter.getListItemAt(position);
  long itemDuration=currentRecording.getLength();
  long minutes=TimeUnit.MILLISECONDS.toMinutes(itemDuration);
  long seconds=TimeUnit.MILLISECONDS.toSeconds(itemDuration) - TimeUnit.MINUTES.toSeconds(minutes);
  holder.fillSeekBar.setMaxVal(itemDuration);
  holder.vName.setText(currentRecording.getName());
  holder.vLength.setText(String.format(mContext.getString(R.string.play_time_format),minutes,seconds));
  holder.vDateAdded.setText(DateUtils.formatDateTime(mContext,currentRecording.getTime(),DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_NUMERIC_DATE | DateUtils.FORMAT_SHOW_TIME| DateUtils.FORMAT_SHOW_YEAR));
  holder.cardView.setOnClickListener(view -> playListPresenter.onListItemClick(holder.getAdapterPosition()));
  holder.cardView.setOnLongClickListener(v -> {
    playListPresenter.onListItemLongClick(holder.getAdapterPosition());
    return false;
  }
);
  if (currentRecording.isPlaying) {
    if (currentRecording.isPaused) {
      holder.fillSeekBar.pauseProgress();
    }
 else {
      holder.fillSeekBar.startProgress();
    }
  }
 else {
    holder.fillSeekBar.stopProgress();
  }
}
Program: 35684
Project: 35684
Buggy source:
private Single<Integer> removeFile(RecordingItem recordingItem,int position){
  return Single.create((SingleOnSubscribe<Integer>)e -> {
    File file=new File(recordingItem.getFilePath());
    if (file.delete()) {
      recordItemDataSource.deleteRecordItem(recordingItem);
      e.onSuccess(position);
    }
 else {
      e.onError(new Exception("String_Node_Str"));
    }
  }
).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
}

Fixed version (ground truth):
private Single<Integer> removeFile(RecordingItem recordingItem,int position){
  return Single.create((SingleOnSubscribe<Integer>)e -> {
    File file=new File(recordingItem.getFilePath());
    if (file.delete()) {
      recordItemDataSource.deleteRecordItem(recordingItem);
      recordingItems.remove(position);
      e.onSuccess(position);
    }
 else {
      e.onError(new Exception("String_Node_Str"));
    }
  }
).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
}
Program: 35685
Project: 35685
Buggy source:
@ContributesAndroidInjector(modules={PlaybackFragmentBuilderModule.class}) abstract PlayListActivity contributePlayListActivity();

Fixed version (ground truth):
@ActivityScope @ContributesAndroidInjector(modules={PlayListActivityModule.class,PlayListFragmentBuilderModule.class}) abstract PlayListActivity contributePlayListActivity();
Program: 35686
Project: 35686
Buggy source:
@ActivityScope @ContributesAndroidInjector(modules={ActivityModule.class,RecordFragmentBuilderModule.class}) abstract MainActivity contributeMainActivity();

Fixed version (ground truth):
@ActivityScope @ContributesAndroidInjector(modules={MainActivityModule.class,RecordFragmentBuilderModule.class}) abstract MainActivity contributeMainActivity();
Program: 35687
Project: 35687
Buggy source:
@Inject public PlayListAdapter(@ActivityContext AppCompatActivity context,PlayListPresenter<PlayListMVPView> playListPresenter){
  mContext=context;
  this.playListPresenter=playListPresenter;
  inflater=LayoutInflater.from(mContext);
}

Fixed version (ground truth):
@Inject public PlayListAdapter(@ActivityContext Context context,PlayListPresenter<PlayListMVPView> playListPresenter){
  mContext=context;
  this.playListPresenter=playListPresenter;
  inflater=LayoutInflater.from(mContext);
}
Program: 35688
Project: 35688
Buggy source:
private void initViews(View v){
  emptyListLabel=v.findViewById(R.id.empty_list_label);
  mRecordingsListView=v.findViewById(R.id.recyclerView);
  mRecordingsListView.setHasFixedSize(true);
  llm.setOrientation(LinearLayoutManager.VERTICAL);
  llm.setReverseLayout(true);
  llm.setStackFromEnd(true);
  mRecordingsListView.setLayoutManager(llm);
  mRecordingsListView.setAdapter(mPlayListAdapter);
  playListPresenter.onViewInitialised();
}

Fixed version (ground truth):
private void initViews(View v){
  emptyListLabel=v.findViewById(R.id.empty_list_label);
  mRecordingsListView=v.findViewById(R.id.recyclerView);
  mRecordingsListView.setHasFixedSize(true);
  LinearLayoutManager llm=new LinearLayoutManager(getActivity());
  llm.setOrientation(LinearLayoutManager.VERTICAL);
  llm.setReverseLayout(true);
  llm.setStackFromEnd(true);
  mRecordingsListView.setLayoutManager(llm);
  mRecordingsListView.setAdapter(mPlayListAdapter);
  playListPresenter.onViewInitialised();
}
Program: 35689
Project: 35689
Buggy source:
@Override public void updateProgressInListItem(Integer position){
  if (position != positionOfCurrentViewHolder || recordingsViewHolder == null) {
    positionOfCurrentViewHolder=position;
    recordingsViewHolder=(PlayListAdapter.RecordingsViewHolder)mRecordingsListView.findViewHolderForAdapterPosition(position);
  }
  if (recordingsViewHolder != null) {
    recordingsViewHolder.updateProgressInSeekBar(position);
  }
}

Fixed version (ground truth):
@Override public void updateProgressInListItem(Integer position){
  if (position != positionOfCurrentViewHolder || recordingsViewHolder == null) {
    positionOfCurrentViewHolder=position;
    recordingsViewHolder=(PlayListAdapter.RecordingsViewHolder)mRecordingsListView.findViewHolderForAdapterPosition(position);
  }
  if (recordingsViewHolder != null && recordingsViewHolder.getAdapterPosition() == position) {
    recordingsViewHolder.updateProgressInSeekBar(position);
  }
 else {
    positionOfCurrentViewHolder=-1;
    recordingsViewHolder=null;
  }
}
Program: 35690
Project: 35690
Buggy source:
private Single<Integer> rename(RecordingItem recordingItem,int adapterPosition,String name){
  return Single.create((SingleOnSubscribe<Integer>)e -> {
    File f=new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "String_Node_Str" + name);
    if (f.exists() && !f.isDirectory()) {
      e.onError(new Exception("String_Node_Str"));
    }
 else {
      File oldFilePath=new File(recordingItem.getFilePath());
      if (oldFilePath.renameTo(f)) {
        recordingItem.setName(name);
        recordItemDataSource.updateRecordItem(recordingItem);
        e.onSuccess(adapterPosition);
      }
 else {
        e.onError(new Throwable("String_Node_Str"));
      }
    }
  }
).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
}

Fixed version (ground truth):
private Single<Integer> rename(RecordingItem recordingItem,int adapterPosition,String name){
  return Single.create((SingleOnSubscribe<Integer>)e -> {
    File newFile=new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "String_Node_Str" + name);
    if (newFile.exists() && !newFile.isDirectory()) {
      e.onError(new Exception("String_Node_Str"));
    }
 else {
      File oldFilePath=new File(recordingItem.getFilePath());
      if (oldFilePath.renameTo(newFile)) {
        recordingItem.setName(name);
        recordingItem.setFilePath(newFile.getPath());
        recordItemDataSource.updateRecordItem(recordingItem);
        e.onSuccess(adapterPosition);
      }
 else {
        e.onError(new Throwable("String_Node_Str"));
      }
    }
  }
).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
}
Program: 35691
Project: 35691
Buggy source:
private void saveFileDetails(AudioRecorder.RecordTime currentRecordTime){
  RecordingItem recordingItem=new RecordingItem();
  recordingItem.setName(mFile.getName());
  recordingItem.setFilePath(mFile.getPath());
  recordingItem.setLength(currentRecordTime.seconds);
  recordingItem.setTime(System.currentTimeMillis());
  recordItemDataSource.insertNewRecordItem(recordingItem);
}

Fixed version (ground truth):
private void saveFileDetails(AudioRecorder.RecordTime currentRecordTime){
  RecordingItem recordingItem=new RecordingItem();
  recordingItem.setName(mFile.getName());
  recordingItem.setFilePath(mFile.getPath());
  recordingItem.setLength(currentRecordTime.millis);
  recordingItem.setTime(System.currentTimeMillis());
  recordItemDataSource.insertNewRecordItem(recordingItem);
}
Program: 35693
Project: 35693
Buggy source:
@Override public void onServiceConnected(ComponentName componentName,IBinder iBinder){
  mAudioRecordService=((AudioRecordService.ServiceBinder)iBinder).getService();
  Log.i("String_Node_Str","String_Node_Str" + mAudioRecordService.isRecording() + "String_Node_Str");
  mIsRecording=mAudioRecordService.isRecording();
  if (mIsRecording) {
    mIsServiceBound=true;
    mIsRecordingPaused=mAudioRecordService.isPaused();
    if (mIsRecordingPaused) {
      showResumeBtn();
    }
    audioVisualization.linkTo(mAudioRecordService.getHandler());
    mRecordButton.setImageResource(R.drawable.ic_media_stop);
    mAudioRecordService.subscribeForTimer(recordTimeConsumer);
  }
 else {
    mIsServiceBound=false;
    getActivity().unbindService(this);
  }
}

Fixed version (ground truth):
@Override public void onServiceConnected(ComponentName componentName,IBinder iBinder){
  mAudioRecordService=((AudioRecordService.ServiceBinder)iBinder).getService();
  Log.i("String_Node_Str","String_Node_Str" + mAudioRecordService.isRecording() + "String_Node_Str");
  mIsRecording=mAudioRecordService.isRecording();
  if (mIsRecording) {
    mIsServiceBound=true;
    mIsRecordingPaused=mAudioRecordService.isPaused();
    if (mIsRecordingPaused) {
      showResumeBtn();
    }
    audioVisualization.linkTo(mAudioRecordService.getHandler());
    mRecordButton.setImageResource(R.drawable.ic_media_stop);
    mAudioRecordService.subscribeForTimer(recordTimeConsumer);
    registerLocalBroadCastReceiver();
  }
 else {
    mIsServiceBound=false;
    getActivity().unbindService(this);
  }
}
Program: 35694
Project: 35694
Buggy source:
private void onChangeRecord(){
  Intent intent=new Intent(getActivity(),AudioRecordService.class);
  if (!mIsRecording) {
    mIsRecording=true;
    mRecordButton.setImageResource(R.drawable.ic_media_stop);
    getActivity().startService(intent);
    bindToService();
    mPauseButton.setVisibility(View.VISIBLE);
    getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  }
 else {
    mIsRecording=false;
    mRecordButton.setImageResource(R.drawable.ic_mic_white_36dp);
    getActivity().stopService(intent);
    getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    unbindService();
    setChronometer(new AudioRecorder.RecordTime());
    mPauseButton.setVisibility(View.GONE);
  }
}

Fixed version (ground truth):
private void onChangeRecord(){
  Intent intent=new Intent(getActivity(),AudioRecordService.class);
  if (!mIsRecording) {
    mIsRecording=true;
    mRecordButton.setImageResource(R.drawable.ic_media_stop);
    getActivity().startService(intent);
    bindToService();
    mPauseButton.setVisibility(View.VISIBLE);
    registerLocalBroadCastReceiver();
    getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  }
 else {
    stopRecording();
  }
}
Program: 35695
Project: 35695
Buggy source:
@Override public IBinder onBind(Intent intent){
  return mIBinder;
}

Fixed version (ground truth):
@Override public IBinder onBind(Intent intent){
  mIsClientBound=true;
  return mIBinder;
}
Program: 35696
Project: 35696
Buggy source:
@Override public int onStartCommand(Intent intent,int flags,int startId){
  if (intent.getAction() != null) {
    if (intent.getAction().equals("String_Node_Str")) {
      pauseRecord();
      updateNotification(lastUpdated);
    }
 else     if (intent.getAction().equals("String_Node_Str")) {
      resumeRecord();
    }
 else     if (intent.getAction().equals("String_Node_Str")) {
      stopService(new Intent(this,AudioRecordService.class));
    }
  }
 else {
    startRecording();
    startForeground(NOTIFY_ID,createNotification(new AudioRecorder.RecordTime()));
  }
  return START_STICKY;
}

Fixed version (ground truth):
@Override public int onStartCommand(Intent intent,int flags,int startId){
  if (intent.getAction() != null) {
    if (intent.getAction().equals("String_Node_Str")) {
      pauseRecord();
      updateNotification(lastUpdated);
    }
 else     if (intent.getAction().equals("String_Node_Str")) {
      resumeRecord();
    }
 else     if (intent.getAction().equals("String_Node_Str")) {
      if (mIsClientBound) {
        LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("String_Node_Str"));
      }
 else {
        stopService(new Intent(this,AudioRecordService.class));
      }
    }
  }
 else {
    startRecording();
    startForeground(NOTIFY_ID,createNotification(new AudioRecorder.RecordTime()));
  }
  return START_STICKY;
}
Program: 35697
Project: 35697
Buggy source:
private void onChangeRecord(){
  Intent intent=new Intent(getActivity(),AudioRecordService.class);
  if (!mIsRecording) {
    chronometer.start();
    mIsRecording=true;
    mRecordButton.setImageResource(R.drawable.ic_media_stop);
    getActivity().startService(intent);
    getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  }
 else {
    chronometer.stop();
    chronometer.setBase(SystemClock.elapsedRealtime());
    mIsRecording=false;
    mRecordButton.setImageResource(R.drawable.ic_mic_white_36dp);
    getActivity().stopService(intent);
    getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  }
}

Fixed version (ground truth):
private void onChangeRecord(){
  Intent intent=new Intent(getActivity(),AudioRecordService.class);
  if (!mIsRecording) {
    chronometer.start();
    mIsRecording=true;
    mRecordButton.setImageResource(R.drawable.ic_media_stop);
    getActivity().startService(intent);
    bindToService();
    getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  }
 else {
    chronometer.stop();
    chronometer.setBase(SystemClock.elapsedRealtime());
    mIsRecording=false;
    mRecordButton.setImageResource(R.drawable.ic_mic_white_36dp);
    getActivity().stopService(intent);
    getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  }
}
Program: 35698
Project: 35698
Buggy source:
private void unbindService(){
  unRegisterLocalBroadCastReceiver();
  if (mIsServiceBound) {
    mIsServiceBound=false;
    getActivity().unbindService(serviceConnection);
  }
}

Fixed version (ground truth):
private void unbindService(){
  unRegisterLocalBroadCastReceiver();
  if (timerDisposable != null) {
    timerDisposable.dispose();
  }
  if (mIsServiceBound) {
    mIsServiceBound=false;
    getActivity().unbindService(serviceConnection);
  }
}
Program: 35699
Project: 35699
Buggy source:
@Override public void onServiceConnected(ComponentName componentName,IBinder iBinder){
  mAudioRecordService=((AudioRecordService.ServiceBinder)iBinder).getService();
  Log.i("String_Node_Str","String_Node_Str" + mAudioRecordService.isRecording() + "String_Node_Str");
  mIsRecording=mAudioRecordService.isRecording();
  mIsServiceBound=true;
  if (mIsRecording) {
    mIsRecordingPaused=mAudioRecordService.isPaused();
    onPauseRecord();
    audioVisualization.linkTo(mAudioRecordService.getHandler());
    mRecordButton.setImageResource(R.drawable.ic_media_stop);
    mAudioRecordService.subscribeForTimer(recordTimeConsumer);
  }
 else {
    unbindService();
  }
}

Fixed version (ground truth):
@Override public void onServiceConnected(ComponentName componentName,IBinder iBinder){
  mAudioRecordService=((AudioRecordService.ServiceBinder)iBinder).getService();
  Log.i("String_Node_Str","String_Node_Str" + mAudioRecordService.isRecording() + "String_Node_Str");
  mIsRecording=mAudioRecordService.isRecording();
  mIsServiceBound=true;
  if (mIsRecording) {
    mIsRecordingPaused=mAudioRecordService.isPaused();
    onPauseRecord();
    audioVisualization.linkTo(mAudioRecordService.getHandler());
    mRecordButton.setImageResource(R.drawable.ic_media_stop);
    timerDisposable=mAudioRecordService.subscribeForTimer(recordTimeConsumer);
  }
 else {
    unbindService();
  }
}
Program: 35700
Project: 35700
Buggy source:
public void subscribeForTimer(Consumer<AudioRecorder.RecordTime> timerConsumer){
  audioRecorder.subscribeTimer(timerConsumer);
}

Fixed version (ground truth):
public Disposable subscribeForTimer(Consumer<AudioRecorder.RecordTime> timerConsumer){
  return audioRecorder.subscribeTimer(timerConsumer);
}
Program: 35701
Project: 35701
Buggy source:
public void subscribeTimer(Consumer<RecordTime> timerConsumer){
  compositeDisposable.add(recordTimeProcessor.observeOn(AndroidSchedulers.mainThread()).subscribe(timerConsumer));
}

Fixed version (ground truth):
public Disposable subscribeTimer(Consumer<RecordTime> timerConsumer){
  Disposable disposable=recordTimeProcessor.observeOn(AndroidSchedulers.mainThread()).subscribe(timerConsumer);
  compositeDisposable.add(disposable);
  return disposable;
}
Program: 35702
Project: 35702
Buggy source:
private void onPauseRecord(boolean pause){
  if (pause) {
    mAudioRecordService.pauseRecord();
    mPauseButton.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_mic_white_36dp,0,0,0);
    mPauseButton.setText("String_Node_Str");
  }
 else {
    mAudioRecordService.resumeRecord();
    mPauseButton.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_media_pause,0,0,0);
    mPauseButton.setText("String_Node_Str");
  }
}

Fixed version (ground truth):
private void onPauseRecord(){
  if (mIsRecordingPaused) {
    mAudioRecordService.pauseRecord();
    mPauseButton.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_mic_white_36dp,0,0,0);
    mPauseButton.setText("String_Node_Str");
  }
 else {
    mAudioRecordService.resumeRecord();
    mPauseButton.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_media_pause,0,0,0);
    mPauseButton.setText("String_Node_Str");
  }
}
Program: 35703
Project: 35703
Buggy source:
private void bindEvents(){
  RxView.clicks(mRecordButton).subscribe(o -> onChangeRecord());
  mPauseButton.setOnClickListener(v -> {
    onPauseRecord(mIsRecordingPaused);
    mIsRecordingPaused=!mIsRecordingPaused;
  }
);
}

Fixed version (ground truth):
private void bindEvents(){
  RxView.clicks(mRecordButton).subscribe(o -> onChangeRecord());
  mPauseButton.setOnClickListener(v -> {
    mIsRecordingPaused=!mIsRecordingPaused;
    onPauseRecord();
  }
);
}
Program: 35704
Project: 35704
Buggy source:
private void unbindService(){
  if (mIsServiceBound) {
    mIsServiceBound=false;
    getActivity().unbindService(serviceConnection);
  }
}

Fixed version (ground truth):
private void unbindService(){
  unRegisterLocalBroadCastReceiver();
  if (mIsServiceBound) {
    mIsServiceBound=false;
    getActivity().unbindService(serviceConnection);
  }
}
Program: 35705
Project: 35705
Buggy source:
@Override public void onServiceConnected(ComponentName componentName,IBinder iBinder){
  mAudioRecordService=((AudioRecordService.ServiceBinder)iBinder).getService();
  Log.i("String_Node_Str","String_Node_Str" + mAudioRecordService.isRecording() + "String_Node_Str");
  mIsRecording=mAudioRecordService.isRecording();
  if (mIsRecording) {
    mIsServiceBound=true;
    mIsRecordingPaused=mAudioRecordService.isPaused();
    if (mIsRecordingPaused) {
      showResumeBtn();
    }
    audioVisualization.linkTo(mAudioRecordService.getHandler());
    mRecordButton.setImageResource(R.drawable.ic_media_stop);
    mAudioRecordService.subscribeForTimer(recordTimeConsumer);
    registerLocalBroadCastReceiver();
  }
 else {
    mIsServiceBound=false;
    getActivity().unbindService(this);
  }
}

Fixed version (ground truth):
@Override public void onServiceConnected(ComponentName componentName,IBinder iBinder){
  mAudioRecordService=((AudioRecordService.ServiceBinder)iBinder).getService();
  Log.i("String_Node_Str","String_Node_Str" + mAudioRecordService.isRecording() + "String_Node_Str");
  mIsRecording=mAudioRecordService.isRecording();
  mIsServiceBound=true;
  if (mIsRecording) {
    mIsRecordingPaused=mAudioRecordService.isPaused();
    onPauseRecord();
    audioVisualization.linkTo(mAudioRecordService.getHandler());
    mRecordButton.setImageResource(R.drawable.ic_media_stop);
    mAudioRecordService.subscribeForTimer(recordTimeConsumer);
  }
 else {
    unbindService();
  }
}
Program: 35706
Project: 35706
Buggy source:
private void bindToService(){
  Intent intent=new Intent(getActivity(),AudioRecordService.class);
  getActivity().bindService(intent,serviceConnection,Context.BIND_AUTO_CREATE);
}

Fixed version (ground truth):
private void bindToService(){
  Intent intent=new Intent(getActivity(),AudioRecordService.class);
  getActivity().bindService(intent,serviceConnection,Context.BIND_AUTO_CREATE);
  registerLocalBroadCastReceiver();
}
Program: 35707
Project: 35707
Buggy source:
private void onChangeRecord(){
  Intent intent=new Intent(getActivity(),AudioRecordService.class);
  if (!mIsRecording) {
    mIsRecording=true;
    mRecordButton.setImageResource(R.drawable.ic_media_stop);
    getActivity().startService(intent);
    bindToService();
    mPauseButton.setVisibility(View.VISIBLE);
    registerLocalBroadCastReceiver();
    getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  }
 else {
    stopRecording();
  }
}

Fixed version (ground truth):
private void onChangeRecord(){
  Intent intent=new Intent(getActivity(),AudioRecordService.class);
  if (!mIsRecording) {
    mIsRecording=true;
    mRecordButton.setImageResource(R.drawable.ic_media_stop);
    getActivity().startService(intent);
    bindToService();
    mPauseButton.setVisibility(View.VISIBLE);
    getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  }
 else {
    stopRecording();
  }
}
Program: 35708
Project: 35708
Buggy source:
private void onPauseRecord(){
  if (mIsRecordingPaused) {
    mAudioRecordService.pauseRecord();
    mPauseButton.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_mic_white_36dp,0,0,0);
    mPauseButton.setText("String_Node_Str");
  }
 else {
    mAudioRecordService.resumeRecord();
    mPauseButton.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_media_pause,0,0,0);
    mPauseButton.setText("String_Node_Str");
  }
}

Fixed version (ground truth):
private void onPauseRecord(){
  mPauseButton.setVisibility(View.VISIBLE);
  if (mIsRecordingPaused) {
    mAudioRecordService.pauseRecord();
    mPauseButton.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_mic_white_36dp,0,0,0);
    mPauseButton.setText("String_Node_Str");
  }
 else {
    mAudioRecordService.resumeRecord();
    mPauseButton.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_media_pause,0,0,0);
    mPauseButton.setText("String_Node_Str");
  }
}
Program: 35709
Project: 35709
Buggy source:
private void stopRecording(){
  Intent intent=new Intent(getContext(),AudioRecordService.class);
  mIsRecording=false;
  mRecordButton.setImageResource(R.drawable.ic_mic_white_36dp);
  getActivity().stopService(intent);
  getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  unbindService();
  setChronometer(new AudioRecorder.RecordTime());
  unRegisterLocalBroadCastReceiver();
  mPauseButton.setVisibility(View.GONE);
}

Fixed version (ground truth):
private void stopRecording(){
  Intent intent=new Intent(getContext(),AudioRecordService.class);
  mIsRecording=false;
  mRecordButton.setImageResource(R.drawable.ic_mic_white_36dp);
  getActivity().stopService(intent);
  getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  unbindService();
  setChronometer(new AudioRecorder.RecordTime());
  mPauseButton.setVisibility(View.GONE);
}
Program: 35710
Project: 35710
Buggy source:
@Override public void onCreate(){
  super.onCreate();
  mIBinder=new ServiceBinder();
  audioRecorder=new AudioRecorder();
  mediaSaveHelper=new MediaSaveHelper();
  handler=new AudioRecordingDbmHandler();
  audioRecorder.addRecordingCallback(mediaSaveHelper);
  audioRecorder.addRecordingCallback(handler);
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
  mIBinder=new ServiceBinder();
  audioRecorder=new AudioRecorder();
  handler=new AudioRecordingDbmHandler();
  handler.addRecorder(audioRecorder);
}
Program: 35711
Project: 35711
Buggy source:
public void startRecording(){
  mediaSaveHelper.createNewFile();
  audioRecorder.startRecord();
}

Fixed version (ground truth):
public void startRecording(){
  audioRecorder.startRecord();
  handler.startRecordThread();
}
Program: 35712
Project: 35712
Buggy source:
private void startRecordThread() throws FileNotFoundException {
  new Thread(new PriorityRunnable(Process.THREAD_PRIORITY_AUDIO){
    private void onExit(){
synchronized (recorderStateMonitor) {
        recorderState=RECORDER_STATE_IDLE;
        recorderStateMonitor.notifyAll();
      }
    }
    @SuppressWarnings("String_Node_Str") @Override public void runImpl(){
      int bufferSize=2048;
      AudioRecord recorder=new AudioRecord(MediaRecorder.AudioSource.MIC,Constants.RECORDER_SAMPLE_RATE,Constants.RECORDER_CHANNELS,Constants.RECORDER_AUDIO_ENCODING,bufferSize);
      try {
        if (recorderState == RECORDER_STATE_STARTING) {
          recorderState=RECORDER_STATE_BUSY;
        }
        recorder.startRecording();
        byte recordBuffer[]=new byte[bufferSize];
        do {
          int bytesRead=recorder.read(recordBuffer,0,bufferSize);
          if (bytesRead > 0) {
            for (            RecordingCallback recordingCallback : recordingCallbacks) {
              recordingCallback.onDataReady(recordBuffer);
            }
          }
 else {
            Log.e(AudioRecorder.class.getSimpleName(),"String_Node_Str" + bytesRead);
            onRecordFailure();
          }
        }
 while (recorderState == RECORDER_STATE_BUSY);
      }
  finally {
        recorder.release();
      }
      onExit();
    }
  }
).start();
}

Fixed version (ground truth):
private void startRecordThread() throws FileNotFoundException {
  new Thread(new PriorityRunnable(Process.THREAD_PRIORITY_AUDIO){
    private void onExit(){
synchronized (recorderStateMonitor) {
        recorderState=RECORDER_STATE_IDLE;
        recorderStateMonitor.notifyAll();
      }
    }
    @SuppressWarnings("String_Node_Str") @Override public void runImpl(){
      int bufferSize=4 * 1024;
      AudioRecord recorder=new AudioRecord(MediaRecorder.AudioSource.MIC,Constants.RECORDER_SAMPLE_RATE,Constants.RECORDER_CHANNELS,Constants.RECORDER_AUDIO_ENCODING,bufferSize);
      mediaSaveHelper.createNewFile();
      try {
        if (recorderState == RECORDER_STATE_STARTING) {
          recorderState=RECORDER_STATE_BUSY;
        }
        recorder.startRecording();
        recordBuffer=new byte[bufferSize];
        do {
          int bytesRead=recorder.read(recordBuffer,0,bufferSize);
          mediaSaveHelper.onDataReady(recordBuffer);
          if (bytesRead > 0) {
          }
 else {
            Log.e(AudioRecorder.class.getSimpleName(),"String_Node_Str" + bytesRead);
            onRecordFailure();
          }
        }
 while (recorderState == RECORDER_STATE_BUSY);
      }
  finally {
        recorder.release();
      }
      onExit();
    }
  }
).start();
}
Program: 35713
Project: 35713
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void runImpl(){
  int bufferSize=2048;
  AudioRecord recorder=new AudioRecord(MediaRecorder.AudioSource.MIC,Constants.RECORDER_SAMPLE_RATE,Constants.RECORDER_CHANNELS,Constants.RECORDER_AUDIO_ENCODING,bufferSize);
  try {
    if (recorderState == RECORDER_STATE_STARTING) {
      recorderState=RECORDER_STATE_BUSY;
    }
    recorder.startRecording();
    byte recordBuffer[]=new byte[bufferSize];
    do {
      int bytesRead=recorder.read(recordBuffer,0,bufferSize);
      if (bytesRead > 0) {
        for (        RecordingCallback recordingCallback : recordingCallbacks) {
          recordingCallback.onDataReady(recordBuffer);
        }
      }
 else {
        Log.e(AudioRecorder.class.getSimpleName(),"String_Node_Str" + bytesRead);
        onRecordFailure();
      }
    }
 while (recorderState == RECORDER_STATE_BUSY);
  }
  finally {
    recorder.release();
  }
  onExit();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void runImpl(){
  int bufferSize=4 * 1024;
  AudioRecord recorder=new AudioRecord(MediaRecorder.AudioSource.MIC,Constants.RECORDER_SAMPLE_RATE,Constants.RECORDER_CHANNELS,Constants.RECORDER_AUDIO_ENCODING,bufferSize);
  mediaSaveHelper.createNewFile();
  try {
    if (recorderState == RECORDER_STATE_STARTING) {
      recorderState=RECORDER_STATE_BUSY;
    }
    recorder.startRecording();
    recordBuffer=new byte[bufferSize];
    do {
      int bytesRead=recorder.read(recordBuffer,0,bufferSize);
      mediaSaveHelper.onDataReady(recordBuffer);
      if (bytesRead > 0) {
      }
 else {
        Log.e(AudioRecorder.class.getSimpleName(),"String_Node_Str" + bytesRead);
        onRecordFailure();
      }
    }
 while (recorderState == RECORDER_STATE_BUSY);
  }
  finally {
    recorder.release();
  }
  onExit();
}
Program: 35714
Project: 35714
Buggy source:
@Override public void finishRecord(){
  int recorderStateLocal=recorderState;
  for (  RecordingCallback recordingCallback : recordingCallbacks) {
    recordingCallback.onRecordingStopped();
  }
  if (recorderStateLocal != RECORDER_STATE_IDLE) {
synchronized (recorderStateMonitor) {
      recorderStateLocal=recorderState;
      if (recorderStateLocal == RECORDER_STATE_STARTING || recorderStateLocal == RECORDER_STATE_BUSY) {
        recorderStateLocal=recorderState=RECORDER_STATE_STOPPING;
      }
      do {
        try {
          if (recorderStateLocal != RECORDER_STATE_IDLE) {
            recorderStateMonitor.wait();
          }
        }
 catch (        InterruptedException ignore) {
        }
        recorderStateLocal=recorderState;
      }
 while (recorderStateLocal == RECORDER_STATE_STOPPING);
    }
  }
}

Fixed version (ground truth):
@Override public void finishRecord(){
  int recorderStateLocal=recorderState;
  mediaSaveHelper.onRecordingStopped();
  if (recorderStateLocal != RECORDER_STATE_IDLE) {
synchronized (recorderStateMonitor) {
      recorderStateLocal=recorderState;
      if (recorderStateLocal == RECORDER_STATE_STARTING || recorderStateLocal == RECORDER_STATE_BUSY) {
        recorderStateLocal=recorderState=RECORDER_STATE_STOPPING;
      }
      do {
        try {
          if (recorderStateLocal != RECORDER_STATE_IDLE) {
            recorderStateMonitor.wait();
          }
        }
 catch (        InterruptedException ignore) {
        }
        recorderStateLocal=recorderState;
      }
 while (recorderStateLocal == RECORDER_STATE_STOPPING);
    }
  }
}
Program: 35715
Project: 35715
Buggy source:
public void stop(){
  calmDownAndStopRendering();
}

Fixed version (ground truth):
public void stop(){
  isRunning=false;
  calmDownAndStopRendering();
}
Program: 35716
Project: 35716
Buggy source:
@Override public void onDataReady(byte[] data){
  try {
    os.write(data,0,data.length);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void onDataReady(byte[] data){
  try {
    os.write(data,0,data.length);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 35717
Project: 35717
Buggy source:
@Override public void onRecordingStopped(){
  try {
    os.close();
    updateWavHeader(mFile);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void onRecordingStopped(){
  try {
    os.close();
    updateWavHeader(mFile);
    Log.i("String_Node_Str","String_Node_Str");
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 35718
Project: 35718
Buggy source:
public CameraRecorder2(){
  mMuxer=new Mp4Muxer(true);
  mShower=new SurfaceShower();
  mShower.setOutputSize(720,1280);
  mSurfaceStore=new SurfaceEncoder();
  mSurfaceStore.setStore(mMuxer);
  mSoundRecord=new SoundRecorder(mMuxer);
  mTextureProcessor=new VideoSurfaceProcessor();
  mTextureProcessor.setTextureProvider(mCameraProvider=new CameraProvider());
  mTextureProcessor.addObserver(mShower);
  mTextureProcessor.addObserver(mSurfaceStore);
}

Fixed version (ground truth):
public CameraRecorder2(){
  mMuxer=new Mp4MuxStore(true);
  mShower=new SurfaceShower();
  mShower.setOutputSize(720,1280);
  mSurfaceStore=new SurfaceEncoder();
  mSurfaceStore.setStore(mMuxer);
  mSoundRecord=new SoundRecorder(mMuxer);
  mTextureProcessor=new VideoSurfaceProcessor();
  mTextureProcessor.setTextureProvider(mCameraProvider=new CameraProvider());
  mTextureProcessor.addObserver(mShower);
  mTextureProcessor.addObserver(mSurfaceStore);
}
Program: 35719
Project: 35719
Buggy source:
/** 
 * 关闭录制
 */
public void stopRecord(){
  mSurfaceStore.close();
  mSoundRecord.stop();
}

Fixed version (ground truth):
/** 
 * 关闭录制
 */
public void stopRecord(){
  mSurfaceStore.close();
  mSoundRecord.stop();
  try {
    mMuxer.close();
  }
 catch (  AvException e) {
    e.printStackTrace();
  }
}
Program: 35720
Project: 35720
Buggy source:
public Mp4Processor2(){
  mMuxer=new Mp4Muxer(true);
  mShower=new SurfaceShower();
  mShower.setOutputSize(720,1280);
  mSurfaceStore=new SurfaceEncoder();
  mSurfaceStore.setStore(mMuxer);
  mMp4Provider=new Mp4Provider();
  mMp4Provider.setStore(mMuxer);
  mTextureProcessor=new VideoSurfaceProcessor();
  mTextureProcessor.setTextureProvider(mMp4Provider);
  mTextureProcessor.addObserver(mShower);
  mTextureProcessor.addObserver(mSurfaceStore);
}

Fixed version (ground truth):
public Mp4Processor2(){
  mMuxer=new Mp4MuxStore(true);
  mShower=new SurfaceShower();
  mShower.setOutputSize(720,1280);
  mSurfaceStore=new SurfaceEncoder();
  mSurfaceStore.setStore(mMuxer);
  mMp4Provider=new Mp4Provider();
  mMp4Provider.setStore(mMuxer);
  mTextureProcessor=new VideoSurfaceProcessor();
  mTextureProcessor.setTextureProvider(mMp4Provider);
  mTextureProcessor.addObserver(mShower);
  mTextureProcessor.addObserver(mSurfaceStore);
}
Program: 35721
Project: 35721
Buggy source:
private void startDecodeThread(){
  Thread mDecodeThread=new Thread(new Runnable(){
    @Override public void run(){
      while (!videoDecodeStep()) {
      }
      if (videoDecodeBufferInfo.flags != MediaCodec.BUFFER_FLAG_END_OF_STREAM) {
        Log.e("String_Node_Str","String_Node_Str");
        videoProvideEndFlag=true;
        try {
          mDecodeSem.acquire();
        }
 catch (        InterruptedException e) {
          e.printStackTrace();
        }
        videoDecodeBufferInfo.flags=MediaCodec.BUFFER_FLAG_END_OF_STREAM;
        mFrameSem.release();
      }
      mVideoDecoder.stop();
      mVideoDecoder.release();
      mVideoDecoder=null;
      audioDecodeStep();
      mExtractor.release();
      mExtractor=null;
    }
  }
);
  mDecodeThread.start();
}

Fixed version (ground truth):
private void startDecodeThread(){
  Thread mDecodeThread=new Thread(new Runnable(){
    @Override public void run(){
      while (!videoDecodeStep()) {
      }
      if (videoDecodeBufferInfo.flags != MediaCodec.BUFFER_FLAG_END_OF_STREAM) {
        Log.e("String_Node_Str","String_Node_Str");
        videoProvideEndFlag=true;
        try {
          mDecodeSem.acquire();
        }
 catch (        InterruptedException e) {
          e.printStackTrace();
        }
        videoDecodeBufferInfo.flags=MediaCodec.BUFFER_FLAG_END_OF_STREAM;
        mFrameSem.release();
      }
      mVideoDecoder.stop();
      mVideoDecoder.release();
      mVideoDecoder=null;
      audioDecodeStep();
      mExtractor.release();
      mExtractor=null;
      try {
        mStore.close();
      }
 catch (      AvException e) {
        e.printStackTrace();
      }
    }
  }
);
  mDecodeThread.start();
}
Program: 35722
Project: 35722
Buggy source:
public void setStore(HardMediaStore store){
  this.mStore=store;
}

Fixed version (ground truth):
public void setStore(IHardStore store){
  this.mStore=store;
}
Program: 35723
Project: 35723
Buggy source:
@Override public void run(){
  while (!videoDecodeStep()) {
  }
  if (videoDecodeBufferInfo.flags != MediaCodec.BUFFER_FLAG_END_OF_STREAM) {
    Log.e("String_Node_Str","String_Node_Str");
    videoProvideEndFlag=true;
    try {
      mDecodeSem.acquire();
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
    videoDecodeBufferInfo.flags=MediaCodec.BUFFER_FLAG_END_OF_STREAM;
    mFrameSem.release();
  }
  mVideoDecoder.stop();
  mVideoDecoder.release();
  mVideoDecoder=null;
  audioDecodeStep();
  mExtractor.release();
  mExtractor=null;
}

Fixed version (ground truth):
@Override public void run(){
  while (!videoDecodeStep()) {
  }
  if (videoDecodeBufferInfo.flags != MediaCodec.BUFFER_FLAG_END_OF_STREAM) {
    Log.e("String_Node_Str","String_Node_Str");
    videoProvideEndFlag=true;
    try {
      mDecodeSem.acquire();
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
    videoDecodeBufferInfo.flags=MediaCodec.BUFFER_FLAG_END_OF_STREAM;
    mFrameSem.release();
  }
  mVideoDecoder.stop();
  mVideoDecoder.release();
  mVideoDecoder=null;
  audioDecodeStep();
  mExtractor.release();
  mExtractor=null;
  try {
    mStore.close();
  }
 catch (  AvException e) {
    e.printStackTrace();
  }
}
Program: 35724
Project: 35724
Buggy source:
private boolean audioDecodeStep(){
  ByteBuffer buffer=ByteBuffer.allocate(1024 * 64);
  boolean isTimeEnd=false;
  if (isOpenAudio) {
    buffer.clear();
    mExtractor.selectTrack(mAudioDecodeTrack);
    MediaCodec.BufferInfo info=new MediaCodec.BufferInfo();
    while (true) {
      int length=mExtractor.readSampleData(buffer,0);
      if (length != -1) {
        int flags=mExtractor.getSampleFlags();
        boolean isAudioEnd=mExtractor.getSampleTime() > mVideoStopTimeStamp;
        info.size=length;
        info.flags=isAudioEnd ? MediaCodec.BUFFER_FLAG_END_OF_STREAM : flags;
        info.presentationTimeUs=mExtractor.getSampleTime();
        info.offset=0;
        Log.e(Aavt.debugTag,"String_Node_Str" + info.presentationTimeUs + "String_Node_Str"+ mVideoStopTimeStamp);
        isTimeEnd=mExtractor.getSampleTime() >= mVideoStopTimeStamp;
        Log.e(Aavt.debugTag,"String_Node_Str" + isAudioEnd);
        mStore.addData(mAudioEncodeTrack,buffer,info);
        if (isAudioEnd) {
          break;
        }
      }
 else {
        Log.e(Aavt.debugTag,"String_Node_Str" + true);
        info.size=0;
        info.flags=MediaCodec.BUFFER_FLAG_END_OF_STREAM;
        mStore.addData(mAudioEncodeTrack,buffer,info);
        isTimeEnd=true;
        break;
      }
      mExtractor.advance();
    }
  }
  return isTimeEnd;
}

Fixed version (ground truth):
private boolean audioDecodeStep(){
  ByteBuffer buffer=ByteBuffer.allocate(1024 * 64);
  boolean isTimeEnd=false;
  if (isOpenAudio) {
    buffer.clear();
    mExtractor.selectTrack(mAudioDecodeTrack);
    MediaCodec.BufferInfo info=new MediaCodec.BufferInfo();
    while (true) {
      int length=mExtractor.readSampleData(buffer,0);
      if (length != -1) {
        int flags=mExtractor.getSampleFlags();
        boolean isAudioEnd=mExtractor.getSampleTime() > mVideoStopTimeStamp;
        info.size=length;
        info.flags=isAudioEnd ? MediaCodec.BUFFER_FLAG_END_OF_STREAM : flags;
        info.presentationTimeUs=mExtractor.getSampleTime();
        info.offset=0;
        Log.e(Aavt.debugTag,"String_Node_Str" + info.presentationTimeUs + "String_Node_Str"+ mVideoStopTimeStamp);
        isTimeEnd=mExtractor.getSampleTime() >= mVideoStopTimeStamp;
        Log.e(Aavt.debugTag,"String_Node_Str" + isAudioEnd);
        mStore.addData(mAudioEncodeTrack,new HardMediaData(buffer,info));
        if (isAudioEnd) {
          break;
        }
      }
 else {
        Log.e(Aavt.debugTag,"String_Node_Str" + true);
        info.size=0;
        info.flags=MediaCodec.BUFFER_FLAG_END_OF_STREAM;
        mStore.addData(mAudioEncodeTrack,new HardMediaData(buffer,info));
        isTimeEnd=true;
        break;
      }
      mExtractor.advance();
    }
  }
  return isTimeEnd;
}
Program: 35725
Project: 35725
Buggy source:
@Override public Point open(SurfaceTexture surface){
  try {
    if (!extractMedia()) {
      return new Point(0,0);
    }
    mFrameSem=new Semaphore(0);
    mDecodeSem=new Semaphore(1);
    videoProvideEndFlag=false;
    isUserWantToStop=false;
    mAudioEncodeTrack=mStore.addFormat(mExtractor.getTrackFormat(mAudioDecodeTrack));
    MediaFormat format=mExtractor.getTrackFormat(mVideoDecodeTrack);
    mVideoDecoder=MediaCodec.createDecoderByType(format.getString(MediaFormat.KEY_MIME));
    mVideoDecoder.configure(format,new Surface(surface),null,0);
    mVideoDecoder.start();
    startDecodeThread();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return mVideoSize;
}

Fixed version (ground truth):
@Override public Point open(SurfaceTexture surface){
  try {
    if (!extractMedia()) {
      return new Point(0,0);
    }
    mFrameSem=new Semaphore(0);
    mDecodeSem=new Semaphore(1);
    videoProvideEndFlag=false;
    isUserWantToStop=false;
    mAudioEncodeTrack=mStore.addTrack(mExtractor.getTrackFormat(mAudioDecodeTrack));
    MediaFormat format=mExtractor.getTrackFormat(mVideoDecodeTrack);
    mVideoDecoder=MediaCodec.createDecoderByType(format.getString(MediaFormat.KEY_MIME));
    mVideoDecoder.configure(format,new Surface(surface),null,0);
    mVideoDecoder.start();
    startDecodeThread();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return mVideoSize;
}