diff --git a/lib/media/segment_utils.js b/lib/media/segment_utils.js index 8fbcb248f0..058b661af3 100644 --- a/lib/media/segment_utils.js +++ b/lib/media/segment_utils.js @@ -64,24 +64,34 @@ shaka.media.SegmentUtils = class { switch (tsCodecs.audio) { case 'aac': case 'aac-loas': - codecs.push('mp4a.40.2'); - hasAudio = true; + if (tsParser.getAudioData().length) { + codecs.push('mp4a.40.2'); + hasAudio = true; + } break; case 'mp3': - codecs.push('mp4a.40.34'); - hasAudio = true; + if (tsParser.getAudioData().length) { + codecs.push('mp4a.40.34'); + hasAudio = true; + } break; case 'ac3': - codecs.push('ac-3'); - hasAudio = true; + if (tsParser.getAudioData().length) { + codecs.push('ac-3'); + hasAudio = true; + } break; case 'ec3': - codecs.push('ec-3'); - hasAudio = true; + if (tsParser.getAudioData().length) { + codecs.push('ec-3'); + hasAudio = true; + } break; case 'opus': - codecs.push('opus'); - hasAudio = true; + if (tsParser.getAudioData().length) { + codecs.push('opus'); + hasAudio = true; + } break; } }