Skip to content

Commit

Permalink
* Fix FFmpegFrameRecorder not saving the last few frames, especial…
Browse files Browse the repository at this point in the history
…ly when encoding with x264 (issue #491)

Also fix `NullPointerException` when recording without audio
  • Loading branch information
saudet committed May 12, 2015
1 parent 487954e commit fb2206d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Fix `FFmpegFrameRecorder` not saving the last few frames, especially when encoding with x264 ([issue #491](https://code.google.com/p/javacv/issues/detail?id=491))
* Add `FrameConverterTest` and fix a couple of bugs uncovered by it
* Make `Frame implements Indexable` for easy and efficient access to image pixels
* Fix `AbstractMethodError` thrown from `OpenCVFrameConverter` on some versions of the JDK ([issue #143](https://github.com/bytedeco/javacv/issues/143))
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/bytedeco/javacv/FFmpegFrameRecorder.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,11 @@ public void releaseUnsafe() throws Exception {
av_free(audio_outbuf);
audio_outbuf = null;
}
if (video_st.metadata() != null) {
if (video_st != null && video_st.metadata() != null) {
av_dict_free(video_st.metadata());
video_st.metadata(null);
}
if (audio_st.metadata() != null) {
if (audio_st != null && audio_st.metadata() != null) {
av_dict_free(audio_st.metadata());
audio_st.metadata(null);
}
Expand Down Expand Up @@ -794,7 +794,7 @@ public boolean recordImage(int width, int height, int depth, int channels, int s
}
}
}
return (video_pkt.flags() & AV_PKT_FLAG_KEY) == 1;
return image != null ? (video_pkt.flags() & AV_PKT_FLAG_KEY) != 0 : got_video_packet[0] != 0;
}

public boolean recordSamples(Buffer ... samples) throws Exception {
Expand Down

0 comments on commit fb2206d

Please sign in to comment.