#include <libavformat/version.h>
-#define MAX_FPS 60
+#define TYPICAL_FPS 60
#define FAKE_FPS 25 // Must be an integer.
// #define MAX_VIDEO_CARDS 16 // defined in shared_defs.h.
#define MAX_ALSA_CARDS 16
1e3 * duration<double>(now - next_frame_start).count());
pts_origin = frame->pts;
start = next_frame_start = now;
- timecode += MAX_FPS * 2 + 1;
+ timecode += TYPICAL_FPS * 2 + 1;
}
}
bool finished_wakeup;
// Make sure to get the audio resampler reset. (This is a hack;
// ideally, the frame callback should just accept a way to signal
// audio discontinuity.)
- timecode += MAX_FPS * 2 + 1;
+ timecode += TYPICAL_FPS * 2 + 1;
}
last_neutral_color = get_neutral_color(frame->metadata);
if (frame_callback != nullptr) {
// (Could be nonintegral, but resampling will save us then.)
const int silence_samples = OUTPUT_FREQUENCY * video_format.frame_rate_den / video_format.frame_rate_nom;
- if (dropped_frames > MAX_FPS * 2) {
+ if (dropped_frames > TYPICAL_FPS * 2) {
fprintf(stderr, "%s lost more than two seconds (or time code jumping around; from 0x%04x to 0x%04x), resetting resampler\n",
description_for_card(card_index).c_str(), card->last_timecode, timecode);
audio_mixer->reset_resampler(device);
void push_pts(int64_t pts)
{
if (buf.empty() && num_b_frames > 0) { // First frame.
- int64_t base_dts = pts - num_b_frames * (TIMEBASE / MAX_FPS);
+ int64_t base_dts = pts - num_b_frames * (TIMEBASE / TYPICAL_FPS);
for (int i = 0; i < num_b_frames; ++i) {
- buf.push(base_dts + i * (TIMEBASE / MAX_FPS));
+ buf.push(base_dts + i * (TIMEBASE / TYPICAL_FPS));
}
}
buf.push(pts);
int display_frame_num = pending_frame.first;
assert(display_frame_num > 0);
PendingFrame frame = move(pending_frame.second);
- int64_t dts = last_dts + (TIMEBASE / MAX_FPS);
+ int64_t dts = last_dts + (TIMEBASE / TYPICAL_FPS);
printf("Finalizing encode: Encoding leftover frame %d as P-frame instead of B-frame.\n", display_frame_num);
encode_frame(frame, encoding_frame_num++, display_frame_num, gop_start_display_frame_num, FRAME_P, frame.pts, dts, frame.duration, frame.ycbcr_coefficients);
last_dts = dts;
// So we never get negative dts.
int64_t global_delay() const {
- return int64_t(ip_period - 1) * (TIMEBASE / MAX_FPS);
+ return int64_t(ip_period - 1) * (TIMEBASE / TYPICAL_FPS);
}
private:
static constexpr int initial_qp = 15;
static constexpr int minimal_qp = 0;
static constexpr int intra_period = 30;
- static constexpr int intra_idr_period = MAX_FPS; // About a second; more at lower frame rates. Not ideal.
+ static constexpr int intra_idr_period = TYPICAL_FPS; // About a second; more at lower frame rates. Not ideal.
// Quality settings that are meant to be static, but might be overridden
// by the profile.