Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/media/ADTSDecoder.cpp
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#include "ADTSDecoder.h"
8
#include "MediaContainerType.h"
9
#include "PDMFactory.h"
10
11
namespace mozilla {
12
13
/* static */ bool
14
ADTSDecoder::IsEnabled()
15
0
{
16
0
  RefPtr<PDMFactory> platform = new PDMFactory();
17
0
  return platform->SupportsMimeType(NS_LITERAL_CSTRING("audio/mp4a-latm"),
18
0
                                    /* DecoderDoctorDiagnostics* */ nullptr);
19
0
}
20
21
/* static */ bool
22
ADTSDecoder::IsSupportedType(const MediaContainerType& aContainerType)
23
0
{
24
0
  if (aContainerType.Type() == MEDIAMIMETYPE("audio/aac") ||
25
0
      aContainerType.Type() == MEDIAMIMETYPE("audio/aacp") ||
26
0
      aContainerType.Type() == MEDIAMIMETYPE("audio/x-aac")) {
27
0
    return IsEnabled() && (aContainerType.ExtendedType().Codecs().IsEmpty() ||
28
0
                           aContainerType.ExtendedType().Codecs() == "aac");
29
0
  }
30
0
31
0
  return false;
32
0
}
33
34
/* static */ nsTArray<UniquePtr<TrackInfo>>
35
ADTSDecoder::GetTracksInfo(const MediaContainerType& aType)
36
0
{
37
0
  nsTArray<UniquePtr<TrackInfo>> tracks;
38
0
  if (!IsSupportedType(aType)) {
39
0
    return tracks;
40
0
  }
41
0
42
0
  tracks.AppendElement(
43
0
    CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
44
0
      NS_LITERAL_CSTRING("audio/mp4a-latm"), aType));
45
0
46
0
  return tracks;
47
0
}
48
49
} // namespace mozilla