]> git.sesse.net Git - nageru/commitdiff
Rename MAX_FPS to TYPICAL_FPS.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 13 Apr 2023 15:02:14 +0000 (17:02 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 13 Apr 2023 15:14:47 +0000 (17:14 +0200)
nageru/defs.h
nageru/ffmpeg_capture.cpp
nageru/mixer.cpp
nageru/quicksync_encoder.cpp
nageru/quicksync_encoder_impl.h

index 41ee96a617a45fa452ce3e2c0681bf14a56a358c..c34c2acab2ce8ecbfa73b0377c17030da97ea6c3 100644 (file)
@@ -3,7 +3,7 @@
 
 #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
index a9ad73d8d7ee0948744111bfaffc451159c25e9f..504eff24f59d5bc7bfa5ceda9345f92ffce8785f 100644 (file)
@@ -715,7 +715,7 @@ bool FFmpegCapture::play_video(const string &pathname)
                                                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;
@@ -733,7 +733,7 @@ bool FFmpegCapture::play_video(const string &pathname)
                                        // 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) {
index 9d3b12cfd90d4bbad29f1d1bae3f54b2446a5fb6..9978906a26b6f7d85a540a6ce612371a218248db 100644 (file)
@@ -981,7 +981,7 @@ void Mixer::bm_frame(unsigned card_index, uint16_t timecode,
        // (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);
index 32b82bb8ae3005a25cabe449371b16a9518717b6..328c2c62653862c4f1a29bb0f3a7d57a62ad2700 100644 (file)
@@ -699,9 +699,9 @@ public:
        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);
@@ -1855,7 +1855,7 @@ void QuickSyncEncoderImpl::encode_remaining_frames_as_p(int encoding_frame_num,
                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;
index 421ff9540c231475c94541b6b4635241aa57aa5a..c40567c43eb68c4325cc335193460aef9b68c5f1 100644 (file)
@@ -59,7 +59,7 @@ public:
 
        // 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:
@@ -209,7 +209,7 @@ 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.