diff options
author | Derek Sollenberger <djsollen@google.com> | 2010-10-12 13:31:25 -0400 |
---|---|---|
committer | Derek Sollenberger <djsollen@google.com> | 2010-10-12 13:35:52 -0400 |
commit | 49bf866973cb3b2a6c74c0eab864e9562e4cbab1 (patch) | |
tree | 2933d12d270016514adacc9944d6c700c98a3319 /WebKit | |
parent | a39c13e25b52556c223922cee179cd711a0a89ee (diff) | |
download | external_webkit-49bf866973cb3b2a6c74c0eab864e9562e4cbab1.zip external_webkit-49bf866973cb3b2a6c74c0eab864e9562e4cbab1.tar.gz external_webkit-49bf866973cb3b2a6c74c0eab864e9562e4cbab1.tar.bz2 |
Add new API for plugin audio track latency.
This CL extends the existing udio API with a new function to
measure the latency of a audio track. To preserve binary
compatibility with the already released v0 API we have created
a v1 extension.
Change-Id: I656ac10470f2262bac7039aa45458d2100a37612
http://b/3088633
Diffstat (limited to 'WebKit')
-rw-r--r-- | WebKit/android/plugins/ANPSoundInterface.cpp | 12 | ||||
-rw-r--r-- | WebKit/android/plugins/android_npapi.h | 7 |
2 files changed, 19 insertions, 0 deletions
diff --git a/WebKit/android/plugins/ANPSoundInterface.cpp b/WebKit/android/plugins/ANPSoundInterface.cpp index 8e31d69..91778e3 100644 --- a/WebKit/android/plugins/ANPSoundInterface.cpp +++ b/WebKit/android/plugins/ANPSoundInterface.cpp @@ -136,6 +136,10 @@ static bool ANPTrackIsStopped(ANPAudioTrack* track) { return track->mTrack->stopped(); } +static uint32_t ANPTrackLatency(ANPAudioTrack* track) { + return track->mTrack->latency(); +} + /////////////////////////////////////////////////////////////////////////////// void ANPAudioTrackInterfaceV0_Init(ANPInterface* value) { @@ -147,3 +151,11 @@ void ANPAudioTrackInterfaceV0_Init(ANPInterface* value) { si->stop = ANPTrackStop; si->isStopped = ANPTrackIsStopped; } + +void ANPAudioTrackInterfaceV1_Init(ANPInterface* value) { + // initialize the functions from the previous interface + ANPAudioTrackInterfaceV0_Init(value); + // add any new functions or override existing functions + ANPAudioTrackInterfaceV1* si = reinterpret_cast<ANPAudioTrackInterfaceV1*>(value); + si->trackLatency = ANPTrackLatency; +} diff --git a/WebKit/android/plugins/android_npapi.h b/WebKit/android/plugins/android_npapi.h index 25cee97..87ca8cc 100644 --- a/WebKit/android/plugins/android_npapi.h +++ b/WebKit/android/plugins/android_npapi.h @@ -120,6 +120,8 @@ typedef uint32_t ANPMatrixFlag; #define kSystemInterfaceV0_ANPGetValue ((NPNVariable)1010) #define kEventInterfaceV0_ANPGetValue ((NPNVariable)1011) +#define kAudioTrackInterfaceV1_ANPGetValue ((NPNVariable)1012) + /** queries for the drawing models supported on this device. NPN_GetValue(inst, kSupportedDrawingModel_ANPGetValue, uint32_t* bits) @@ -762,6 +764,11 @@ struct ANPAudioTrackInterfaceV0 : ANPInterface { bool (*isStopped)(ANPAudioTrack*); }; +struct ANPAudioTrackInterfaceV1 : ANPAudioTrackInterfaceV0 { + /** Returns the track's latency in milliseconds. */ + uint32_t (*trackLatency)(ANPAudioTrack*); +}; + /////////////////////////////////////////////////////////////////////////////// // DEFINITION OF VALUES PASSED THROUGH NPP_HandleEvent |