From a88c828cd58ab4bca44241a978eadffed7d07425 Mon Sep 17 00:00:00 2001 From: "yannis.tseng" Date: Wed, 3 Jan 2018 15:34:34 +0800 Subject: [PATCH] Need to set video time base before push packets. - Fixed recordings could not be generated before stopping recording. --- erizo/src/erizo/media/ExternalOutput.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erizo/src/erizo/media/ExternalOutput.cpp b/erizo/src/erizo/media/ExternalOutput.cpp index 47cfb22f20..59573ab674 100644 --- a/erizo/src/erizo/media/ExternalOutput.cpp +++ b/erizo/src/erizo/media/ExternalOutput.cpp @@ -465,16 +465,18 @@ void ExternalOutput::queueData(char* buffer, int length, packetType type) { } if (type == VIDEO_PACKET) { + RtpHeader* h = reinterpret_cast(buffer); + uint8_t payloadtype = h->getPayloadType(); if (video_offset_ms_ == -1) { video_offset_ms_ = ClockUtils::durationToMs(clock::now() - first_data_received_); ELOG_DEBUG("File %s, video offset msec: %llu", context_->filename, video_offset_ms_); + video_queue_.setTimebase(video_maps_[payloadtype].clock_rate); } // If this is a red header, let's push it to our fec_receiver_, which will spit out frames in one // of our other callbacks. // Otherwise, just stick it straight into the video queue. - RtpHeader* h = reinterpret_cast(buffer); - if (h->getPayloadType() == RED_90000_PT) { + if (payloadtype == RED_90000_PT) { // The only things AddReceivedRedPacket uses are headerLength and sequenceNumber. // Unfortunately the amount of crap // we would have to pull in from the WebRtc project to fully construct