-
Notifications
You must be signed in to change notification settings - Fork 425
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
refactor: remove duplicate bufferIntersection code #880
Conversation
@@ -4,7 +4,7 @@ | |||
import videojs from 'video.js'; | |||
import logger from './util/logger'; | |||
import noop from './util/noop'; | |||
import { buffered } from './util/buffer'; | |||
import { bufferIntersection } from './ranges.js'; |
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.
Use the one in ranges
@@ -322,7 +322,15 @@ export default class SourceUpdater extends videojs.EventTarget { | |||
} | |||
|
|||
buffered() { | |||
return buffered(this.videoBuffer, this.audioBuffer); | |||
if (this.audioBuffer && !this.videoBuffer) { |
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.
The only unique functionality in that file what using audio or video buffered, if we only had a buffer for one or the other.
90a856c
to
9a18a20
Compare
|
||
QUnit.module('buffer'); | ||
|
||
QUnit.test('buffered returns video buffered when no audio', function(assert) { |
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.
First two tests here moved to sourceUpdater
, the rest moved to ranges
.
9a18a20
to
b6df38b
Compare
@@ -4,7 +4,7 @@ | |||
import videojs from 'video.js'; | |||
import logger from './util/logger'; | |||
import noop from './util/noop'; | |||
import { buffered } from './util/buffer'; |
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.
sounds like we can delete buffer.js?
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.
woops, removing
No functional change here. This refactor removes
util/buffer
the nearly identical function inranges.js
. While trying to find out why we sometimes download duplicate segments I cam upon a solution that usedbufferIntersection
. Thats when I noticed that these functions are doing the same thing, andutil/buffer
is just a copy paste.