Skip to content

Commit

Permalink
Support for MPEG-H 3D Audio bitstream pass-through via ffmpeg
Browse files Browse the repository at this point in the history
This commit enables to support MPEG-H 3D Audio bitstream pass-through via ffmpeg for Cast products.
To build this code, it is required to merge latest ffmpeg code which contains following commits.
  https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/610473b9679bfd3aff56c6889927447da860beb1
  https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/30047b6a571daa0fbdfa4eb4d907e510ab56ca3f
  https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/632b8298b70969f6ab43509fd276b33295d9e336

MPEG-H 3D Audio pass-through with MSE was supported in
  https://chromium-review.googlesource.com/c/chromium/src/+/1011291

Change-Id: I43bf1cb1d73dc90be7e40dc2f0d1f5c49263cb15
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1930369
Reviewed-by: Chrome Cunningham <chcunningham@chromium.org>
Reviewed-by: Yuchen Liu <yucliu@chromium.org>
Commit-Queue: Yuki Tsuchiya <yuki.tsuchiya@sony.com>
Cr-Commit-Position: refs/heads/master@{#733953}
  • Loading branch information
TE-YukiTsuchiya authored and Commit Bot committed Jan 22, 2020
1 parent 17c806f commit b6f045f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,7 @@ Youngmin Yoo <youngmin.yoo@samsung.com>
Youngsoo Choi <kenshin.choi@samsung.com>
Youngsun Suh <zard17@gmail.com>
Yuhong Sha <yuhong.sha@samsung.com>
Yuki Tsuchiya <Yuki.Tsuchiya@sony.com>
Yumikiyo Osanai <yumios.art@gmail.com>
Yunchao He <yunchao.he@intel.com>
Yupei Lin <yplam@yplam.com>
Expand Down
7 changes: 3 additions & 4 deletions chromecast/public/media/decoder_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,10 @@ inline bool IsValidConfig(const AudioConfig& config) {
config.channel_layout != ChannelLayout::UNSUPPORTED &&
config.sample_format >= kSampleFormatMin &&
config.sample_format <= kSampleFormatMax &&
config.sample_format != kUnknownSampleFormat &&
(config.channel_number > 0 ||
((config.sample_format != kUnknownSampleFormat &&
config.channel_number > 0 && config.bytes_per_channel > 0 &&
config.bytes_per_channel <= kMaxBytesPerSample) ||
config.channel_layout == ChannelLayout::BITSTREAM) &&
config.bytes_per_channel > 0 &&
config.bytes_per_channel <= kMaxBytesPerSample &&
config.samples_per_second > 0 &&
config.samples_per_second <= kMaxSampleRate;
}
Expand Down
18 changes: 18 additions & 0 deletions media/ffmpeg/ffmpeg_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ AudioCodec CodecIDToAudioCodec(AVCodecID codec_id) {
return kCodecOpus;
case AV_CODEC_ID_ALAC:
return kCodecALAC;
#if BUILDFLAG(ENABLE_PLATFORM_MPEG_H_AUDIO)
case AV_CODEC_ID_MPEGH_3D_AUDIO:
return kCodecMpegHAudio;
#endif
default:
DVLOG(1) << "Unknown audio CodecID: " << codec_id;
}
Expand Down Expand Up @@ -171,6 +175,10 @@ AVCodecID AudioCodecToCodecID(AudioCodec audio_codec,
return AV_CODEC_ID_PCM_MULAW;
case kCodecOpus:
return AV_CODEC_ID_OPUS;
#if BUILDFLAG(ENABLE_PLATFORM_MPEG_H_AUDIO)
case kCodecMpegHAudio:
return AV_CODEC_ID_MPEGH_3D_AUDIO;
#endif
default:
DVLOG(1) << "Unknown AudioCodec: " << audio_codec;
}
Expand Down Expand Up @@ -352,6 +360,12 @@ bool AVCodecContextToAudioDecoderConfig(const AVCodecContext* codec_context,
NOTREACHED();
#endif
break;
#if BUILDFLAG(ENABLE_PLATFORM_MPEG_H_AUDIO)
case kCodecMpegHAudio:
channel_layout = CHANNEL_LAYOUT_BITSTREAM;
sample_format = kSampleFormatMpegHAudio;
break;
#endif

default:
break;
Expand Down Expand Up @@ -391,6 +405,10 @@ bool AVCodecContextToAudioDecoderConfig(const AVCodecContext* codec_context,
if (codec == kCodecAC3 || codec == kCodecEAC3)
return true;
#endif
#if BUILDFLAG(ENABLE_PLATFORM_MPEG_H_AUDIO)
if (codec == kCodecMpegHAudio)
return true;
#endif

#if BUILDFLAG(USE_PROPRIETARY_CODECS)
// TODO(dalecurtis): Just use the profile from the codec context if ffmpeg
Expand Down

0 comments on commit b6f045f

Please sign in to comment.