Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a335c964
authored
Dec 14, 2020
by
bachinger
Committed by
Christos Tsilopoulos
Dec 17, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Deprecate HttpDataSource.Factory.getDefaultRequestProperties
#exofixit PiperOrigin-RevId: 347375323
parent
5aac1898
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
59 deletions
RELEASENOTES.md
extensions/cronet/src/main/java/com/google/android/exoplayer2/ext/cronet/CronetDataSourceFactory.java
library/common/src/main/java/com/google/android/exoplayer2/upstream/DataSpec.java
library/common/src/main/java/com/google/android/exoplayer2/upstream/HttpDataSource.java
RELEASENOTES.md
View file @
a335c964
...
...
@@ -23,6 +23,8 @@
been handled and the values reported through callbacks are again
completely consistent with the values obtained from the
`Player`
getters.
*
Deprecate
`HttpDataSource.Factory.getDefaultRequestProperties`
and add
`HttpDataSource.Factory.setDefaultRequestProperties`
instead.
*
Track selection:
*
Add option to specify multiple preferred audio or text languages.
*
Forward
`Timeline`
and
`MediaPeriodId`
to
`TrackSelection.Factory`
.
...
...
extensions/cronet/src/main/java/com/google/android/exoplayer2/ext/cronet/CronetDataSourceFactory.java
View file @
a335c964
...
...
@@ -343,7 +343,7 @@ public final class CronetDataSourceFactory extends BaseFactory {
@Override
protected
HttpDataSource
createDataSourceInternal
(
HttpDataSource
.
RequestProperties
defaultRequestProperties
)
{
CronetEngine
cronetEngine
=
cronetEngineWrapper
.
getCronetEngine
();
@Nullable
CronetEngine
cronetEngine
=
cronetEngineWrapper
.
getCronetEngine
();
if
(
cronetEngine
==
null
)
{
return
fallbackFactory
.
createDataSource
();
}
...
...
library/common/src/main/java/com/google/android/exoplayer2/upstream/DataSpec.java
View file @
a335c964
...
...
@@ -343,8 +343,7 @@ public final class DataSpec {
* header directly.
* <li>Other headers set at the {@link HttpDataSource} layer. I.e., headers set using {@link
* HttpDataSource#setRequestProperty(String, String)}, and using {@link
* HttpDataSource.RequestProperties#set(String, String)} on the default properties obtained
* from {@link HttpDataSource.Factory#getDefaultRequestProperties()}.
* HttpDataSource.Factory#setDefaultRequestProperties(Map)}.
* </ul>
*/
public
final
Map
<
String
,
String
>
httpRequestHeaders
;
...
...
library/common/src/main/java/com/google/android/exoplayer2/upstream/HttpDataSource.java
View file @
a335c964
...
...
@@ -42,43 +42,23 @@ public interface HttpDataSource extends DataSource {
@Override
HttpDataSource
createDataSource
();
/**
* Gets the default request properties used by all {@link HttpDataSource}s created by the
* factory. Changes to the properties will be reflected in any future requests made by
* {@link HttpDataSource}s created by the factory.
*
* @return The default request properties of the factory.
*/
RequestProperties
getDefaultRequestProperties
();
/**
* Sets a default request header for {@link HttpDataSource} instances created by the factory.
*
* @deprecated Use {@link #getDefaultRequestProperties} instead.
* @param name The name of the header field.
* @param value The value of the field.
*/
/** @deprecated Use {@link #setDefaultRequestProperties(Map)} instead. */
@Deprecated
void
setDefaultRequestProperty
(
String
name
,
String
value
);
RequestProperties
getDefaultRequestProperties
(
);
/**
*
Clears a default request header
for {@link HttpDataSource} instances created by the factory.
*
Sets the default request headers
for {@link HttpDataSource} instances created by the factory.
*
* @deprecated Use {@link #getDefaultRequestProperties} instead.
* @param name The name of the header field.
*/
@Deprecated
void
clearDefaultRequestProperty
(
String
name
);
/**
* Clears all default request headers for all {@link HttpDataSource} instances created by the
* factory.
* <p>The new request properties will be used for future requests made by {@link HttpDataSource
* HttpDataSources} created by the factory, including instances that have already been created.
* Modifying the {@code defaultRequestProperties} map after a call to this method will have no
* effect, and so it's necessary to call this method again each time the request properties need
* to be updated.
*
* @deprecated Use {@link #getDefaultRequestProperties} instead.
* @param defaultRequestProperties The default request properties.
* @return This factory.
*/
@Deprecated
void
clearAllDefaultRequestProperties
();
Factory
setDefaultRequestProperties
(
Map
<
String
,
String
>
defaultRequestProperties
);
}
/**
...
...
@@ -159,12 +139,9 @@ public interface HttpDataSource extends DataSource {
}
return
requestPropertiesSnapshot
;
}
}
/**
* Base implementation of {@link Factory} that sets default request properties.
*/
/** Base implementation of {@link Factory} that sets default request properties. */
abstract
class
BaseFactory
implements
Factory
{
private
final
RequestProperties
defaultRequestProperties
;
...
...
@@ -178,30 +155,17 @@ public interface HttpDataSource extends DataSource {
return
createDataSourceInternal
(
defaultRequestProperties
);
}
/** @deprecated Use {@link #setDefaultRequestProperties(Map)} instead. */
@Deprecated
@Override
public
final
RequestProperties
getDefaultRequestProperties
()
{
return
defaultRequestProperties
;
}
/** @deprecated Use {@link #getDefaultRequestProperties} instead. */
@Deprecated
@Override
public
final
void
setDefaultRequestProperty
(
String
name
,
String
value
)
{
defaultRequestProperties
.
set
(
name
,
value
);
}
/** @deprecated Use {@link #getDefaultRequestProperties} instead. */
@Deprecated
@Override
public
final
void
clearDefaultRequestProperty
(
String
name
)
{
defaultRequestProperties
.
remove
(
name
);
}
/** @deprecated Use {@link #getDefaultRequestProperties} instead. */
@Deprecated
@Override
public
final
void
clearAllDefaultRequestProperties
()
{
defaultRequestProperties
.
clear
();
public
final
Factory
setDefaultRequestProperties
(
Map
<
String
,
String
>
defaultRequestProperties
)
{
this
.
defaultRequestProperties
.
clearAndSet
(
defaultRequestProperties
);
return
this
;
}
/**
...
...
@@ -211,9 +175,8 @@ public interface HttpDataSource extends DataSource {
* {@link HttpDataSource} instance.
* @return A {@link HttpDataSource} instance.
*/
protected
abstract
HttpDataSource
createDataSourceInternal
(
RequestProperties
defaultRequestProperties
);
protected
abstract
HttpDataSource
createDataSourceInternal
(
RequestProperties
defaultRequestProperties
);
}
/** A {@link Predicate} that rejects content types often used for pay-walls. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment