Skip to content

Commit

Permalink
PangoVideoOutput: Use PANGO_HOST_RECEPTION_TIME_US property instead o…
Browse files Browse the repository at this point in the history
…f "timestamp_us"
  • Loading branch information
stevenlovegrove authored and Steven Lovegrove committed Jun 28, 2017
1 parent 858a17f commit 4d16c05
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/video/drivers/pango_video_output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ void PangoVideoOutput::SetStreams(const std::vector<StreamInfo>& st, const std::

int PangoVideoOutput::WriteStreams(const unsigned char* data, const picojson::value& frame_properties)
{
const int64_t host_reception_time_us = frame_properties.get_value(PANGO_HOST_RECEPTION_TIME_US, Time_us(TimeNow()));

#ifndef _WIN_
if (is_pipe)
{
Expand Down Expand Up @@ -196,17 +198,6 @@ int PangoVideoOutput::WriteStreams(const unsigned char* data, const picojson::va
}
#endif

int64_t receive_time_us;

if (frame_properties.contains("timestamp_us"))
{
receive_time_us = frame_properties["timestamp_us"].get<int64_t>();
}
else
{
receive_time_us = Time_us(TimeNow());
}

if(!fixed_size) {
memstreambuf encoded(total_frame_size);
std::ostream encode_stream(&encoded);
Expand All @@ -229,9 +220,9 @@ int PangoVideoOutput::WriteStreams(const unsigned char* data, const picojson::va
}
}
encode_stream.flush();
packetstream.WriteSourcePacket(packetstreamsrcid, reinterpret_cast<const char*>(encoded.data()), receive_time_us, encoded.size(), frame_properties);
packetstream.WriteSourcePacket(packetstreamsrcid, reinterpret_cast<const char*>(encoded.data()), host_reception_time_us, encoded.size(), frame_properties);
}else{
packetstream.WriteSourcePacket(packetstreamsrcid, reinterpret_cast<const char*>(data), receive_time_us, total_frame_size, frame_properties);
packetstream.WriteSourcePacket(packetstreamsrcid, reinterpret_cast<const char*>(data), host_reception_time_us, total_frame_size, frame_properties);
}

return 0;
Expand Down

0 comments on commit 4d16c05

Please sign in to comment.