Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: media/base/android/audio_decoder_job.cc

Issue 866573004: media: Enable Opus support in Clank <video> and MSE (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/base/android/audio_decoder_job.h" 5 #include "media/base/android/audio_decoder_job.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "media/base/android/media_codec_bridge.h" 10 #include "media/base/android/media_codec_bridge.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 53
54 void AudioDecoderJob::SetDemuxerConfigs(const DemuxerConfigs& configs) { 54 void AudioDecoderJob::SetDemuxerConfigs(const DemuxerConfigs& configs) {
55 // TODO(qinmin): split DemuxerConfig for audio and video separately so we 55 // TODO(qinmin): split DemuxerConfig for audio and video separately so we
56 // can simply store the stucture here. 56 // can simply store the stucture here.
57 audio_codec_ = configs.audio_codec; 57 audio_codec_ = configs.audio_codec;
58 num_channels_ = configs.audio_channels; 58 num_channels_ = configs.audio_channels;
59 sampling_rate_ = configs.audio_sampling_rate; 59 sampling_rate_ = configs.audio_sampling_rate;
60 set_is_content_encrypted(configs.is_audio_encrypted); 60 set_is_content_encrypted(configs.is_audio_encrypted);
61 audio_extra_data_ = configs.audio_extra_data; 61 audio_extra_data_ = configs.audio_extra_data;
62 audio_codec_delay_ns_ = configs.audio_codec_delay_ns;
63 audio_seek_preroll_ns_ = configs.audio_seek_preroll_ns;
62 bytes_per_frame_ = kBytesPerAudioOutputSample * num_channels_; 64 bytes_per_frame_ = kBytesPerAudioOutputSample * num_channels_;
63 } 65 }
64 66
65 void AudioDecoderJob::SetVolume(double volume) { 67 void AudioDecoderJob::SetVolume(double volume) {
66 volume_ = volume; 68 volume_ = volume;
67 SetVolumeInternal(); 69 SetVolumeInternal();
68 } 70 }
69 71
70 void AudioDecoderJob::SetBaseTimestamp(base::TimeDelta base_timestamp) { 72 void AudioDecoderJob::SetBaseTimestamp(base::TimeDelta base_timestamp) {
71 DCHECK(!is_decoding()); 73 DCHECK(!is_decoding());
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 configs.audio_extra_data.begin()); 119 configs.audio_extra_data.begin());
118 } 120 }
119 121
120 bool AudioDecoderJob::CreateMediaCodecBridgeInternal() { 122 bool AudioDecoderJob::CreateMediaCodecBridgeInternal() {
121 media_codec_bridge_.reset(AudioCodecBridge::Create(audio_codec_)); 123 media_codec_bridge_.reset(AudioCodecBridge::Create(audio_codec_));
122 if (!media_codec_bridge_) 124 if (!media_codec_bridge_)
123 return false; 125 return false;
124 126
125 if (!(static_cast<AudioCodecBridge*>(media_codec_bridge_.get()))->Start( 127 if (!(static_cast<AudioCodecBridge*>(media_codec_bridge_.get()))->Start(
126 audio_codec_, sampling_rate_, num_channels_, &audio_extra_data_[0], 128 audio_codec_, sampling_rate_, num_channels_, &audio_extra_data_[0],
127 audio_extra_data_.size(), true, GetMediaCrypto().obj())) { 129 audio_extra_data_.size(), audio_codec_delay_ns_, audio_seek_preroll_ns_,
130 true, GetMediaCrypto().obj())) {
128 media_codec_bridge_.reset(); 131 media_codec_bridge_.reset();
129 return false; 132 return false;
130 } 133 }
131 134
132 SetVolumeInternal(); 135 SetVolumeInternal();
133 136
134 // Need to pass the base timestamp to the new decoder. 137 // Need to pass the base timestamp to the new decoder.
135 if (audio_timestamp_helper_) 138 if (audio_timestamp_helper_)
136 base_timestamp_ = audio_timestamp_helper_->GetTimestamp(); 139 base_timestamp_ = audio_timestamp_helper_->GetTimestamp();
137 audio_timestamp_helper_.reset(new AudioTimestampHelper(sampling_rate_)); 140 audio_timestamp_helper_.reset(new AudioTimestampHelper(sampling_rate_));
138 audio_timestamp_helper_->SetBaseTimestamp(base_timestamp_); 141 audio_timestamp_helper_->SetBaseTimestamp(base_timestamp_);
139 return true; 142 return true;
140 } 143 }
141 144
142 void AudioDecoderJob::SetVolumeInternal() { 145 void AudioDecoderJob::SetVolumeInternal() {
143 if (media_codec_bridge_) { 146 if (media_codec_bridge_) {
144 static_cast<AudioCodecBridge*>(media_codec_bridge_.get())->SetVolume( 147 static_cast<AudioCodecBridge*>(media_codec_bridge_.get())->SetVolume(
145 volume_); 148 volume_);
146 } 149 }
147 } 150 }
148 151
149 } // namespace media 152 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698