-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rtmp client #2503
Rtmp client #2503
Conversation
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the pull request. I think it needs splitting in two (one request for the FLV changes, and another for the RTMP feature). Please also see inline comments. Thanks!
demo/build.gradle
Outdated
@@ -45,4 +45,5 @@ dependencies { | |||
withExtensionsCompile project(path: ':extension-flac') | |||
withExtensionsCompile project(path: ':extension-opus') | |||
withExtensionsCompile project(path: ':extension-vp9') | |||
compile 'net.butterflytv.utils:rtmp-client:0.2.6.1' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want this dependency from the demo app. For all other cases where we've taken an external dependency, we've done so by creating an extension (see the six existing extensions here).
If you restructure this change so that RtmpDataSource
is in a proper extension then we'll consider accepting a pull request. We probably don't want any samples in the demo app by default.
@@ -0,0 +1,55 @@ | |||
package com.google.android.exoplayer2.demo.player; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to put the standard header present in other ExoPlayer source files at the top here
import java.io.IOException; | ||
|
||
/** | ||
* Created by faraklit on 08.01.2016. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs proper Javadoc
public class RtmpDataSource implements DataSource { | ||
|
||
|
||
private final RtmpClient rtmpClient; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use 2 character indentation as in other ExoPlayer source files
|
||
@Override | ||
public Uri getUri() { | ||
return uri; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. This is always null? I think it needs setting in open
and clearing in close
?
durationUs = (long) (durationSeconds * C.MICROS_PER_SECOND); | ||
// if (type != AMF_TYPE_ECMA_ARRAY) { | ||
// // Should never happen. | ||
// //aom: actually it can happen for live streams |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please delete the code block if that's the case
@@ -215,4 +244,19 @@ private static Object readAmfData(ParsableByteArray data, int type) { | |||
} | |||
} | |||
|
|||
public void setKeyFrameTimes(List<Double> keyFrameTimes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unclear why you need these setter methods. Why can't you just assign the variables directly?
int count = data.readUnsignedIntToInt(); | ||
HashMap<String, Object> array = new HashMap<>(count); | ||
for (int i = 0; i < count; i++) { | ||
//ecma array is not the strict array, so it shouldn't be trusted number of item count |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than this comment, it would probably be clearer to do:
int approximateCount = data.readUnsignedIntToInt();
It's probably still worth passing the value to the HashMap constructor as an initial size as well, as was previously the case.
this.keyFrameFilePositions = keyFrameFilePositions; | ||
} | ||
|
||
public List<Double> getKeyFrameFilePositions() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if these getters were moved to be next to the getDurationUs.
} | ||
if (metadata.containsKey(KEY_FRAMES)) { | ||
HashMap<String, List<Double>> keyFrames = (HashMap<String, List<Double>>) metadata.get(KEY_FRAMES); | ||
setKeyFrameTimes(keyFrames.get(KEY_FRAME_TIMES)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be nice to convert the values into long microsecond and byte offset arrays here, rather than keeping them as doubles. That way the public getter methods, for time at least, are all in the same unit (i.e. microseconds).
@b95505017 - Do you have any plans to split this request, address the comments and sign the CLA? Else I'll go ahead and close this. There's definitely nothing we can do with it without the CLA being signed, and I'd rather not leave it open indefinitely. |
I've signed the CLA already, but @mekya. He is the main author about those commits, I just made them rebase v2. |
I have signed CLA and I am going to try to fix the issues in your( @ojw28 ) comments in a week. I am sorry I am busy in these days. Btw, Thank you @b95505017 |
CLAs look good, thanks! |
@ojw28 I refactor everything, please take a look again thanks! |
This is looking much better now; thanks! I have some concerns about the underlying library being used. I've filed a couple of issues on that library directly. If you're able to help with, or comment on, those issues directly, that might help speed things up! The issues are: ant-media/LibRtmp-Client-for-Android#32 |
Actually the best choice of rtmp client is using the pure java Socket version instead of librtmp I think, but the concept will be based on SimpleRtmp which may hit the copyright. The pure java Socket version will be more extendable and have more control about the rtmp behavior including redirect behavior. Not sure what is the best choice for ExoPlayer project. |
If there's a pure Java RTMP library available somewhere under a sensible license, that's distributed via jcenter, then it's fine to depend on that instead. I'd rather not implement the whole thing inside the extension if possible; having a dependency is preferable. If the whole thing is implemented inside the extension then it needs to be original work, not copy/paste or derivative of some other project, as per the CLA. |
I got this working reasonably well, but I found another issue (ant-media/LibRtmp-Client-for-Android#33). I think we'll probably need the issues we've raised to be fixed in LibRtmp before we're able to merge this. Alternatively, we could depend on a different project if there's a better alternative. |
That's weird, they claim have all ABIs.
|
@b95505017 @ojw28 In addition, before I develop this library, I googled a RTMP Java library. I found some libraries however they were complex and their sizes are a few MBs. |
@mekya - Thanks for the improvements so far! There are a couple of remaining issues (mostly minor things at this point, but now might be a good time to make those tweaks if you agree they're good ideas). Once we have those + a release with the 64bit variants, I think we should be good to go ahead and merge an updated version of this change. |
@ojw28 yeah I agree with you, I think it is the right time to make these minor changes as well. is it ok? Any other issue? Bests, |
I don't think I have any other suggestions, no. Thanks! |
@mekya - Do you have any kind of time estimate for the remaining changes + an updated release? No worries if not; just curious :). |
Ping @mekya :). |
We still have one open issue on LibRtmp here, which is affecting the minimum sdk version we can set for the extension to 21 (not particularly useful). Tracked by ant-media/LibRtmp-Client-for-Android#39. That said, I think we can merge + cleanup at this point. |
RTMP DataSource extension