Skip to content

Commit

Permalink
fix: ensure frame has video before checking colorspace #1528
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed May 24, 2024
1 parent 2ffc202 commit 6a7c3c5
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/modules/ffmpeg/producer/av_producer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,19 @@ struct Frame

core::color_space get_color_space(const std::shared_ptr<AVFrame>& video) {
auto result = core::color_space::bt709;
switch (video->colorspace) {
case AVColorSpace::AVCOL_SPC_BT2020_NCL:
result = core::color_space::bt2020;
break;
case AVColorSpace::AVCOL_SPC_BT470BG:
case AVColorSpace::AVCOL_SPC_SMPTE170M:
case AVColorSpace::AVCOL_SPC_SMPTE240M:
result = core::color_space::bt601;
break;
default:
break;
if (video) {
switch (video->colorspace) {
case AVColorSpace::AVCOL_SPC_BT2020_NCL:
result = core::color_space::bt2020;
break;
case AVColorSpace::AVCOL_SPC_BT470BG:
case AVColorSpace::AVCOL_SPC_SMPTE170M:
case AVColorSpace::AVCOL_SPC_SMPTE240M:
result = core::color_space::bt601;
break;
default:
break;
}
}

return result;
Expand Down

0 comments on commit 6a7c3c5

Please sign in to comment.