Fix any instance where null is checked (or tracked) in
From: Erik Hovland <erik@hovland.org>
a function once and not checked every time the pointer
is used.
---
libs/libmythtv/avformatdecoder.cpp | 25 +++++++++++++++++--------
1 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/libs/libmythtv/avformatdecoder.cpp b/libs/libmythtv/avformatdecoder.cpp
index 177642f..11fbffe 100644
a
|
b
|
bool AvFormatDecoder::SetupAudioStream(void) |
3976 | 3976 | assert(curstream); |
3977 | 3977 | assert(curstream->codec); |
3978 | 3978 | codec_ctx = curstream->codec; |
3979 | | bool do_ac3_passthru = (allow_ac3_passthru && !transcoding && |
3980 | | (codec_ctx->codec_id == CODEC_ID_AC3)); |
3981 | | bool do_dts_passthru = (allow_dts_passthru && !transcoding && |
3982 | | (codec_ctx->codec_id == CODEC_ID_DTS)); |
3983 | | using_passthru = do_ac3_passthru || do_dts_passthru; |
3984 | | info = AudioInfo(codec_ctx->codec_id, |
3985 | | codec_ctx->sample_rate, codec_ctx->channels, |
3986 | | using_passthru && !disable_passthru); |
| 3979 | if (codec_ctx) |
| 3980 | { |
| 3981 | bool do_ac3_passthru = (allow_ac3_passthru && !transcoding && |
| 3982 | (codec_ctx->codec_id == CODEC_ID_AC3)); |
| 3983 | bool do_dts_passthru = (allow_dts_passthru && !transcoding && |
| 3984 | (codec_ctx->codec_id == CODEC_ID_DTS)); |
| 3985 | using_passthru = do_ac3_passthru || do_dts_passthru; |
| 3986 | info = AudioInfo(codec_ctx->codec_id, |
| 3987 | codec_ctx->sample_rate, codec_ctx->channels, |
| 3988 | using_passthru && !disable_passthru); |
| 3989 | } |
3987 | 3990 | } |
3988 | 3991 | |
| 3992 | if (!codec_ctx) |
| 3993 | { |
| 3994 | VERBOSE(VB_IMPORTANT, "No codec context. Returning false"); |
| 3995 | return false; |
| 3996 | } |
| 3997 | |
3989 | 3998 | if (info == audioIn) |
3990 | 3999 | return false; // no change |
3991 | 4000 | |