Hi Lakshman,

...

On Wed, Jul 28, 2010 at 10:48 AM, Lakshman <lakshma...@gmail.com> wrote:
> Please find my comments inlined...
>
> Thanks and regards,
> -Lakshman
>
>
...
>>
>> Although, I'm not sure this is the correct way to handle this as I
>> would want to push this change to gerrit.  I'm also wondering why this
>> event is not handled yet.
>> [Lakshman] once you get INFO_FORMAT_CHANGED message from OMXCodec to
>> AudioPlayer...you close and reopen AudioSink...As per google guys...this is
>> not in their use case it seems....
>

I think this explains why they are setting the sample rate from the
input stream and not from the OMX Component param

                // Use the codec-advertised number of channels, as some
                // codecs appear to output stereo even if the input data is
                // mono. If we know the codec lies about this information,
                // use the actual number of channels instead.
                mOutputFormat->setInt32(
                        kKeyChannelCount,
                        (mQuirks & kDecoderLiesAboutNumberOfChannels)
                            ? numChannels : params.nChannels);

                // The codec-reported sampleRate is not reliable...
                mOutputFormat->setInt32(kKeySampleRate, sampleRate);

It should be reliable all the time.  I believe this is dependent on
the components behavior.  If I have an OMX component that has a
reliable samplerate then this case should be considered.  There should
be a patch for this and AudioSink should manage it.

As said, I'm able to make it work as long as I do the close, open, start

...

>> I have forced AudioSink to be Null in AwesomePlayer's
>> AwesomePlayer::play_l() as follows:
>>
>> if (mAudioSink != NULL) {
>>                mAudioPlayer = new AudioPlayer(NULL);
>>
>> This, for experimental purposes, will do the same as you're doing and
>> it also works fine since AudioTrack has the setSampleRate method and
>> it works as I expect too.
>>
>> Then, when creating AudioTrack it will be registered with
>> AudioFlinger, so in both cases, software and hardware outputs will use
>> AudioFlinger.  I know this information from AudioTrack.h class
>> definition.
>>
>> I would prefer, in my case, to use AudioTrack since calling
>> setSampleRate looks cleaner than what I can do with AudioSink.
>> [Lakshman] The callback functions registered for fetching data is
>> different from AudioSink and AudioTrack....on INFO_FORMAT_CHANGED message if
>> you are trying to use AudioTrack setSampleRate() to re-configure audio
>> driver with new sampleRate ...It doesn't work.

I've done that on OMXCodec::initOutputFormat method and was able to
change the samplerate and playback a clip with AAC and SBR just fine

>> If you create a new AudioTrack ...you are registering a new call back
>> function....you have two call back functions AudioSink callback and
>> AudioTrack ....does creating a new AudioTrack overwrites AudioSink call back
>> function....on Audio event which one is triggered???

AudioTrack is never created when using AudioSink, so there's not going
to be two running at the same time.  I haven't checked but I assumed
the callback is created later for AudioSink.  Then in my experiment
there should be only one callback for AudioTrack, in a scenario where
multiple callbacks are created, I would expect that AudioTrack would
fail, which is not my case.

-- 
Daniel.
>
>
>
>>
>> I may submit the patch to gerrit and see comments from the google
>> engineer.
>>
>> Thanks.
>>
>> --
>> Daniel.
>>
>>
>>
>> >
>> > Thanks and regards,
>> > -Lakshman
>> >
>> >
>> >
>> >
>> >
>> >
>> > On Wed, Jul 28, 2010 at 5:56 AM, Daniel Charles <dcharl...@gmail.com>
>> > wrote:
>> >>
>> >> Hi all,
>> >>
>> >> I'm interested on learning the difference between using AudioTrack and
>> >> AudioSink within Stagefreight's AudioPlayer class. I have seen that
>> >> inside AudioPlayer AudioTrack is used as long as AudioSink was not
>> >> created.  AudioSink gets created only when MediaPlayerService creates
>> >> a player and it has not a HardwareOutput.
>> >>
>> >> How could I use AudioTrack instead of AudioSink?  Which is the
>> >> difference between these two.  AFAIU, both are connected to
>> >> audioflinger somehow.
>> >>
>> >> I appreciate any hint on this.
>> >>
>> >> Thanks.
>> >>
>> >> --
>> >> Daniel.
>> >>
>> >> --
>> >> unsubscribe: android-porting+unsubscr...@googlegroups.com
>> >> website: http://groups.google.com/group/android-porting
>> >
>> >
>
>

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-porting

Reply via email to