summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/MediaPlayer.java21
-rw-r--r--media/java/android/media/midi/MidiDeviceInfo.java3
-rw-r--r--media/java/android/media/midi/MidiDeviceStatus.java3
-rw-r--r--media/jni/android_media_MediaSync.h2
4 files changed, 25 insertions, 4 deletions
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index 6ec10c7..b3c1b4d 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -2824,6 +2824,13 @@ public class MediaPlayer implements SubtitleController.Listener
mSubtitleController.selectDefaultTrack();
}
break;
+ case MEDIA_INFO_BUFFERING_START:
+ case MEDIA_INFO_BUFFERING_END:
+ TimeProvider timeProvider = mTimeProvider;
+ if (timeProvider != null) {
+ timeProvider.onBuffering(msg.arg1 == MEDIA_INFO_BUFFERING_START);
+ }
+ break;
}
if (mOnInfoListener != null) {
@@ -3362,6 +3369,7 @@ public class MediaPlayer implements SubtitleController.Listener
private MediaPlayer mPlayer;
private boolean mPaused = true;
private boolean mStopped = true;
+ private boolean mBuffering;
private long mLastReportedTime;
private long mTimeAdjustment;
// since we are expecting only a handful listeners per stream, there is
@@ -3455,12 +3463,22 @@ public class MediaPlayer implements SubtitleController.Listener
}
/** @hide */
+ public void onBuffering(boolean buffering) {
+ synchronized (this) {
+ if (DEBUG) Log.d(TAG, "onBuffering: " + buffering);
+ mBuffering = buffering;
+ scheduleNotification(REFRESH_AND_NOTIFY_TIME, 0 /* delay */);
+ }
+ }
+
+ /** @hide */
public void onStopped() {
synchronized(this) {
if (DEBUG) Log.d(TAG, "onStopped");
mPaused = true;
mStopped = true;
mSeeking = false;
+ mBuffering = false;
scheduleNotification(NOTIFY_STOP, 0 /* delay */);
}
}
@@ -3481,6 +3499,7 @@ public class MediaPlayer implements SubtitleController.Listener
synchronized(this) {
mStopped = false;
mSeeking = true;
+ mBuffering = false;
scheduleNotification(NOTIFY_SEEK, 0 /* delay */);
}
}
@@ -3683,7 +3702,7 @@ public class MediaPlayer implements SubtitleController.Listener
nanoTime >= mLastNanoTime + MAX_NS_WITHOUT_POSITION_CHECK) {
try {
mLastTimeUs = mPlayer.getCurrentPosition() * 1000L;
- mPaused = !mPlayer.isPlaying();
+ mPaused = !mPlayer.isPlaying() || mBuffering;
if (DEBUG) Log.v(TAG, (mPaused ? "paused" : "playing") + " at " + mLastTimeUs);
} catch (IllegalStateException e) {
if (mPausing) {
diff --git a/media/java/android/media/midi/MidiDeviceInfo.java b/media/java/android/media/midi/MidiDeviceInfo.java
index 35374ed..57607e9 100644
--- a/media/java/android/media/midi/MidiDeviceInfo.java
+++ b/media/java/android/media/midi/MidiDeviceInfo.java
@@ -298,6 +298,9 @@ public final class MidiDeviceInfo implements Parcelable {
@Override
public String toString() {
+ // This is a hack to force the mProperties Bundle to unparcel so we can
+ // print all the names and values.
+ mProperties.getString(PROPERTY_NAME);
return ("MidiDeviceInfo[mType=" + mType +
",mInputPortCount=" + mInputPortCount +
",mOutputPortCount=" + mOutputPortCount +
diff --git a/media/java/android/media/midi/MidiDeviceStatus.java b/media/java/android/media/midi/MidiDeviceStatus.java
index 7522dcf..d4abeff 100644
--- a/media/java/android/media/midi/MidiDeviceStatus.java
+++ b/media/java/android/media/midi/MidiDeviceStatus.java
@@ -89,10 +89,9 @@ public final class MidiDeviceStatus implements Parcelable {
@Override
public String toString() {
- StringBuilder builder = new StringBuilder(mDeviceInfo.toString());
int inputPortCount = mDeviceInfo.getInputPortCount();
int outputPortCount = mDeviceInfo.getOutputPortCount();
- builder.append(" mInputPortOpen=[");
+ StringBuilder builder = new StringBuilder("mInputPortOpen=[");
for (int i = 0; i < inputPortCount; i++) {
builder.append(mInputPortOpen[i]);
if (i < inputPortCount -1) {
diff --git a/media/jni/android_media_MediaSync.h b/media/jni/android_media_MediaSync.h
index fa5e5e0..5823057 100644
--- a/media/jni/android_media_MediaSync.h
+++ b/media/jni/android_media_MediaSync.h
@@ -26,7 +26,7 @@ namespace android {
struct AudioPlaybackRate;
class AudioTrack;
-struct IGraphicBufferProducer;
+class IGraphicBufferProducer;
struct MediaClock;
class MediaSync;