Skip to content

Commit

Permalink
Fixing YUV420p example issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ross-newman committed May 21, 2024
1 parent f596fa3 commit abf0860
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion example/rtp_sap_transmit/rtp_sap_transmit_arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) {

// Create a buffer in YUV420P format
std::vector<uint8_t> &data =
rtp.GetBufferTestPattern(480, 640, ::mediax::rtp::ColourspaceType::kColourspaceYuv420p, 2);
rtp.GetBufferTestPattern(480, 640, ::mediax::rtp::ColourspaceType::kColourspaceYuv420p, 10);
// 40ms delay
usleep(40000);
#endif
Expand Down
5 changes: 3 additions & 2 deletions src/wrappers/rtp_sap_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ class RtpSapTransmit {
/// \return vector<uint8_t>&
///
std::vector<uint8_t>& GetBuffer() {
data_buffer_.resize(stream_info_.height * stream_info_.width * (BitsPerPixel(stream_info_.encoding) / 8.0));
data_buffer_.resize(stream_info_.height * stream_info_.width *
(BitsPerPixel(stream_info_.encoding) / static_cast<double>(8)));
return data_buffer_;
}

Expand All @@ -74,7 +75,7 @@ class RtpSapTransmit {
/// \return vector<uint8_t>&
///
std::vector<uint8_t>& GetBuffer(uint32_t width, uint32_t height, ::mediax::rtp::ColourspaceType encoding) {
uint32_t size = width * height * (BitsPerPixel(encoding) / 8.0);
uint32_t size = width * height * (BitsPerPixel(encoding) / static_cast<double>(8));
data_buffer_.resize(size);
return data_buffer_;
}
Expand Down

0 comments on commit abf0860

Please sign in to comment.