From 4d8ce0ff5d6efd4ec41880b70256b8d33360624f Mon Sep 17 00:00:00 2001 From: KongQun Yang Date: Thu, 17 May 2018 12:43:21 -0700 Subject: [PATCH] Extract bitrates in ES descriptor for AAC if available Change-Id: I1aa53b519e8751400bea6b33936cb2e7a05958dc --- ...bear-640x360-aac_he-silent_right-audio.mp4 | Bin 24539 -> 24539 bytes .../bear-640x360-audio.mp4 | Bin 43696 -> 43696 bytes .../bear-640x360-audio.mp4 | Bin 43696 -> 43696 bytes .../bear-640x360-audio.mp4 | Bin 43696 -> 43696 bytes .../bear-640x360-audio.mp4 | Bin 43696 -> 43696 bytes .../audio-video/bear-640x360-audio.mp4 | Bin 43696 -> 43696 bytes .../testdata/bear-640x360-a-cbcs-golden.mp4 | Bin 43947 -> 43947 bytes .../testdata/bear-640x360-a-cenc-golden.mp4 | Bin 44612 -> 44612 bytes .../bear-640x360-a-demuxed-golden.mp4 | Bin 43696 -> 43696 bytes .../bear-640x360-a-live-cenc-golden-init.mp4 | Bin 967 -> 967 bytes .../bear-640x360-audio.mp4 | Bin 43696 -> 43696 bytes .../bear-640x360-audio.mp4 | Bin 44781 -> 44781 bytes .../bear-640x360-audio.mp4 | Bin 44939 -> 44939 bytes .../bear-640x360-audio.mp4 | Bin 44560 -> 44560 bytes .../bear-640x360-audio.mp4 | Bin 44612 -> 44612 bytes .../bear-640x360-audio.mp4 | Bin 44612 -> 44612 bytes .../bear-640x360-audio.mp4 | Bin 44612 -> 44612 bytes .../encryption-cbc-1/bear-640x360-audio.mp4 | Bin 44612 -> 44612 bytes .../encryption-cens/bear-640x360-audio.mp4 | Bin 44612 -> 44612 bytes .../bear-640x360-audio.mp4 | Bin 44628 -> 44628 bytes .../bear-640x360-audio.mp4 | Bin 44628 -> 44628 bytes .../bear-640x360-audio-skip_encryption.mp4 | Bin 43696 -> 43696 bytes .../bear-640x360-audio.mp4 | Bin 44612 -> 44612 bytes .../encryption/bear-640x360-audio.mp4 | Bin 44612 -> 44612 bytes .../bear-640x360-audio-init.mp4 | Bin 757 -> 757 bytes .../audio/audio-init.mp4 | Bin 757 -> 757 bytes .../bear-640x360-audio-init.mp4 | Bin 757 -> 757 bytes .../bear-640x360-audio.mp4 | Bin 44781 -> 44781 bytes .../bear-640x360-audio.mp4 | Bin 44612 -> 44612 bytes .../bear-640x360-audio-init.mp4 | Bin 757 -> 757 bytes .../bear-640x360-audio-init.mp4 | Bin 967 -> 967 bytes .../bear-640x360-audio-init.mp4 | Bin 967 -> 967 bytes .../bear-640x360-audio-init.mp4 | Bin 915 -> 915 bytes .../bear-640x360-audio-init.mp4 | Bin 915 -> 915 bytes .../bear-640x360-audio-init.mp4 | Bin 915 -> 915 bytes .../live-profile/bear-640x360-audio-init.mp4 | Bin 757 -> 757 bytes .../bear-640x360-audio-init.mp4 | Bin 757 -> 757 bytes .../bear-640x360-audio-init.mp4 | Bin 757 -> 757 bytes .../video-audio-text/bear-640x360-audio.mp4 | Bin 43696 -> 43696 bytes .../media/formats/mp4/mp4_media_parser.cc | 24 +++++++++--------- 40 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packager/app/test/testdata/acc-he/bear-640x360-aac_he-silent_right-audio.mp4 b/packager/app/test/testdata/acc-he/bear-640x360-aac_he-silent_right-audio.mp4 index 1bc42a7c7816cf6c4938c7153ec453e75a5bfdff..3cb2dcdf4461b01354c26ba7419785c408ef37ee 100644 GIT binary patch delta 21 dcmcb;pYis7#to57Y`-=!F#OuIIi9H|765O`35@^% delta 21 Zcmcb;pYis7#to57Yz$zqIi9H|764Ng1~mWx diff --git a/packager/app/test/testdata/audio-video-with-language-override-with-subtag/bear-640x360-audio.mp4 b/packager/app/test/testdata/audio-video-with-language-override-with-subtag/bear-640x360-audio.mp4 index a68f12768afb8b750f3369b082628cbd6b5e8806..a66d3bfd1a6bb46891f5a32b8811f4c75add3970 100644 GIT binary patch delta 22 ccmdmRm1zSIMKG~5eqmr>y#0Q2JX7Eb0BRHn?EnA( delta 22 XcmdmRm1zSIMKG~5K)~jBroa^dQ|$&V diff --git a/packager/app/test/testdata/audio-video-with-language-override/bear-640x360-audio.mp4 b/packager/app/test/testdata/audio-video-with-language-override/bear-640x360-audio.mp4 index a68f12768afb8b750f3369b082628cbd6b5e8806..a66d3bfd1a6bb46891f5a32b8811f4c75add3970 100644 GIT binary patch delta 22 ccmdmRm1zSIMKG~5eqmr>y#0Q2JX7Eb0BRHn?EnA( delta 22 XcmdmRm1zSIMKG~5K)~jBroa^dQ|$&V diff --git a/packager/app/test/testdata/audio-video-with-trick-play/bear-640x360-audio.mp4 b/packager/app/test/testdata/audio-video-with-trick-play/bear-640x360-audio.mp4 index d58886f965fa6377bdd67b8efb836af014b31556..1cc7fbb5f5181789ec705df490ffe3583e49d24e 100644 GIT binary patch delta 22 ccmdmRm1zSIMKG~5eqmr>y#0Q2JX7Eb0BRHn?EnA( delta 22 XcmdmRm1zSIMKG~5K)~jBroa^dQ|$&V diff --git a/packager/app/test/testdata/audio-video-with-two-trick-play/bear-640x360-audio.mp4 b/packager/app/test/testdata/audio-video-with-two-trick-play/bear-640x360-audio.mp4 index d58886f965fa6377bdd67b8efb836af014b31556..1cc7fbb5f5181789ec705df490ffe3583e49d24e 100644 GIT binary patch delta 22 ccmdmRm1zSIMKG~5eqmr>y#0Q2JX7Eb0BRHn?EnA( delta 22 XcmdmRm1zSIMKG~5K)~jBroa^dQ|$&V diff --git a/packager/app/test/testdata/audio-video/bear-640x360-audio.mp4 b/packager/app/test/testdata/audio-video/bear-640x360-audio.mp4 index d58886f965fa6377bdd67b8efb836af014b31556..1cc7fbb5f5181789ec705df490ffe3583e49d24e 100644 GIT binary patch delta 22 ccmdmRm1zSIMKG~5eqmr>y#0Q2JX7Eb0BRHn?EnA( delta 22 XcmdmRm1zSIMKG~5K)~jBroa^dQ|$&V diff --git a/packager/app/test/testdata/bear-640x360-a-cbcs-golden.mp4 b/packager/app/test/testdata/bear-640x360-a-cbcs-golden.mp4 index 64128ea454a8cc0f28d1fd91c9e8823620907ccf..2f2a91d12d194c26b1d499c9b818b123674be35c 100644 GIT binary patch delta 34 kcmZ2|ooV%TrVSBH?2KO+7#MHApB&G$0LI?T#=LX|0O}_VJ^%m! delta 34 fcmZ2|ooV%TrVSBH>2rVSBH?2KO+7#MHApB&FL9md}Lm&tuK0Q6lB3;+NC delta 34 fcmX?dhv~>2rVSBH> diff --git a/packager/app/test/testdata/bear-640x360-a-demuxed-golden.mp4 b/packager/app/test/testdata/bear-640x360-a-demuxed-golden.mp4 index d58886f965fa6377bdd67b8efb836af014b31556..1cc7fbb5f5181789ec705df490ffe3583e49d24e 100644 GIT binary patch delta 22 ccmdmRm1zSIMKG~5eqmr>y#0Q2JX7Eb0BRHn?EnA( delta 22 XcmdmRm1zSIMKG~5K)~jBroa^dQ|$&V diff --git a/packager/app/test/testdata/bear-640x360-a-live-cenc-golden-init.mp4 b/packager/app/test/testdata/bear-640x360-a-live-cenc-golden-init.mp4 index 3292cd0e8d9c1a6c6eb00cd7dd4b80c70f91d173..7130994633fa49105900fcf7301da35f82e4ba6e 100644 GIT binary patch delta 31 gcmX@kew=+n1QR>s7X}8#+wUjGGfjuH|1zBd0I_Zi8~^|S delta 31 bcmX@kew=+n1QR<01Wb-+nht0GWjX}_X`lw2 diff --git a/packager/app/test/testdata/dash-with-bandwidth-override/bear-640x360-audio.mp4 b/packager/app/test/testdata/dash-with-bandwidth-override/bear-640x360-audio.mp4 index d58886f965fa6377bdd67b8efb836af014b31556..1cc7fbb5f5181789ec705df490ffe3583e49d24e 100644 GIT binary patch delta 22 ccmdmRm1zSIMKG~5eqmr>y#0Q2JX7Eb0BRHn?EnA( delta 22 XcmdmRm1zSIMKG~5K)~jBroa^dQ|$&V diff --git a/packager/app/test/testdata/encryption-and-ad-cues/bear-640x360-audio.mp4 b/packager/app/test/testdata/encryption-and-ad-cues/bear-640x360-audio.mp4 index 6df0ec5ab9a1f9c0cf9c59b5a81759c5f1fb6902..23bb6c742cda45a2eff6f483b9272b0c9fbc1f4a 100644 GIT binary patch delta 34 kcmaERm+9?YrVSBH?2KO+7#MHApB&FL9md}Lm+8Z5003qW2><{9 delta 34 fcmaERm+9?YrVSBH>2rVSBH?2KO+7#MHApB&FL9md}Lm&tuK0Q6lB3;+NC delta 34 fcmX?dhv~>2rVSBH> diff --git a/packager/app/test/testdata/encryption-and-trick-play/bear-640x360-audio.mp4 b/packager/app/test/testdata/encryption-and-trick-play/bear-640x360-audio.mp4 index 46e073eefe855b96f7a9c7e52e68ba7aad7bf87e..afaf9595fb2875ff839794ddaec1f6f0fb9d53bb 100644 GIT binary patch delta 34 kcmX?dhv~>2rVSBH?2KO+7#MHApB&FL9md}Lm&tuK0Q6lB3;+NC delta 34 fcmX?dhv~>2rVSBH> diff --git a/packager/app/test/testdata/encryption-and-two-trick-plays/bear-640x360-audio.mp4 b/packager/app/test/testdata/encryption-and-two-trick-plays/bear-640x360-audio.mp4 index 46e073eefe855b96f7a9c7e52e68ba7aad7bf87e..afaf9595fb2875ff839794ddaec1f6f0fb9d53bb 100644 GIT binary patch delta 34 kcmX?dhv~>2rVSBH?2KO+7#MHApB&FL9md}Lm&tuK0Q6lB3;+NC delta 34 fcmX?dhv~>2rVSBH> diff --git a/packager/app/test/testdata/encryption-cbc-1/bear-640x360-audio.mp4 b/packager/app/test/testdata/encryption-cbc-1/bear-640x360-audio.mp4 index afd156b3f325b2b45a52bf297fa2c4f6d01198e7..fc019bf12ebb5d7e35b730eb6ca992f4952ed3b5 100644 GIT binary patch delta 34 kcmX?dhv~>2rVSBH?2KO+7#MHApB&FL9md}Lm&tuK0Q6lB3;+NC delta 34 fcmX?dhv~>2rVSBH> diff --git a/packager/app/test/testdata/encryption-cens/bear-640x360-audio.mp4 b/packager/app/test/testdata/encryption-cens/bear-640x360-audio.mp4 index e3e3ee5d8a3b895e9d882bb84b70600e91f802c6..587a1291d86f9b2010d7a2841415e9c30dac4b5e 100644 GIT binary patch delta 34 kcmX?dhv~>2rVSBH?2KO+7#MHApB&FL9md}Lm&tuK0Q6lB3;+NC delta 34 fcmX?dhv~>2rVSBH> diff --git a/packager/app/test/testdata/encryption-multi-keys-with-stream-label/bear-640x360-audio.mp4 b/packager/app/test/testdata/encryption-multi-keys-with-stream-label/bear-640x360-audio.mp4 index 8fba916687afabe6e6906e29f3d1110dfdb525d5..4d4ba6c5e9321e5b109723f7ad1d568fb38467f7 100644 GIT binary patch delta 34 kcmca|hv~{4rVSBH?2KO+7#MHApB&FL9md}LmnnQT0Qij#JOBUy delta 34 fcmca|hv~{4rVSBH>y#0Q2JX7Eb0BRHn?EnA( delta 22 XcmdmRm1zSIMKG~5K)~jBroa^dQ|$&V diff --git a/packager/app/test/testdata/encryption-using-fixed-key/bear-640x360-audio.mp4 b/packager/app/test/testdata/encryption-using-fixed-key/bear-640x360-audio.mp4 index 46e073eefe855b96f7a9c7e52e68ba7aad7bf87e..afaf9595fb2875ff839794ddaec1f6f0fb9d53bb 100644 GIT binary patch delta 34 kcmX?dhv~>2rVSBH?2KO+7#MHApB&FL9md}Lm&tuK0Q6lB3;+NC delta 34 fcmX?dhv~>2rVSBH> diff --git a/packager/app/test/testdata/encryption/bear-640x360-audio.mp4 b/packager/app/test/testdata/encryption/bear-640x360-audio.mp4 index 46e073eefe855b96f7a9c7e52e68ba7aad7bf87e..afaf9595fb2875ff839794ddaec1f6f0fb9d53bb 100644 GIT binary patch delta 34 kcmX?dhv~>2rVSBH?2KO+7#MHApB&FL9md}Lm&tuK0Q6lB3;+NC delta 34 fcmX?dhv~>2rVSBH> diff --git a/packager/app/test/testdata/hls-audio-video-text-with-ad-cues/bear-640x360-audio-init.mp4 b/packager/app/test/testdata/hls-audio-video-text-with-ad-cues/bear-640x360-audio-init.mp4 index f725c309e7be284474af4512e9bb7e5445cffaae..8f7a647e0041feeb17951881b2ac0625b0ffa8f6 100644 GIT binary patch delta 19 bcmey$`jvG<1QR>s7X}8#+wUjGGfe{kN+}0W delta 19 Wcmey$`jvG<1QR<01Wb-+ng#$i!UT{2 diff --git a/packager/app/test/testdata/hls-multi-segment-mp4-with-custom-path/audio/audio-init.mp4 b/packager/app/test/testdata/hls-multi-segment-mp4-with-custom-path/audio/audio-init.mp4 index f725c309e7be284474af4512e9bb7e5445cffaae..8f7a647e0041feeb17951881b2ac0625b0ffa8f6 100644 GIT binary patch delta 19 bcmey$`jvG<1QR>s7X}8#+wUjGGfe{kN+}0W delta 19 Wcmey$`jvG<1QR<01Wb-+ng#$i!UT{2 diff --git a/packager/app/test/testdata/hls-segmented-webvtt/bear-640x360-audio-init.mp4 b/packager/app/test/testdata/hls-segmented-webvtt/bear-640x360-audio-init.mp4 index f725c309e7be284474af4512e9bb7e5445cffaae..8f7a647e0041feeb17951881b2ac0625b0ffa8f6 100644 GIT binary patch delta 19 bcmey$`jvG<1QR>s7X}8#+wUjGGfe{kN+}0W delta 19 Wcmey$`jvG<1QR<01Wb-+ng#$i!UT{2 diff --git a/packager/app/test/testdata/hls-single-segment-mp4-encrypted-and-ad-cues/bear-640x360-audio.mp4 b/packager/app/test/testdata/hls-single-segment-mp4-encrypted-and-ad-cues/bear-640x360-audio.mp4 index 6df0ec5ab9a1f9c0cf9c59b5a81759c5f1fb6902..23bb6c742cda45a2eff6f483b9272b0c9fbc1f4a 100644 GIT binary patch delta 34 kcmaERm+9?YrVSBH?2KO+7#MHApB&FL9md}Lm+8Z5003qW2><{9 delta 34 fcmaERm+9?YrVSBH>2rVSBH?2KO+7#MHApB&FL9md}Lm&tuK0Q6lB3;+NC delta 34 fcmX?dhv~>2rVSBH> diff --git a/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-audio-init.mp4 b/packager/app/test/testdata/hls-with-bandwidth-override/bear-640x360-audio-init.mp4 index f725c309e7be284474af4512e9bb7e5445cffaae..8f7a647e0041feeb17951881b2ac0625b0ffa8f6 100644 GIT binary patch delta 19 bcmey$`jvG<1QR>s7X}8#+wUjGGfe{kN+}0W delta 19 Wcmey$`jvG<1QR<01Wb-+ng#$i!UT{2 diff --git a/packager/app/test/testdata/live-profile-and-encryption-and-non-dash-if-iop/bear-640x360-audio-init.mp4 b/packager/app/test/testdata/live-profile-and-encryption-and-non-dash-if-iop/bear-640x360-audio-init.mp4 index 3292cd0e8d9c1a6c6eb00cd7dd4b80c70f91d173..7130994633fa49105900fcf7301da35f82e4ba6e 100644 GIT binary patch delta 31 gcmX@kew=+n1QR>s7X}8#+wUjGGfjuH|1zBd0I_Zi8~^|S delta 31 bcmX@kew=+n1QR<01Wb-+nht0GWjX}_X`lw2 diff --git a/packager/app/test/testdata/live-profile-and-encryption/bear-640x360-audio-init.mp4 b/packager/app/test/testdata/live-profile-and-encryption/bear-640x360-audio-init.mp4 index 3292cd0e8d9c1a6c6eb00cd7dd4b80c70f91d173..7130994633fa49105900fcf7301da35f82e4ba6e 100644 GIT binary patch delta 31 gcmX@kew=+n1QR>s7X}8#+wUjGGfjuH|1zBd0I_Zi8~^|S delta 31 bcmX@kew=+n1QR<01Wb-+nht0GWjX}_X`lw2 diff --git a/packager/app/test/testdata/live-profile-and-key-rotation-and-no-pssh-in-stream/bear-640x360-audio-init.mp4 b/packager/app/test/testdata/live-profile-and-key-rotation-and-no-pssh-in-stream/bear-640x360-audio-init.mp4 index fd20d26f61e699abd2fe97d2664906a3fe788324..1556766b65a718ce6573f06ec93aacfeb329a3cf 100644 GIT binary patch delta 31 gcmbQtKAC+(1QR>s7X}8#+wUjGGfjuH|1wPj0Hq2GfB*mh delta 31 bcmbQtKAC+(1QR<01Wb-+nht0GWts*6T|5Q= diff --git a/packager/app/test/testdata/live-profile-and-key-rotation-and-non-dash-if-iop/bear-640x360-audio-init.mp4 b/packager/app/test/testdata/live-profile-and-key-rotation-and-non-dash-if-iop/bear-640x360-audio-init.mp4 index fd20d26f61e699abd2fe97d2664906a3fe788324..1556766b65a718ce6573f06ec93aacfeb329a3cf 100644 GIT binary patch delta 31 gcmbQtKAC+(1QR>s7X}8#+wUjGGfjuH|1wPj0Hq2GfB*mh delta 31 bcmbQtKAC+(1QR<01Wb-+nht0GWts*6T|5Q= diff --git a/packager/app/test/testdata/live-profile-and-key-rotation/bear-640x360-audio-init.mp4 b/packager/app/test/testdata/live-profile-and-key-rotation/bear-640x360-audio-init.mp4 index fd20d26f61e699abd2fe97d2664906a3fe788324..1556766b65a718ce6573f06ec93aacfeb329a3cf 100644 GIT binary patch delta 31 gcmbQtKAC+(1QR>s7X}8#+wUjGGfjuH|1wPj0Hq2GfB*mh delta 31 bcmbQtKAC+(1QR<01Wb-+nht0GWts*6T|5Q= diff --git a/packager/app/test/testdata/live-profile/bear-640x360-audio-init.mp4 b/packager/app/test/testdata/live-profile/bear-640x360-audio-init.mp4 index f725c309e7be284474af4512e9bb7e5445cffaae..8f7a647e0041feeb17951881b2ac0625b0ffa8f6 100644 GIT binary patch delta 19 bcmey$`jvG<1QR>s7X}8#+wUjGGfe{kN+}0W delta 19 Wcmey$`jvG<1QR<01Wb-+ng#$i!UT{2 diff --git a/packager/app/test/testdata/live-static-profile-and-ad-cues/bear-640x360-audio-init.mp4 b/packager/app/test/testdata/live-static-profile-and-ad-cues/bear-640x360-audio-init.mp4 index f725c309e7be284474af4512e9bb7e5445cffaae..8f7a647e0041feeb17951881b2ac0625b0ffa8f6 100644 GIT binary patch delta 19 bcmey$`jvG<1QR>s7X}8#+wUjGGfe{kN+}0W delta 19 Wcmey$`jvG<1QR<01Wb-+ng#$i!UT{2 diff --git a/packager/app/test/testdata/live-static-profile/bear-640x360-audio-init.mp4 b/packager/app/test/testdata/live-static-profile/bear-640x360-audio-init.mp4 index f725c309e7be284474af4512e9bb7e5445cffaae..8f7a647e0041feeb17951881b2ac0625b0ffa8f6 100644 GIT binary patch delta 19 bcmey$`jvG<1QR>s7X}8#+wUjGGfe{kN+}0W delta 19 Wcmey$`jvG<1QR<01Wb-+ng#$i!UT{2 diff --git a/packager/app/test/testdata/video-audio-text/bear-640x360-audio.mp4 b/packager/app/test/testdata/video-audio-text/bear-640x360-audio.mp4 index d58886f965fa6377bdd67b8efb836af014b31556..1cc7fbb5f5181789ec705df490ffe3583e49d24e 100644 GIT binary patch delta 22 ccmdmRm1zSIMKG~5eqmr>y#0Q2JX7Eb0BRHn?EnA( delta 22 XcmdmRm1zSIMKG~5K)~jBroa^dQ|$&V diff --git a/packager/media/formats/mp4/mp4_media_parser.cc b/packager/media/formats/mp4/mp4_media_parser.cc index e82c492c2d..4358853d29 100644 --- a/packager/media/formats/mp4/mp4_media_parser.cc +++ b/packager/media/formats/mp4/mp4_media_parser.cc @@ -392,8 +392,19 @@ bool MP4MediaParser::ParseMoov(BoxReader* reader) { switch (actual_format) { case FOURCC_mp4a: + max_bitrate = entry.esds.es_descriptor.max_bitrate(); + avg_bitrate = entry.esds.es_descriptor.avg_bitrate(); + codec = ObjectTypeToCodec(entry.esds.es_descriptor.object_type()); - if (codec == kUnknownCodec) { + if (codec == kCodecAAC) { + const AACAudioSpecificConfig& aac_audio_specific_config = + entry.esds.aac_audio_specific_config; + num_channels = aac_audio_specific_config.GetNumChannels(); + sampling_frequency = + aac_audio_specific_config.GetSamplesPerSecond(); + audio_object_type = aac_audio_specific_config.GetAudioObjectType(); + codec_config = entry.esds.es_descriptor.decoder_specific_info(); + } else if (codec == kUnknownCodec) { // Intentionally not to fail in the parser as there may be multiple // streams in the source content, which allows the supported stream // to be packaged. An error will be returned if the unsupported @@ -402,17 +413,6 @@ bool MP4MediaParser::ParseMoov(BoxReader* reader) { << static_cast( entry.esds.es_descriptor.object_type()) << " in stsd.es_desriptor."; - } else if (codec == kCodecAAC) { - const AACAudioSpecificConfig& aac_audio_specific_config = - entry.esds.aac_audio_specific_config; - num_channels = aac_audio_specific_config.GetNumChannels(); - sampling_frequency = - aac_audio_specific_config.GetSamplesPerSecond(); - audio_object_type = aac_audio_specific_config.GetAudioObjectType(); - codec_config = entry.esds.es_descriptor.decoder_specific_info(); - } else { - max_bitrate = entry.esds.es_descriptor.max_bitrate(); - avg_bitrate = entry.esds.es_descriptor.avg_bitrate(); } break; case FOURCC_dtsc: