Conversation
Change-Id: Idcc6dcb62172b71465c30d8396b8a20533cc47b6
claincly
left a comment
There was a problem hiding this comment.
Some refactoring comments. Please refer to the RtpAmrReaderTest for the style that we prefer, thanks!
| private RtpVp9Reader vp9Reader; | ||
| private FakeTrackOutput trackOutput; | ||
| @Mock | ||
| private ExtractorOutput extractorOutput; |
There was a problem hiding this comment.
There's no need to mock ExtractorOutput, you can use FakeExtractorOutput.
|
|
||
| private ParsableByteArray packetData; | ||
|
|
||
| private RtpVp9Reader vp9Reader; |
There was a problem hiding this comment.
I don't think there's a need to keep the vp9Reader as a field, you can just instantiate one in each test. Having it as a test creates the illusion that there's shared state.
See also my comment about the consume method.
| assertThat(trackOutput.getSampleTimeUs(1)).isEqualTo(3200); | ||
| } | ||
|
|
||
| private static RtpPacket createRtpPacket( |
There was a problem hiding this comment.
It's unnecessary to wrap a class that already has a Builder in a method with many parameters, no? Please consider removing this method.
| } | ||
|
|
||
| private void consume(RtpPacket rtpPacket) { | ||
| packetData.reset(rtpPacket.payloadData); |
There was a problem hiding this comment.
Can you make this method into static, and it takes a vp9Reader as parameter? You can also just create a new ParsablyByteArray every time this method is called.
This way you can eliminate the need for vp9Reader and packetData as field.
| /* timestamp= */ 2599168056L, | ||
| /* sequenceNumber= */ 40289, | ||
| /* marker= */ false, | ||
| /* payloadData= */ getBytesFromHexString("08000102030405060708090A")); |
There was a problem hiding this comment.
Can you extend this into something like this for better readability?
byte[] frame1Fragment1Data = getBytesFromHexString("000102...");
RtpPacket frame1fragment1 = new RtpPacket.Builder().
// ...other setters
.setPayloadData(Bytes.concat(
// header
getBytesFromHexString("0800"),
frame1Fragment1Data))
.build();
byte[] frame1Data = Bytes.concat(frame1Fragment1Data, frame1Fragment2Data);
| @RunWith(AndroidJUnit4.class) | ||
| public final class RtpVp9ReaderTest { | ||
|
|
||
| private final RtpPacket frame1fragment1 = |
There was a problem hiding this comment.
The f in fragment should be in upper case.
There was a problem hiding this comment.
My bad, the names should be FRAME_1_FRAGMENT_1, and please make these fields static final too, thanks!
|
NVM, I'll merge this one with #115 and change the styles. |
|
@claincly , apologies for the delay, the changes were in internal review. We have added the changes in our branch. You can take a look here: ittiam-systems@a7adf75 |
|
No worries, thanks for making the change. |
Change-Id: Idcc6dcb62172b71465c30d8396b8a20533cc47b6