Commit 680d27e6 authored by Philippe Gorley's avatar Philippe Gorley Committed by Adrien Béraud

media_stream: fix null pointer dereference

Change-Id: I42eeb5c88f6f042c8057780fde65cac40f59cb8e
parent 79330e5d
......@@ -21,6 +21,7 @@
#pragma once
#include "libav_deps.h"
#include "logger.h"
#include "rational.h"
#include "audio/audiobuffer.h"
......@@ -90,25 +91,29 @@ struct MediaStream {
: name(streamName)
, firstTimestamp(startTimestamp)
{
timeBase = c->time_base;
switch (c->codec_type) {
case AVMEDIA_TYPE_VIDEO:
format = c->pix_fmt;
isVideo = true;
width = c->width;
height = c->height;
aspectRatio = c->sample_aspect_ratio;
frameRate = c->framerate;
break;
case AVMEDIA_TYPE_AUDIO:
format = c->sample_fmt;
isVideo = false;
sampleRate = c->sample_rate;
nbChannels = c->channels;
frameSize = c->frame_size;
break;
default:
break;
if (c) {
timeBase = c->time_base;
switch (c->codec_type) {
case AVMEDIA_TYPE_VIDEO:
format = c->pix_fmt;
isVideo = true;
width = c->width;
height = c->height;
aspectRatio = c->sample_aspect_ratio;
frameRate = c->framerate;
break;
case AVMEDIA_TYPE_AUDIO:
format = c->sample_fmt;
isVideo = false;
sampleRate = c->sample_rate;
nbChannels = c->channels;
frameSize = c->frame_size;
break;
default:
break;
}
} else {
JAMI_WARN() << "Trying to get stream info from null codec context";
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment