Skip to content
Snippets Groups Projects
Commit 0f348a8f authored by Kateryna Kostiuk's avatar Kateryna Kostiuk
Browse files

recording: enable on iOS

Change-Id: I3df37987a306dc604529bc93c0aabe6a10d8b0a2
parent 2d909770
Branches
No related tags found
No related merge requests found
...@@ -148,6 +148,7 @@ MediaRecorder::startRecording() ...@@ -148,6 +148,7 @@ MediaRecorder::startRecording()
{ {
std::time_t t = std::time(nullptr); std::time_t t = std::time(nullptr);
startTime_ = *std::localtime(&t); startTime_ = *std::localtime(&t);
startTimeStamp_ = av_gettime();
encoder_.reset(new MediaEncoder); encoder_.reset(new MediaEncoder);
...@@ -232,7 +233,13 @@ MediaRecorder::onFrame(const std::string& name, const std::shared_ptr<MediaFrame ...@@ -232,7 +233,13 @@ MediaRecorder::onFrame(const std::string& name, const std::shared_ptr<MediaFrame
clone = std::make_unique<MediaFrame>(); clone = std::make_unique<MediaFrame>();
clone->copyFrom(*frame); clone->copyFrom(*frame);
} }
#if (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
clone->pointer()->pts = av_rescale_q_rnd(av_gettime() - startTimeStamp_,
{1, AV_TIME_BASE}, ms.timeBase,
static_cast<AVRounding>(AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX));
#else
clone->pointer()->pts -= ms.firstTimestamp; clone->pointer()->pts -= ms.firstTimestamp;
#endif
if (ms.isVideo) if (ms.isVideo)
videoFilter_->feedInput(clone->pointer(), name); videoFilter_->feedInput(clone->pointer(), name);
else else
......
...@@ -135,6 +135,7 @@ private: ...@@ -135,6 +135,7 @@ private:
std::string path_; std::string path_;
std::tm startTime_; std::tm startTime_;
int64_t startTimeStamp_;
std::string title_; std::string title_;
std::string description_; std::string description_;
......
...@@ -64,14 +64,13 @@ SystemCodecContainer::initCodecConfig() ...@@ -64,14 +64,13 @@ SystemCodecContainer::initCodecConfig()
defaultBitrate, defaultBitrate,
minH264, minH264,
maxH264), maxH264),
#if !(defined(TARGET_OS_IOS) && TARGET_OS_IOS)
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_VP8, std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_VP8,
"VP8", "libvpx", "VP8", "libvpx",
CODEC_ENCODER_DECODER, CODEC_ENCODER_DECODER,
defaultBitrate, defaultBitrate,
minVP8, minVP8,
maxVP8), maxVP8),
#if !(defined(TARGET_OS_IOS) && TARGET_OS_IOS)
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_MPEG4, std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_MPEG4,
"MP4V-ES", "mpeg4", "MP4V-ES", "mpeg4",
CODEC_ENCODER_DECODER, CODEC_ENCODER_DECODER,
......
...@@ -161,6 +161,7 @@ VideoDeviceImpl::getDeviceParams() const ...@@ -161,6 +161,7 @@ VideoDeviceImpl::getDeviceParams() const
params.name = name; params.name = name;
params.input = name; params.input = name;
params.channel = 0; params.channel = 0;
params.pixel_format = "nv12";
params.width = size_.first; params.width = size_.first;
params.height = size_.second; params.height = size_.second;
params.framerate = rate_; params.framerate = rate_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment