Commit 3e6130c6 authored by Philippe Gorley's avatar Philippe Gorley Committed by Adrien Béraud

sender: send only 1 keyframe at start

Don't choke the network connection with multiple keyframes in
succession. Only 1 keyframe should be necessary.

Change-Id: I6c1bcc4c3973fd6cb7eb58a9928e823bc0c5fcf7
parent 69caa34c
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
* Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
* Author: Guillaume Roguez <Guillaume.Roguez@savoirfairelinux.com> * Author: Guillaume Roguez <Guillaume.Roguez@savoirfairelinux.com>
* Author: Eloi Bail <eloi.bail@savoirfairelinux.com> * Author: Eloi Bail <eloi.bail@savoirfairelinux.com>
* Author: Philippe Gorley <philippe.gorley@savoirfairelinux.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -78,7 +79,7 @@ VideoSender::encodeAndSendVideo(VideoFrame& input_frame) ...@@ -78,7 +79,7 @@ VideoSender::encodeAndSendVideo(VideoFrame& input_frame)
#if __ANDROID__ #if __ANDROID__
if (forceKeyFrame_) { if (forceKeyFrame_) {
emitSignal<DRing::VideoSignal::RequestKeyFrame>(); emitSignal<DRing::VideoSignal::RequestKeyFrame>();
forceKeyFrame_ = 0; --forceKeyFrame_;
} }
#endif #endif
int size {0}; int size {0};
......
...@@ -63,7 +63,7 @@ public: ...@@ -63,7 +63,7 @@ public:
int setBitrate(uint64_t br); int setBitrate(uint64_t br);
private: private:
static constexpr int KEYFRAMES_AT_START {4}; // Number of keyframes to enforce at stream startup static constexpr int KEYFRAMES_AT_START {1}; // Number of keyframes to enforce at stream startup
static constexpr unsigned KEY_FRAME_PERIOD {0}; // seconds before forcing a keyframe static constexpr unsigned KEY_FRAME_PERIOD {0}; // seconds before forcing a keyframe
NON_COPYABLE(VideoSender); NON_COPYABLE(VideoSender);
...@@ -74,7 +74,6 @@ private: ...@@ -74,7 +74,6 @@ private:
std::unique_ptr<MediaIOHandle> muxContext_ = nullptr; std::unique_ptr<MediaIOHandle> muxContext_ = nullptr;
std::unique_ptr<MediaEncoder> videoEncoder_ = nullptr; std::unique_ptr<MediaEncoder> videoEncoder_ = nullptr;
// XXX forceKeyFrame_ is always at -1, incremented to 0 when a keyframe is requested (still works though)
std::atomic<int> forceKeyFrame_ {KEYFRAMES_AT_START}; std::atomic<int> forceKeyFrame_ {KEYFRAMES_AT_START};
int keyFrameFreq_ {0}; // Set keyframe rate, 0 to disable auto-keyframe. Computed in constructor int keyFrameFreq_ {0}; // Set keyframe rate, 0 to disable auto-keyframe. Computed in constructor
int64_t frameNumber_ = 0; int64_t frameNumber_ = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment