Skip to content

Commit

Permalink
Bug 1405531 - Remove unused MediaDataDemuxer::HasTrackType - r=jwwang
Browse files Browse the repository at this point in the history
The only actual code use in MediaSourceDemuxer can trivially be folded into
its caller GetNumberTracks in the same class.

MozReview-Commit-ID: E6zh98zmJwJ
  • Loading branch information
squelart committed Oct 4, 2017
1 parent aa3e8d8 commit a30c36f
Show file tree
Hide file tree
Showing 19 changed files with 5 additions and 83 deletions.
6 changes: 0 additions & 6 deletions dom/media/ADTSDemuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,6 @@ ADTSDemuxer::Init()
return InitPromise::CreateAndResolve(NS_OK, __func__);
}

bool
ADTSDemuxer::HasTrackType(TrackInfo::TrackType aType) const
{
return aType == TrackInfo::kAudioTrack;
}

uint32_t
ADTSDemuxer::GetNumberTracks(TrackInfo::TrackType aType) const
{
Expand Down
1 change: 0 additions & 1 deletion dom/media/ADTSDemuxer.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class ADTSDemuxer : public MediaDataDemuxer
// MediaDataDemuxer interface.
explicit ADTSDemuxer(MediaResource* aSource);
RefPtr<InitPromise> Init() override;
bool HasTrackType(TrackInfo::TrackType aType) const override;
uint32_t GetNumberTracks(TrackInfo::TrackType aType) const override;
already_AddRefed<MediaTrackDemuxer>
GetTrackDemuxer(TrackInfo::TrackType aType, uint32_t aTrackNumber) override;
Expand Down
3 changes: 0 additions & 3 deletions dom/media/MediaDataDemuxer.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ class MediaDataDemuxer
// otherwise.
virtual RefPtr<InitPromise> Init() = 0;

// Returns true if a aType track type is available.
virtual bool HasTrackType(TrackInfo::TrackType aType) const = 0;

// Returns the number of tracks of aType type available. A value of
// 0 indicates that no such type is available.
virtual uint32_t GetNumberTracks(TrackInfo::TrackType aType) const = 0;
Expand Down
6 changes: 0 additions & 6 deletions dom/media/flac/FlacDemuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,12 +578,6 @@ FlacDemuxer::Init()
return InitPromise::CreateAndResolve(NS_OK, __func__);
}

bool
FlacDemuxer::HasTrackType(TrackInfo::TrackType aType) const
{
return aType == TrackInfo::kAudioTrack;
}

uint32_t
FlacDemuxer::GetNumberTracks(TrackInfo::TrackType aType) const
{
Expand Down
1 change: 0 additions & 1 deletion dom/media/flac/FlacDemuxer.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class FlacDemuxer : public MediaDataDemuxer
// MediaDataDemuxer interface.
explicit FlacDemuxer(MediaResource* aSource);
RefPtr<InitPromise> Init() override;
bool HasTrackType(TrackInfo::TrackType aType) const override;
uint32_t GetNumberTracks(TrackInfo::TrackType aType) const override;
already_AddRefed<MediaTrackDemuxer> GetTrackDemuxer(
TrackInfo::TrackType aType, uint32_t aTrackNumber) override;
Expand Down
6 changes: 0 additions & 6 deletions dom/media/fmp4/MP4Demuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,6 @@ MP4Demuxer::Init()
return InitPromise::CreateAndResolve(result, __func__);
}

bool
MP4Demuxer::HasTrackType(TrackInfo::TrackType aType) const
{
return GetNumberTracks(aType) != 0;
}

uint32_t
MP4Demuxer::GetNumberTracks(TrackInfo::TrackType aType) const
{
Expand Down
2 changes: 0 additions & 2 deletions dom/media/fmp4/MP4Demuxer.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ class MP4Demuxer : public MediaDataDemuxer

RefPtr<InitPromise> Init() override;

bool HasTrackType(TrackInfo::TrackType aType) const override;

uint32_t GetNumberTracks(TrackInfo::TrackType aType) const override;

already_AddRefed<MediaTrackDemuxer>
Expand Down
13 changes: 0 additions & 13 deletions dom/media/hls/HLSDemuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,19 +184,6 @@ void HLSDemuxer::NotifyDataArrived()
HLS_DEBUG("HLSDemuxer", "NotifyDataArrived");
}

bool
HLSDemuxer::HasTrackType(TrackType aType) const
{
HLS_DEBUG("HLSDemuxer", "HasTrackType(%d)", aType);
if (mAudioDemuxer && aType == TrackType::kAudioTrack) {
return mAudioDemuxer->IsTrackValid();
}
if (mVideoDemuxer && aType == TrackType::kVideoTrack) {
return mVideoDemuxer->IsTrackValid();
}
return false;
}

uint32_t
HLSDemuxer::GetNumberTracks(TrackType aType) const
{
Expand Down
2 changes: 0 additions & 2 deletions dom/media/hls/HLSDemuxer.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ class HLSDemuxer final : public MediaDataDemuxer

RefPtr<InitPromise> Init() override;

bool HasTrackType(TrackInfo::TrackType aType) const override;

uint32_t GetNumberTracks(TrackInfo::TrackType aType) const override;

already_AddRefed<MediaTrackDemuxer>
Expand Down
16 changes: 5 additions & 11 deletions dom/media/mediasource/MediaSourceDemuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,27 +117,21 @@ MediaSourceDemuxer::ScanSourceBuffersForContent()
return !haveEmptySourceBuffer;
}

bool
MediaSourceDemuxer::HasTrackType(TrackType aType) const
uint32_t
MediaSourceDemuxer::GetNumberTracks(TrackType aType) const
{
MonitorAutoLock mon(mMonitor);

switch (aType) {
case TrackType::kAudioTrack:
return mInfo.HasAudio();
return mInfo.HasAudio() ? 1u : 0;
case TrackType::kVideoTrack:
return mInfo.HasVideo();
return mInfo.HasVideo() ? 1u : 0;
default:
return false;
return 0;
}
}

uint32_t
MediaSourceDemuxer::GetNumberTracks(TrackType aType) const
{
return HasTrackType(aType) ? 1u : 0;
}

already_AddRefed<MediaTrackDemuxer>
MediaSourceDemuxer::GetTrackDemuxer(TrackType aType, uint32_t aTrackNumber)
{
Expand Down
2 changes: 0 additions & 2 deletions dom/media/mediasource/MediaSourceDemuxer.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ class MediaSourceDemuxer : public MediaDataDemuxer

RefPtr<InitPromise> Init() override;

bool HasTrackType(TrackInfo::TrackType aType) const override;

uint32_t GetNumberTracks(TrackInfo::TrackType aType) const override;

already_AddRefed<MediaTrackDemuxer>
Expand Down
6 changes: 0 additions & 6 deletions dom/media/mp3/MP3Demuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ MP3Demuxer::Init()
return InitPromise::CreateAndResolve(NS_OK, __func__);
}

bool
MP3Demuxer::HasTrackType(TrackInfo::TrackType aType) const
{
return aType == TrackInfo::kAudioTrack;
}

uint32_t
MP3Demuxer::GetNumberTracks(TrackInfo::TrackType aType) const
{
Expand Down
1 change: 0 additions & 1 deletion dom/media/mp3/MP3Demuxer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class MP3Demuxer : public MediaDataDemuxer
// MediaDataDemuxer interface.
explicit MP3Demuxer(MediaResource* aSource);
RefPtr<InitPromise> Init() override;
bool HasTrackType(TrackInfo::TrackType aType) const override;
uint32_t GetNumberTracks(TrackInfo::TrackType aType) const override;
already_AddRefed<MediaTrackDemuxer> GetTrackDemuxer(
TrackInfo::TrackType aType, uint32_t aTrackNumber) override;
Expand Down
6 changes: 0 additions & 6 deletions dom/media/ogg/OggDemuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,6 @@ OggDemuxer::Init()
return InitPromise::CreateAndResolve(NS_OK, __func__);
}

bool
OggDemuxer::HasTrackType(TrackInfo::TrackType aType) const
{
return !!GetNumberTracks(aType);
}

OggCodecState*
OggDemuxer::GetTrackCodecState(TrackInfo::TrackType aType) const
{
Expand Down
2 changes: 0 additions & 2 deletions dom/media/ogg/OggDemuxer.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ class OggDemuxer : public MediaDataDemuxer

RefPtr<InitPromise> Init() override;

bool HasTrackType(TrackInfo::TrackType aType) const override;

uint32_t GetNumberTracks(TrackInfo::TrackType aType) const override;

already_AddRefed<MediaTrackDemuxer> GetTrackDemuxer(TrackInfo::TrackType aType,
Expand Down
6 changes: 0 additions & 6 deletions dom/media/wave/WaveDemuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ WAVDemuxer::Init()
return InitPromise::CreateAndResolve(NS_OK, __func__);
}

bool
WAVDemuxer::HasTrackType(TrackInfo::TrackType aType) const
{
return aType == TrackInfo::kAudioTrack;
}

uint32_t
WAVDemuxer::GetNumberTracks(TrackInfo::TrackType aType) const
{
Expand Down
1 change: 0 additions & 1 deletion dom/media/wave/WaveDemuxer.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class WAVDemuxer : public MediaDataDemuxer
// MediaDataDemuxer interface.
explicit WAVDemuxer(MediaResource* aSource);
RefPtr<InitPromise> Init() override;
bool HasTrackType(TrackInfo::TrackType aType) const override;
uint32_t GetNumberTracks(TrackInfo::TrackType aType) const override;
already_AddRefed<MediaTrackDemuxer> GetTrackDemuxer(
TrackInfo::TrackType aType, uint32_t aTrackNumber) override;
Expand Down
6 changes: 0 additions & 6 deletions dom/media/webm/WebMDemuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,6 @@ WebMDemuxer::InitBufferedState()
mBufferedState = new WebMBufferedState;
}

bool
WebMDemuxer::HasTrackType(TrackInfo::TrackType aType) const
{
return !!GetNumberTracks(aType);
}

uint32_t
WebMDemuxer::GetNumberTracks(TrackInfo::TrackType aType) const
{
Expand Down
2 changes: 0 additions & 2 deletions dom/media/webm/WebMDemuxer.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@ class WebMDemuxer : public MediaDataDemuxer

RefPtr<InitPromise> Init() override;

bool HasTrackType(TrackInfo::TrackType aType) const override;

uint32_t GetNumberTracks(TrackInfo::TrackType aType) const override;

UniquePtr<TrackInfo> GetTrackInfo(TrackInfo::TrackType aType,
Expand Down

0 comments on commit a30c36f

Please sign in to comment.