Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
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/. */
7 #include "FFmpegRuntimeLinker.h"
8 #include "FFmpegAACDecoder.h"
9 #include "FFmpegH264Decoder.h"
11 #include "FFmpegDecoderModule.h"
13 namespace mozilla
14 {
16 PRLogModuleInfo* GetFFmpegDecoderLog()
17 {
18 static PRLogModuleInfo* sFFmpegDecoderLog = nullptr;
19 if (!sFFmpegDecoderLog) {
20 sFFmpegDecoderLog = PR_NewLogModule("FFmpegDecoderModule");
21 }
22 return sFFmpegDecoderLog;
23 }
25 bool FFmpegDecoderModule::sFFmpegLinkDone = false;
27 FFmpegDecoderModule::FFmpegDecoderModule()
28 {
29 MOZ_COUNT_CTOR(FFmpegDecoderModule);
30 }
32 FFmpegDecoderModule::~FFmpegDecoderModule() {
33 MOZ_COUNT_DTOR(FFmpegDecoderModule);
34 }
36 bool
37 FFmpegDecoderModule::Link()
38 {
39 if (sFFmpegLinkDone) {
40 return true;
41 }
43 if (!FFmpegRuntimeLinker::Link()) {
44 NS_WARNING("Failed to link FFmpeg shared libraries.");
45 return false;
46 }
48 sFFmpegLinkDone = true;
50 return true;
51 }
53 nsresult
54 FFmpegDecoderModule::Shutdown()
55 {
56 // Nothing to do here.
57 return NS_OK;
58 }
60 MediaDataDecoder*
61 FFmpegDecoderModule::CreateH264Decoder(
62 const mp4_demuxer::VideoDecoderConfig& aConfig,
63 mozilla::layers::LayersBackend aLayersBackend,
64 mozilla::layers::ImageContainer* aImageContainer,
65 MediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback)
66 {
67 FFMPEG_LOG("Creating FFmpeg H264 decoder.");
68 return new FFmpegH264Decoder(aVideoTaskQueue, aCallback, aConfig,
69 aImageContainer);
70 }
72 MediaDataDecoder*
73 FFmpegDecoderModule::CreateAACDecoder(
74 const mp4_demuxer::AudioDecoderConfig& aConfig,
75 MediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback)
76 {
77 FFMPEG_LOG("Creating FFmpeg AAC decoder.");
78 return new FFmpegAACDecoder(aAudioTaskQueue, aCallback, aConfig);
79 }
81 } // namespace mozilla