Skip to content

Commit

Permalink
Cleanup mime attribute of enableaudiodevicecallback
Browse files Browse the repository at this point in the history
Remove this attribute as it is not used.

b/216483296y
  • Loading branch information
borongc committed Sep 8, 2023
1 parent 2f2587f commit c06f0c2
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ AudioTrackBridge createAudioTrackBridge(
int sampleRate,
int channelCount,
int preferredBufferSizeInBytes,
boolean enableAudioDeviceCallback,
boolean enablePcmContentTypeMovie,
int tunnelModeAudioSessionId,
boolean isWebAudio) {
Expand All @@ -80,7 +79,7 @@ AudioTrackBridge createAudioTrackBridge(
audioTrackBridgeList.add(audioTrackBridge);
hasAudioDeviceChanged.set(false);

if (hasRegisteredAudioDeviceCallback || !enableAudioDeviceCallback) {
if (hasRegisteredAudioDeviceCallback || isWebAudio) {
return audioTrackBridge;
}

Expand Down
11 changes: 4 additions & 7 deletions starboard/android/shared/audio_renderer_passthrough.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,8 @@ int ParseAc3SyncframeAudioSampleCount(const uint8_t* buffer, int size) {

AudioRendererPassthrough::AudioRendererPassthrough(
const AudioStreamInfo& audio_stream_info,
SbDrmSystem drm_system,
bool enable_audio_device_callback)
: audio_stream_info_(audio_stream_info),
enable_audio_device_callback_(enable_audio_device_callback) {
SbDrmSystem drm_system)
: audio_stream_info_(audio_stream_info) {
SB_DCHECK(audio_stream_info_.codec == kSbMediaAudioCodecAc3 ||
audio_stream_info_.codec == kSbMediaAudioCodecEac3);
if (SbDrmSystemIsValid(drm_system)) {
Expand Down Expand Up @@ -401,7 +399,7 @@ void AudioRendererPassthrough::CreateAudioTrackAndStartProcessing() {
optional<SbMediaAudioSampleType>(), // Not required in passthrough mode
audio_stream_info_.number_of_channels,
audio_stream_info_.samples_per_second, kPreferredBufferSizeInBytes,
enable_audio_device_callback_, false /* enable_pcm_content_type_movie */,
false /* enable_pcm_content_type_movie */,
kTunnelModeAudioSessionId, false /* is_web_audio */));

if (!audio_track_bridge->is_valid()) {
Expand Down Expand Up @@ -456,8 +454,7 @@ void AudioRendererPassthrough::UpdateStatusAndWriteData(
SB_DCHECK(error_cb_);
SB_DCHECK(audio_track_bridge_);

if (enable_audio_device_callback_ &&
audio_track_bridge_->GetAndResetHasAudioDeviceChanged()) {
if (audio_track_bridge_->GetAndResetHasAudioDeviceChanged()) {
SB_LOG(INFO) << "Audio device changed, raising a capability changed error "
"to restart playback.";
error_cb_(kSbPlayerErrorCapabilityChanged,
Expand Down
6 changes: 2 additions & 4 deletions starboard/android/shared/audio_renderer_passthrough.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ class AudioRendererPassthrough
AudioStreamInfo;

AudioRendererPassthrough(const AudioStreamInfo& audio_stream_info,
SbDrmSystem drm_system,
bool enable_audio_device_callback);
SbDrmSystem drm_system);
~AudioRendererPassthrough() override;

bool is_valid() const { return decoder_ != nullptr; }
Expand Down Expand Up @@ -102,9 +101,8 @@ class AudioRendererPassthrough
void OnDecoderConsumed();
void OnDecoderOutput();

// The following three variables are set in the ctor.
// The following two variables are set in the ctor.
const AudioStreamInfo audio_stream_info_;
const bool enable_audio_device_callback_;
// The AudioDecoder is used as a decryptor when the stream is encrypted.
// TODO: Revisit to encapsulate the AudioDecoder as a SbDrmSystemPrivate
// instead. This would need to turn SbDrmSystemPrivate::Decrypt() into
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void MinRequiredFramesTester::TesterThreadFunc() {
GetSampleSize(task.sample_type),
&MinRequiredFramesTester::UpdateSourceStatusFunc,
&MinRequiredFramesTester::ConsumeFramesFunc,
&MinRequiredFramesTester::ErrorFunc, 0, -1, false, false, false, this);
&MinRequiredFramesTester::ErrorFunc, 0, -1, false, false, this);
{
ScopedLock scoped_lock(mutex_);
wait_timeout = !condition_variable_.WaitTimed(kSbTimeSecond * 5);
Expand Down
9 changes: 2 additions & 7 deletions starboard/android/shared/audio_track_audio_sink_type.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ AudioTrackAudioSink::AudioTrackAudioSink(
SbAudioSinkPrivate::ErrorFunc error_func,
SbTime start_time,
int tunnel_mode_audio_session_id,
bool enable_audio_device_callback,
bool enable_pcm_content_type_movie,
bool is_web_audio,
void* context)
Expand All @@ -107,7 +106,6 @@ AudioTrackAudioSink::AudioTrackAudioSink(
channels,
sampling_frequency_hz,
preferred_buffer_size_in_bytes,
enable_audio_device_callback,
enable_pcm_content_type_movie,
tunnel_mode_audio_session_id,
is_web_audio) {
Expand Down Expand Up @@ -433,16 +431,14 @@ SbAudioSink AudioTrackAudioSinkType::Create(
const SbTime kStartTime = 0;
// Disable tunnel mode.
const int kTunnelModeAudioSessionId = -1;
// Disable AudioDeviceCallback for WebAudio.
const bool kEnableAudioDeviceCallback = false;
const bool kIsWebAudio = true;
// Disable AudioAttributes::CONTENT_TYPE_MOVIE for WebAudio.
const bool kEnablePcmContentTypeMovie = false;
return Create(channels, sampling_frequency_hz, audio_sample_type,
audio_frame_storage_type, frame_buffers, frames_per_channel,
update_source_status_func, consume_frames_func, error_func,
kStartTime, kTunnelModeAudioSessionId,
kEnableAudioDeviceCallback, kEnablePcmContentTypeMovie,
kEnablePcmContentTypeMovie,
kIsWebAudio, context);
}

Expand All @@ -458,7 +454,6 @@ SbAudioSink AudioTrackAudioSinkType::Create(
SbAudioSinkPrivate::ErrorFunc error_func,
SbTime start_media_time,
int tunnel_mode_audio_session_id,
bool enable_audio_device_callback,
bool enable_pcm_content_type_movie,
bool is_web_audio,
void* context) {
Expand All @@ -472,7 +467,7 @@ SbAudioSink AudioTrackAudioSinkType::Create(
frames_per_channel, preferred_buffer_size_in_bytes,
update_source_status_func, consume_frames_func, error_func,
start_media_time, tunnel_mode_audio_session_id,
enable_audio_device_callback, enable_pcm_content_type_movie, is_web_audio,
enable_pcm_content_type_movie, is_web_audio,
context);
if (!audio_sink->IsAudioTrackValid()) {
SB_DLOG(ERROR)
Expand Down
2 changes: 0 additions & 2 deletions starboard/android/shared/audio_track_audio_sink_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ class AudioTrackAudioSinkType : public SbAudioSinkPrivate::Type {
SbAudioSinkPrivate::ErrorFunc error_func,
SbTime start_time,
int tunnel_mode_audio_session_id,
bool enable_audio_device_callback,
bool enable_pcm_content_type_movie,
bool is_web_audio,
void* context);
Expand Down Expand Up @@ -114,7 +113,6 @@ class AudioTrackAudioSink : public SbAudioSinkPrivate {
SbAudioSinkPrivate::ErrorFunc error_func,
SbTime start_media_time,
int tunnel_mode_audio_session_id,
bool enable_audio_device_callback,
bool enable_pcm_content_type_movie,
bool is_web_audio,
void* context);
Expand Down
8 changes: 3 additions & 5 deletions starboard/android/shared/audio_track_bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ AudioTrackBridge::AudioTrackBridge(SbMediaAudioCodingType coding_type,
int channels,
int sampling_frequency_hz,
int preferred_buffer_size_in_bytes,
bool enable_audio_device_callback,
bool enable_pcm_content_type_movie,
int tunnel_mode_audio_session_id,
bool is_web_audio) {
Expand All @@ -65,11 +64,10 @@ AudioTrackBridge::AudioTrackBridge(SbMediaAudioCodingType coding_type,
"getAudioOutputManager", "()Ldev/cobalt/media/AudioOutputManager;"));
jobject j_audio_track_bridge = env->CallObjectMethodOrAbort(
j_audio_output_manager.Get(), "createAudioTrackBridge",
"(IIIIZZIZ)Ldev/cobalt/media/AudioTrackBridge;",
"(IIIIZIZ)Ldev/cobalt/media/AudioTrackBridge;",
GetAudioFormatSampleType(coding_type, sample_type), sampling_frequency_hz,
channels, preferred_buffer_size_in_bytes, enable_audio_device_callback,
enable_pcm_content_type_movie, tunnel_mode_audio_session_id,
is_web_audio);
channels, preferred_buffer_size_in_bytes, enable_pcm_content_type_movie,
tunnel_mode_audio_session_id, is_web_audio);
if (!j_audio_track_bridge) {
// One of the cases that this may hit is when output happened to be switched
// to a device that doesn't support tunnel mode.
Expand Down
1 change: 0 additions & 1 deletion starboard/android/shared/audio_track_bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class AudioTrackBridge {
int channels,
int sampling_frequency_hz,
int preferred_buffer_size_in_bytes,
bool enable_audio_device_callback,
bool enable_pcm_content_type_movie,
int tunnel_mode_audio_session_id,
bool is_web_audio);
Expand Down
20 changes: 9 additions & 11 deletions starboard/android/shared/player_components_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ constexpr bool kForceResetSurfaceUnderTunnelMode = true;
class AudioRendererSinkAndroid : public ::starboard::shared::starboard::player::
filter::AudioRendererSinkImpl {
public:
explicit AudioRendererSinkAndroid(bool enable_audio_device_callback,
bool enable_pcm_content_type_movie,
explicit AudioRendererSinkAndroid(bool enable_pcm_content_type_movie,
int tunnel_mode_audio_session_id = -1)
: AudioRendererSinkImpl(
[=](SbTime start_media_time,
Expand All @@ -97,8 +96,8 @@ class AudioRendererSinkAndroid : public ::starboard::shared::starboard::player::
audio_frame_storage_type, frame_buffers,
frame_buffers_size_in_frames, update_source_status_func,
consume_frames_func, error_func, start_media_time,
tunnel_mode_audio_session_id, true,
enable_pcm_content_type_movie, false, /* is_web_audio */
tunnel_mode_audio_session_id, enable_pcm_content_type_movie,
false, /* is_web_audio */
context);
}),
tunnel_mode_audio_session_id_(tunnel_mode_audio_session_id) {}
Expand Down Expand Up @@ -229,7 +228,7 @@ class PlayerComponentsFactory : public starboard::shared::starboard::player::
scoped_ptr<AudioRendererPassthrough> audio_renderer;
audio_renderer.reset(
new AudioRendererPassthrough(creation_parameters.audio_stream_info(),
creation_parameters.drm_system(), true));
creation_parameters.drm_system()));
if (!audio_renderer->is_valid()) {
return scoped_ptr<PlayerComponents>();
}
Expand Down Expand Up @@ -423,14 +422,14 @@ class PlayerComponentsFactory : public starboard::shared::starboard::player::

if (tunnel_mode_audio_session_id != -1) {
*audio_renderer_sink = TryToCreateTunnelModeAudioRendererSink(
tunnel_mode_audio_session_id, creation_parameters, true);
tunnel_mode_audio_session_id, creation_parameters);
if (!*audio_renderer_sink) {
tunnel_mode_audio_session_id = -1;
}
}
if (!*audio_renderer_sink) {
audio_renderer_sink->reset(
new AudioRendererSinkAndroid(true, enable_pcm_content_type_movie));
new AudioRendererSinkAndroid(enable_pcm_content_type_movie));
}
}

Expand Down Expand Up @@ -615,10 +614,9 @@ class PlayerComponentsFactory : public starboard::shared::starboard::player::

scoped_ptr<AudioRendererSink> TryToCreateTunnelModeAudioRendererSink(
int tunnel_mode_audio_session_id,
const CreationParameters& creation_parameters,
bool enable_audio_device_callback) {
scoped_ptr<AudioRendererSink> audio_sink(new AudioRendererSinkAndroid(
enable_audio_device_callback, true, tunnel_mode_audio_session_id));
const CreationParameters& creation_parameters) {
scoped_ptr<AudioRendererSink> audio_sink(
new AudioRendererSinkAndroid(true, tunnel_mode_audio_session_id));
// We need to double check if the audio sink can actually be created.
int max_cached_frames, min_frames_per_append;
GetAudioRendererParams(creation_parameters, &max_cached_frames,
Expand Down

0 comments on commit c06f0c2

Please sign in to comment.