summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/java/android/provider/MediaStore.java8
-rw-r--r--core/java/android/widget/TextView.java39
-rw-r--r--core/jni/android_server_BluetoothService.cpp20
-rw-r--r--core/res/res/drawable-hdpi/list_activated_holo.9.pngbin1058 -> 154 bytes
-rw-r--r--core/res/res/drawable-hdpi/list_focused_holo.9.pngbin1098 -> 159 bytes
-rw-r--r--core/res/res/drawable-hdpi/list_longpressed_holo.9.pngbin1060 -> 154 bytes
-rw-r--r--core/res/res/drawable-hdpi/list_pressed_holo_dark.9.pngbin1061 -> 159 bytes
-rw-r--r--core/res/res/drawable-hdpi/list_pressed_holo_light.9.pngbin1060 -> 159 bytes
-rw-r--r--core/res/res/drawable-hdpi/list_section_divider_holo_dark.9.pngbin186 -> 179 bytes
-rw-r--r--core/res/res/drawable-hdpi/list_section_divider_holo_light.9.pngbin190 -> 165 bytes
-rw-r--r--core/res/res/drawable-hdpi/list_selected_holo_dark.9.pngbin1084 -> 157 bytes
-rw-r--r--core/res/res/drawable-hdpi/list_selected_holo_light.9.pngbin1075 -> 157 bytes
-rw-r--r--core/res/res/drawable-mdpi/list_activated_holo.9.pngbin1049 -> 151 bytes
-rw-r--r--core/res/res/drawable-mdpi/list_focused_holo.9.pngbin1092 -> 158 bytes
-rw-r--r--core/res/res/drawable-mdpi/list_longpressed_holo.9.pngbin1049 -> 151 bytes
-rw-r--r--core/res/res/drawable-mdpi/list_pressed_holo_dark.9.pngbin1057 -> 158 bytes
-rw-r--r--core/res/res/drawable-mdpi/list_pressed_holo_light.9.pngbin1053 -> 158 bytes
-rw-r--r--core/res/res/drawable-mdpi/list_section_divider_holo_dark.9.pngbin193 -> 166 bytes
-rw-r--r--core/res/res/drawable-mdpi/list_section_divider_holo_light.9.pngbin193 -> 152 bytes
-rw-r--r--core/res/res/drawable-mdpi/list_selected_holo_dark.9.pngbin1077 -> 156 bytes
-rw-r--r--core/res/res/drawable-mdpi/list_selected_holo_light.9.pngbin1070 -> 156 bytes
-rw-r--r--core/res/res/drawable-nodpi/list_divider_holo_dark.9.pngbin0 -> 1001 bytes
-rw-r--r--core/res/res/drawable-nodpi/list_divider_holo_light.9.pngbin0 -> 1001 bytes
-rw-r--r--core/res/res/drawable-xhdpi/list_activated_holo.9.pngbin0 -> 158 bytes
-rw-r--r--core/res/res/drawable-xhdpi/list_focused_holo.9.pngbin0 -> 163 bytes
-rw-r--r--core/res/res/drawable-xhdpi/list_longpressed_holo.9.pngbin0 -> 159 bytes
-rw-r--r--core/res/res/drawable-xhdpi/list_pressed_holo_dark.9.pngbin0 -> 163 bytes
-rw-r--r--core/res/res/drawable-xhdpi/list_pressed_holo_light.9.pngbin0 -> 163 bytes
-rw-r--r--core/res/res/drawable-xhdpi/list_section_divider_holo_dark.9.pngbin0 -> 180 bytes
-rw-r--r--core/res/res/drawable-xhdpi/list_section_divider_holo_light.9.pngbin0 -> 173 bytes
-rw-r--r--core/res/res/drawable-xhdpi/list_selected_holo_dark.9.pngbin0 -> 160 bytes
-rw-r--r--core/res/res/drawable-xhdpi/list_selected_holo_light.9.pngbin0 -> 160 bytes
-rw-r--r--media/java/android/media/MediaScanner.java55
-rw-r--r--media/libstagefright/httplive/LiveSession.cpp21
34 files changed, 63 insertions, 80 deletions
diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java
index f799af3..5da3114 100644
--- a/core/java/android/provider/MediaStore.java
+++ b/core/java/android/provider/MediaStore.java
@@ -1148,6 +1148,14 @@ public final class MediaStore {
* <P>Type: INTEGER (boolean)</P>
*/
public static final String IS_NOTIFICATION = "is_notification";
+
+ /**
+ * The genre of the audio file, if any
+ * <P>Type: TEXT</P>
+ * Does not exist in the database - only used by the media scanner for inserts.
+ * @hide
+ */
+ public static final String GENRE = "genre";
}
/**
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 6dcae6d..ab66676 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -143,6 +143,9 @@ import java.io.IOException;
import java.lang.ref.WeakReference;
import java.text.BreakIterator;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashMap;
/**
* Displays text to the user and optionally allows them to edit it. A TextView
@@ -8812,12 +8815,42 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
int suggestionIndex; // the index of the suggestion inside suggestionSpan
}
+ /**
+ * Returns the suggestion spans that cover the current cursor position. The suggestion
+ * spans are sorted according to the length of text that they are attached to.
+ */
+ private SuggestionSpan[] getSuggestionSpans() {
+ int pos = TextView.this.getSelectionStart();
+ Spannable spannable = (Spannable) TextView.this.mText;
+ SuggestionSpan[] suggestionSpans = spannable.getSpans(pos, pos, SuggestionSpan.class);
+
+ // Cache the span length for performance reason.
+ final HashMap<SuggestionSpan, Integer> spanLengthMap =
+ new HashMap<SuggestionSpan, Integer>();
+
+ for (SuggestionSpan suggestionSpan : suggestionSpans) {
+ int start = spannable.getSpanStart(suggestionSpan);
+ int end = spannable.getSpanEnd(suggestionSpan);
+ spanLengthMap.put(suggestionSpan, end - start);
+ }
+
+ // The suggestions are sorted according to the lenght of the text that they cover
+ // (shorter first)
+ Arrays.sort(suggestionSpans, new Comparator<SuggestionSpan>() {
+ public int compare(SuggestionSpan span1, SuggestionSpan span2) {
+ return spanLengthMap.get(span1) - spanLengthMap.get(span2);
+ }
+ });
+
+ return suggestionSpans;
+ }
+
public void show() {
if (!(mText instanceof Editable)) return;
- final int pos = TextView.this.getSelectionStart();
- Spannable spannable = (Spannable)TextView.this.mText;
- SuggestionSpan[] suggestionSpans = spannable.getSpans(pos, pos, SuggestionSpan.class);
+ Spannable spannable = (Spannable) TextView.this.mText;
+ SuggestionSpan[] suggestionSpans = getSuggestionSpans();
+
final int nbSpans = suggestionSpans.length;
int totalNbSuggestions = 0;
diff --git a/core/jni/android_server_BluetoothService.cpp b/core/jni/android_server_BluetoothService.cpp
index 41056fd..819449a 100644
--- a/core/jni/android_server_BluetoothService.cpp
+++ b/core/jni/android_server_BluetoothService.cpp
@@ -846,14 +846,13 @@ static jboolean setDevicePropertyNative(JNIEnv *env, jobject object, jstring pat
LOGV("%s", __FUNCTION__);
native_data_t *nat = get_native_data(env, object);
if (nat) {
- DBusMessage *reply, *msg;
+ DBusMessage *msg;
DBusMessageIter iter;
- DBusError err;
+ dbus_bool_t reply = JNI_FALSE;
const char *c_key = env->GetStringUTFChars(key, NULL);
const char *c_path = env->GetStringUTFChars(path, NULL);
- dbus_error_init(&err);
msg = dbus_message_new_method_call(BLUEZ_DBUS_BASE_IFC,
c_path, DBUS_DEVICE_IFACE, "SetProperty");
if (!msg) {
@@ -867,19 +866,14 @@ static jboolean setDevicePropertyNative(JNIEnv *env, jobject object, jstring pat
dbus_message_iter_init_append(msg, &iter);
append_variant(&iter, type, value);
- reply = dbus_connection_send_with_reply_and_block(nat->conn, msg, -1, &err);
+ // Asynchronous call - the callbacks come via Device propertyChange
+ reply = dbus_connection_send_with_reply(nat->conn, msg, NULL, -1);
dbus_message_unref(msg);
- env->ReleaseStringUTFChars(key, c_key);
env->ReleaseStringUTFChars(path, c_path);
- if (!reply) {
- if (dbus_error_is_set(&err)) {
- LOG_AND_FREE_DBUS_ERROR(&err);
- } else
- LOGE("DBus reply is NULL in function %s", __FUNCTION__);
- return JNI_FALSE;
- }
- return JNI_TRUE;
+ env->ReleaseStringUTFChars(key, c_key);
+
+ return reply ? JNI_TRUE : JNI_FALSE;
}
#endif
return JNI_FALSE;
diff --git a/core/res/res/drawable-hdpi/list_activated_holo.9.png b/core/res/res/drawable-hdpi/list_activated_holo.9.png
index 12a379b..4ea7afa 100644
--- a/core/res/res/drawable-hdpi/list_activated_holo.9.png
+++ b/core/res/res/drawable-hdpi/list_activated_holo.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/list_focused_holo.9.png b/core/res/res/drawable-hdpi/list_focused_holo.9.png
index e354629..516f5c7 100644
--- a/core/res/res/drawable-hdpi/list_focused_holo.9.png
+++ b/core/res/res/drawable-hdpi/list_focused_holo.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/list_longpressed_holo.9.png b/core/res/res/drawable-hdpi/list_longpressed_holo.9.png
index 367c7d9..d06549c 100644
--- a/core/res/res/drawable-hdpi/list_longpressed_holo.9.png
+++ b/core/res/res/drawable-hdpi/list_longpressed_holo.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/list_pressed_holo_dark.9.png b/core/res/res/drawable-hdpi/list_pressed_holo_dark.9.png
index 9eae8f4..82f6734 100644
--- a/core/res/res/drawable-hdpi/list_pressed_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/list_pressed_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/list_pressed_holo_light.9.png b/core/res/res/drawable-hdpi/list_pressed_holo_light.9.png
index a9131fc..82f6734 100644
--- a/core/res/res/drawable-hdpi/list_pressed_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/list_pressed_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/list_section_divider_holo_dark.9.png b/core/res/res/drawable-hdpi/list_section_divider_holo_dark.9.png
index 21e2fb9..5522f5c 100644
--- a/core/res/res/drawable-hdpi/list_section_divider_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/list_section_divider_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/list_section_divider_holo_light.9.png b/core/res/res/drawable-hdpi/list_section_divider_holo_light.9.png
index 8e9c02c..a9dbfb9 100644
--- a/core/res/res/drawable-hdpi/list_section_divider_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/list_section_divider_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/list_selected_holo_dark.9.png b/core/res/res/drawable-hdpi/list_selected_holo_dark.9.png
index 780e86d..5f5b23f 100644
--- a/core/res/res/drawable-hdpi/list_selected_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/list_selected_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/list_selected_holo_light.9.png b/core/res/res/drawable-hdpi/list_selected_holo_light.9.png
index 999d05b..5f5b23f 100644
--- a/core/res/res/drawable-hdpi/list_selected_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/list_selected_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/list_activated_holo.9.png b/core/res/res/drawable-mdpi/list_activated_holo.9.png
index f162c9a..3bf8e03 100644
--- a/core/res/res/drawable-mdpi/list_activated_holo.9.png
+++ b/core/res/res/drawable-mdpi/list_activated_holo.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/list_focused_holo.9.png b/core/res/res/drawable-mdpi/list_focused_holo.9.png
index e2449dd..7c0599e 100644
--- a/core/res/res/drawable-mdpi/list_focused_holo.9.png
+++ b/core/res/res/drawable-mdpi/list_focused_holo.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/list_longpressed_holo.9.png b/core/res/res/drawable-mdpi/list_longpressed_holo.9.png
index 3483891..2b8a0b3 100644
--- a/core/res/res/drawable-mdpi/list_longpressed_holo.9.png
+++ b/core/res/res/drawable-mdpi/list_longpressed_holo.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/list_pressed_holo_dark.9.png b/core/res/res/drawable-mdpi/list_pressed_holo_dark.9.png
index e3344b6..b60aaa5 100644
--- a/core/res/res/drawable-mdpi/list_pressed_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/list_pressed_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/list_pressed_holo_light.9.png b/core/res/res/drawable-mdpi/list_pressed_holo_light.9.png
index 2365978..b60aaa5 100644
--- a/core/res/res/drawable-mdpi/list_pressed_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/list_pressed_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/list_section_divider_holo_dark.9.png b/core/res/res/drawable-mdpi/list_section_divider_holo_dark.9.png
index b888135..f707453 100644
--- a/core/res/res/drawable-mdpi/list_section_divider_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/list_section_divider_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/list_section_divider_holo_light.9.png b/core/res/res/drawable-mdpi/list_section_divider_holo_light.9.png
index 1cc1f7f..441ccc0 100644
--- a/core/res/res/drawable-mdpi/list_section_divider_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/list_section_divider_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/list_selected_holo_dark.9.png b/core/res/res/drawable-mdpi/list_selected_holo_dark.9.png
index a7f6277..faa0672 100644
--- a/core/res/res/drawable-mdpi/list_selected_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/list_selected_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/list_selected_holo_light.9.png b/core/res/res/drawable-mdpi/list_selected_holo_light.9.png
index b6029ec..faa0672 100644
--- a/core/res/res/drawable-mdpi/list_selected_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/list_selected_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-nodpi/list_divider_holo_dark.9.png b/core/res/res/drawable-nodpi/list_divider_holo_dark.9.png
new file mode 100644
index 0000000..2e7951f
--- /dev/null
+++ b/core/res/res/drawable-nodpi/list_divider_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-nodpi/list_divider_holo_light.9.png b/core/res/res/drawable-nodpi/list_divider_holo_light.9.png
new file mode 100644
index 0000000..17d8a54
--- /dev/null
+++ b/core/res/res/drawable-nodpi/list_divider_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/list_activated_holo.9.png b/core/res/res/drawable-xhdpi/list_activated_holo.9.png
new file mode 100644
index 0000000..eda10e6
--- /dev/null
+++ b/core/res/res/drawable-xhdpi/list_activated_holo.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/list_focused_holo.9.png b/core/res/res/drawable-xhdpi/list_focused_holo.9.png
new file mode 100644
index 0000000..690cb1e
--- /dev/null
+++ b/core/res/res/drawable-xhdpi/list_focused_holo.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/list_longpressed_holo.9.png b/core/res/res/drawable-xhdpi/list_longpressed_holo.9.png
new file mode 100644
index 0000000..e303022
--- /dev/null
+++ b/core/res/res/drawable-xhdpi/list_longpressed_holo.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/list_pressed_holo_dark.9.png b/core/res/res/drawable-xhdpi/list_pressed_holo_dark.9.png
new file mode 100644
index 0000000..80c93da
--- /dev/null
+++ b/core/res/res/drawable-xhdpi/list_pressed_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/list_pressed_holo_light.9.png b/core/res/res/drawable-xhdpi/list_pressed_holo_light.9.png
new file mode 100644
index 0000000..80c93da
--- /dev/null
+++ b/core/res/res/drawable-xhdpi/list_pressed_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/list_section_divider_holo_dark.9.png b/core/res/res/drawable-xhdpi/list_section_divider_holo_dark.9.png
new file mode 100644
index 0000000..76fd13c
--- /dev/null
+++ b/core/res/res/drawable-xhdpi/list_section_divider_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/list_section_divider_holo_light.9.png b/core/res/res/drawable-xhdpi/list_section_divider_holo_light.9.png
new file mode 100644
index 0000000..d8fd9e3
--- /dev/null
+++ b/core/res/res/drawable-xhdpi/list_section_divider_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/list_selected_holo_dark.9.png b/core/res/res/drawable-xhdpi/list_selected_holo_dark.9.png
new file mode 100644
index 0000000..3e8dac8
--- /dev/null
+++ b/core/res/res/drawable-xhdpi/list_selected_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/list_selected_holo_light.9.png b/core/res/res/drawable-xhdpi/list_selected_holo_light.9.png
new file mode 100644
index 0000000..3e8dac8
--- /dev/null
+++ b/core/res/res/drawable-xhdpi/list_selected_holo_light.9.png
Binary files differ
diff --git a/media/java/android/media/MediaScanner.java b/media/java/android/media/MediaScanner.java
index 58f9432..8339e4b 100644
--- a/media/java/android/media/MediaScanner.java
+++ b/media/java/android/media/MediaScanner.java
@@ -40,7 +40,6 @@ import android.provider.MediaStore.Audio;
import android.provider.MediaStore.Files;
import android.provider.MediaStore.Images;
import android.provider.MediaStore.Video;
-import android.provider.MediaStore.Audio.Genres;
import android.provider.MediaStore.Audio.Playlists;
import android.sax.Element;
import android.sax.ElementListener;
@@ -138,11 +137,6 @@ public class MediaScanner
private static final int PATH_PLAYLISTS_COLUMN_INDEX = 1;
private static final int DATE_MODIFIED_PLAYLISTS_COLUMN_INDEX = 2;
- private static final String[] GENRE_LOOKUP_PROJECTION = new String[] {
- Audio.Genres._ID, // 0
- Audio.Genres.NAME, // 1
- };
-
private static final String RINGTONES_DIR = "/ringtones/";
private static final String NOTIFICATIONS_DIR = "/notifications/";
private static final String ALARMS_DIR = "/alarms/";
@@ -311,10 +305,9 @@ public class MediaScanner
private Uri mVideoUri;
private Uri mImagesUri;
private Uri mThumbsUri;
- private Uri mGenresUri;
private Uri mPlaylistsUri;
private Uri mFilesUri;
- private boolean mProcessPlaylists, mProcessGenres;
+ private boolean mProcessPlaylists;
private int mMtpObjectHandle;
private final String mExternalStoragePath;
@@ -413,7 +406,6 @@ public class MediaScanner
private HashMap<String, FileCacheEntry> mFileCache;
private ArrayList<FileCacheEntry> mPlayLists;
- private HashMap<String, Uri> mGenreCache;
private DrmManagerClient mDrmManagerClient = null;
@@ -735,6 +727,7 @@ public class MediaScanner
map.put(Audio.Media.ALBUM, (mAlbum != null && mAlbum.length() > 0) ?
mAlbum : MediaStore.UNKNOWN_STRING);
map.put(Audio.Media.COMPOSER, mComposer);
+ map.put(Audio.Media.GENRE, mGenre);
if (mYear != 0) {
map.put(Audio.Media.YEAR, mYear);
}
@@ -894,46 +887,6 @@ public class MediaScanner
values.remove(MediaStore.MediaColumns.DATA);
mMediaProvider.update(result, values, null, null);
}
- if (mProcessGenres && mGenre != null) {
- String genre = mGenre;
- Uri uri = mGenreCache.get(genre);
- if (uri == null) {
- Cursor cursor = null;
- try {
- // see if the genre already exists
- cursor = mMediaProvider.query(
- mGenresUri,
- GENRE_LOOKUP_PROJECTION, MediaStore.Audio.Genres.NAME + "=?",
- new String[] { genre }, null);
- if (cursor == null || cursor.getCount() == 0) {
- // genre does not exist, so create the genre in the genre table
- values = new ContentValues();
- values.put(MediaStore.Audio.Genres.NAME, genre);
- uri = mMediaProvider.insert(mGenresUri, values);
- } else {
- // genre already exists, so compute its Uri
- cursor.moveToNext();
- uri = ContentUris.withAppendedId(mGenresUri, cursor.getLong(0));
- }
- if (uri != null) {
- uri = Uri.withAppendedPath(uri, Genres.Members.CONTENT_DIRECTORY);
- mGenreCache.put(genre, uri);
- }
- } finally {
- // release the cursor if it exists
- if (cursor != null) {
- cursor.close();
- }
- }
- }
-
- if (uri != null) {
- // add entry to audio_genre_map
- values = new ContentValues();
- values.put(MediaStore.Audio.Genres.Members.AUDIO_ID, Long.valueOf(rowId));
- mMediaProvider.insert(uri, values);
- }
- }
if (notifications && !mDefaultNotificationSet) {
if (TextUtils.isEmpty(mDefaultNotificationFilename) ||
@@ -1181,7 +1134,6 @@ public class MediaScanner
pruneDeadThumbnailFiles();
// allow GC to clean up
- mGenreCache = null;
mPlayLists = null;
mFileCache = null;
mMediaProvider = null;
@@ -1199,9 +1151,6 @@ public class MediaScanner
if (!volumeName.equals("internal")) {
// we only support playlists on external media
mProcessPlaylists = true;
- mProcessGenres = true;
- mGenreCache = new HashMap<String, Uri>();
- mGenresUri = Genres.getContentUri(volumeName);
mPlaylistsUri = Playlists.getContentUri(volumeName);
mCaseInsensitivePaths = true;
diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp
index 90d64ba..2578d2d 100644
--- a/media/libstagefright/httplive/LiveSession.cpp
+++ b/media/libstagefright/httplive/LiveSession.cpp
@@ -544,6 +544,7 @@ rinse_repeat:
firstSeqNumberInPlaylist = 0;
}
+ bool seekDiscontinuity = false;
bool explicitDiscontinuity = false;
bool bandwidthChanged = false;
@@ -580,10 +581,10 @@ rinse_repeat:
// reseting the data source will have had the
// side effect of discarding any previously queued
// bandwidth change discontinuity.
- // Therefore we'll need to treat these explicit
+ // Therefore we'll need to treat these seek
// discontinuities as involving a bandwidth change
// even if they aren't directly.
- explicitDiscontinuity = true;
+ seekDiscontinuity = true;
bandwidthChanged = true;
}
}
@@ -597,11 +598,7 @@ rinse_repeat:
}
if (mSeqNumber < 0) {
- if (mPlaylist->isComplete()) {
- mSeqNumber = firstSeqNumberInPlaylist;
- } else {
- mSeqNumber = firstSeqNumberInPlaylist + mPlaylist->size() / 2;
- }
+ mSeqNumber = firstSeqNumberInPlaylist;
}
int32_t lastSeqNumberInPlaylist =
@@ -704,15 +701,17 @@ rinse_repeat:
bandwidthChanged = false;
}
- if (explicitDiscontinuity || bandwidthChanged) {
+ if (seekDiscontinuity || explicitDiscontinuity || bandwidthChanged) {
// Signal discontinuity.
- LOGI("queueing discontinuity (explicit=%d, bandwidthChanged=%d)",
- explicitDiscontinuity, bandwidthChanged);
+ LOGI("queueing discontinuity (seek=%d, explicit=%d, bandwidthChanged=%d)",
+ seekDiscontinuity, explicitDiscontinuity, bandwidthChanged);
sp<ABuffer> tmp = new ABuffer(188);
memset(tmp->data(), 0, tmp->size());
- tmp->data()[1] = bandwidthChanged;
+
+ // signal a 'hard' discontinuity for explicit or bandwidthChanged.
+ tmp->data()[1] = (explicitDiscontinuity || bandwidthChanged) ? 1 : 0;
mDataSource->queueBuffer(tmp);
}