summaryrefslogtreecommitdiff
path: root/chromium/media/tools
diff options
context:
space:
mode:
authorAndras Becsi <andras.becsi@digia.com>2014-03-18 13:16:26 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-03-20 15:55:39 +0100
commit3f0f86b0caed75241fa71c95a5d73bc0164348c5 (patch)
tree92b9fb00f2e9e90b0be2262093876d4f43b6cd13 /chromium/media/tools
parente90d7c4b152c56919d963987e2503f9909a666d2 (diff)
downloadqtwebengine-chromium-3f0f86b0caed75241fa71c95a5d73bc0164348c5.tar.gz
Update to new stable branch 1750
This also includes an updated ninja and chromium dependencies needed on Windows. Change-Id: Icd597d80ed3fa4425933c9f1334c3c2e31291c42 Reviewed-by: Zoltan Arvai <zarvai@inf.u-szeged.hu> Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Diffstat (limited to 'chromium/media/tools')
-rw-r--r--chromium/media/tools/demuxer_bench/demuxer_bench.cc240
-rw-r--r--chromium/media/tools/layout_tests/layouttest_analyzer_helpers.py4
-rw-r--r--chromium/media/tools/player_x11/gl_video_renderer.cc10
-rw-r--r--chromium/media/tools/player_x11/player_x11.cc10
-rw-r--r--chromium/media/tools/player_x11/x11_video_renderer.cc6
5 files changed, 11 insertions, 259 deletions
diff --git a/chromium/media/tools/demuxer_bench/demuxer_bench.cc b/chromium/media/tools/demuxer_bench/demuxer_bench.cc
deleted file mode 100644
index ab8b313c435..00000000000
--- a/chromium/media/tools/demuxer_bench/demuxer_bench.cc
+++ /dev/null
@@ -1,240 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// demuxer_bench is a standalone benchmarking tool for FFmpegDemuxer. It
-// simulates the reading requirements for playback by reading from the stream
-// that has the earliest timestamp.
-
-#include <iostream>
-
-#include "base/at_exit.h"
-#include "base/bind.h"
-#include "base/command_line.h"
-#include "base/logging.h"
-#include "base/message_loop/message_loop.h"
-#include "base/strings/string_number_conversions.h"
-#include "media/base/media.h"
-#include "media/base/media_log.h"
-#include "media/filters/ffmpeg_demuxer.h"
-#include "media/filters/file_data_source.h"
-
-namespace switches {
-const char kEnableBitstreamConverter[] = "enable-bitstream-converter";
-} // namespace switches
-
-class DemuxerHostImpl : public media::DemuxerHost {
- public:
- DemuxerHostImpl() {}
- virtual ~DemuxerHostImpl() {}
-
- // DataSourceHost implementation.
- virtual void SetTotalBytes(int64 total_bytes) OVERRIDE {}
- virtual void AddBufferedByteRange(int64 start, int64 end) OVERRIDE {}
- virtual void AddBufferedTimeRange(base::TimeDelta start,
- base::TimeDelta end) OVERRIDE {}
-
- // DemuxerHost implementation.
- virtual void SetDuration(base::TimeDelta duration) OVERRIDE {}
- virtual void OnDemuxerError(media::PipelineStatus error) OVERRIDE {}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(DemuxerHostImpl);
-};
-
-void QuitLoopWithStatus(base::MessageLoop* message_loop,
- media::PipelineStatus status) {
- CHECK_EQ(status, media::PIPELINE_OK);
- message_loop->PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
-}
-
-static void NeedKey(const std::string& type,
- const std::vector<uint8>& init_data) {
- LOG(INFO) << "File is encrypted.";
-}
-
-typedef std::vector<media::DemuxerStream* > Streams;
-
-// Simulates playback reading requirements by reading from each stream
-// present in |demuxer| in as-close-to-monotonically-increasing timestamp order.
-class StreamReader {
- public:
- StreamReader(media::Demuxer* demuxer, bool enable_bitstream_converter);
- ~StreamReader();
-
- // Performs a single step read.
- void Read();
-
- // Returns true when all streams have reached end of stream.
- bool IsDone();
-
- int number_of_streams() { return streams_.size(); }
- const Streams& streams() { return streams_; }
- const std::vector<int>& counts() { return counts_; }
-
- private:
- void OnReadDone(base::MessageLoop* message_loop,
- bool* end_of_stream,
- base::TimeDelta* timestamp,
- media::DemuxerStream::Status status,
- const scoped_refptr<media::DecoderBuffer>& buffer);
- int GetNextStreamIndexToRead();
-
- Streams streams_;
- std::vector<bool> end_of_stream_;
- std::vector<base::TimeDelta> last_read_timestamp_;
- std::vector<int> counts_;
-
- DISALLOW_COPY_AND_ASSIGN(StreamReader);
-};
-
-StreamReader::StreamReader(media::Demuxer* demuxer,
- bool enable_bitstream_converter) {
- media::DemuxerStream* stream =
- demuxer->GetStream(media::DemuxerStream::AUDIO);
- if (stream) {
- streams_.push_back(stream);
- end_of_stream_.push_back(false);
- last_read_timestamp_.push_back(media::kNoTimestamp());
- counts_.push_back(0);
- }
-
- stream = demuxer->GetStream(media::DemuxerStream::VIDEO);
- if (stream) {
- streams_.push_back(stream);
- end_of_stream_.push_back(false);
- last_read_timestamp_.push_back(media::kNoTimestamp());
- counts_.push_back(0);
-
- if (enable_bitstream_converter)
- stream->EnableBitstreamConverter();
- }
-}
-
-StreamReader::~StreamReader() {}
-
-void StreamReader::Read() {
- int index = GetNextStreamIndexToRead();
- bool end_of_stream = false;
- base::TimeDelta timestamp;
-
- streams_[index]->Read(base::Bind(
- &StreamReader::OnReadDone, base::Unretained(this),
- base::MessageLoop::current(), &end_of_stream, &timestamp));
- base::MessageLoop::current()->Run();
-
- CHECK(end_of_stream || timestamp != media::kNoTimestamp());
- end_of_stream_[index] = end_of_stream;
- last_read_timestamp_[index] = timestamp;
- counts_[index]++;
-}
-
-bool StreamReader::IsDone() {
- for (size_t i = 0; i < end_of_stream_.size(); ++i) {
- if (!end_of_stream_[i])
- return false;
- }
- return true;
-}
-
-void StreamReader::OnReadDone(
- base::MessageLoop* message_loop,
- bool* end_of_stream,
- base::TimeDelta* timestamp,
- media::DemuxerStream::Status status,
- const scoped_refptr<media::DecoderBuffer>& buffer) {
- CHECK_EQ(status, media::DemuxerStream::kOk);
- CHECK(buffer.get());
- *end_of_stream = buffer->end_of_stream();
- *timestamp = *end_of_stream ? media::kNoTimestamp() : buffer->timestamp();
- message_loop->PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
-}
-
-int StreamReader::GetNextStreamIndexToRead() {
- int index = -1;
- for (int i = 0; i < number_of_streams(); ++i) {
- // Ignore streams at EOS.
- if (end_of_stream_[i])
- continue;
-
- // Use a stream if it hasn't been read from yet.
- if (last_read_timestamp_[i] == media::kNoTimestamp())
- return i;
-
- if (index < 0 ||
- last_read_timestamp_[i] < last_read_timestamp_[index]) {
- index = i;
- }
- }
- CHECK_GE(index, 0) << "Couldn't find a stream to read";
- return index;
-}
-
-int main(int argc, char** argv) {
- base::AtExitManager at_exit;
- media::InitializeMediaLibraryForTesting();
-
- CommandLine::Init(argc, argv);
- CommandLine* cmd_line = CommandLine::ForCurrentProcess();
-
- if (cmd_line->GetArgs().empty()) {
- std::cerr << "Usage: " << argv[0] << " [file]\n\n"
- << "Options:\n"
- << " --" << switches::kEnableBitstreamConverter
- << " Enables H.264 Annex B bitstream conversion"
- << std::endl;
- return 1;
- }
-
- base::MessageLoop message_loop;
- DemuxerHostImpl demuxer_host;
- base::FilePath file_path(cmd_line->GetArgs()[0]);
-
- // Setup.
- media::FileDataSource data_source;
- CHECK(data_source.Initialize(file_path));
-
- media::Demuxer::NeedKeyCB need_key_cb = base::Bind(&NeedKey);
- media::FFmpegDemuxer demuxer(message_loop.message_loop_proxy(),
- &data_source,
- need_key_cb,
- new media::MediaLog());
-
- demuxer.Initialize(&demuxer_host, base::Bind(
- &QuitLoopWithStatus, &message_loop));
- message_loop.Run();
-
- StreamReader stream_reader(
- &demuxer, cmd_line->HasSwitch(switches::kEnableBitstreamConverter));
-
- // Benchmark.
- base::TimeTicks start = base::TimeTicks::HighResNow();
- while (!stream_reader.IsDone()) {
- stream_reader.Read();
- }
- base::TimeTicks end = base::TimeTicks::HighResNow();
-
- // Results.
- std::cout << "Time: " << (end - start).InMillisecondsF() << " ms\n";
- for (int i = 0; i < stream_reader.number_of_streams(); ++i) {
- media::DemuxerStream* stream = stream_reader.streams()[i];
- std::cout << "Stream #" << i << ": ";
-
- if (stream->type() == media::DemuxerStream::AUDIO) {
- std::cout << "audio";
- } else if (stream->type() == media::DemuxerStream::VIDEO) {
- std::cout << "video";
- } else {
- std::cout << "unknown";
- }
-
- std::cout << ", " << stream_reader.counts()[i] << " packets" << std::endl;
- }
-
- // Teardown.
- demuxer.Stop(base::Bind(
- &QuitLoopWithStatus, &message_loop, media::PIPELINE_OK));
- message_loop.Run();
-
- return 0;
-}
diff --git a/chromium/media/tools/layout_tests/layouttest_analyzer_helpers.py b/chromium/media/tools/layout_tests/layouttest_analyzer_helpers.py
index 2eb3c158789..e5791bc62a6 100644
--- a/chromium/media/tools/layout_tests/layouttest_analyzer_helpers.py
+++ b/chromium/media/tools/layout_tests/layouttest_analyzer_helpers.py
@@ -150,7 +150,7 @@ class AnalyzerResultMap:
if delta <= 0:
raise ValueError('The number of tests in test group "whole" is equal or '
'less than that of "skip"')
- return 100 - len(self.result_map['nonskip'].keys()) * 100 / delta
+ return 100 - len(self.result_map['nonskip'].keys()) * 100.0 / delta
def ConvertToCSVText(self, current_time):
"""Convert |self.result_map| into stats and issues text in CSV format.
@@ -214,7 +214,7 @@ class AnalyzerResultMap:
'<li>The number of tests: %d (%s)</li>'
'<li>The number of failing skipped tests: %d (%s)</li>'
'<li>The number of failing non-skipped tests: %d (%s)</li>'
- '<li>Passing rate: %d %%</li></ul>') % (
+ '<li>Passing rate: %.2f %%</li></ul>') % (
prev_time, len(self.result_map['whole'].keys()),
AnalyzerResultMap.GetDiffString(diff_map['whole'], 'whole'),
len(self.result_map['skip'].keys()),
diff --git a/chromium/media/tools/player_x11/gl_video_renderer.cc b/chromium/media/tools/player_x11/gl_video_renderer.cc
index 9e508087a0c..3966d81afaf 100644
--- a/chromium/media/tools/player_x11/gl_video_renderer.cc
+++ b/chromium/media/tools/player_x11/gl_video_renderer.cc
@@ -67,14 +67,6 @@ static const float kVertices[8] = {
1.f, -1.f,
};
-// Texture Coordinates mapping the entire texture.
-static const float kTextureCoords[8] = {
- 0, 0,
- 0, 1,
- 1, 0,
- 1, 1,
-};
-
// Pass-through vertex shader.
static const char kVertexShader[] =
"varying vec2 interp_tc;\n"
@@ -148,7 +140,7 @@ void GlVideoRenderer::Paint(media::VideoFrame* video_frame) {
void GlVideoRenderer::Initialize(gfx::Size coded_size, gfx::Rect visible_rect) {
CHECK(!gl_context_);
- LOG(INFO) << "Initializing GL Renderer...";
+ VLOG(0) << "Initializing GL Renderer...";
// Resize the window to fit that of the video.
XResizeWindow(display_, window_, visible_rect.width(), visible_rect.height());
diff --git a/chromium/media/tools/player_x11/player_x11.cc b/chromium/media/tools/player_x11/player_x11.cc
index c154e6937e2..fe3beec5a8b 100644
--- a/chromium/media/tools/player_x11/player_x11.cc
+++ b/chromium/media/tools/player_x11/player_x11.cc
@@ -28,7 +28,7 @@
#include "media/filters/ffmpeg_demuxer.h"
#include "media/filters/ffmpeg_video_decoder.h"
#include "media/filters/file_data_source.h"
-#include "media/filters/video_renderer_base.h"
+#include "media/filters/video_renderer_impl.h"
#include "media/tools/player_x11/data_source_logger.h"
// Include X11 headers here because X11/Xlib.h #define's Status
@@ -121,7 +121,7 @@ void InitPipeline(media::Pipeline* pipeline,
ScopedVector<media::VideoDecoder> video_decoders;
video_decoders.push_back(new media::FFmpegVideoDecoder(message_loop));
- scoped_ptr<media::VideoRenderer> video_renderer(new media::VideoRendererBase(
+ scoped_ptr<media::VideoRenderer> video_renderer(new media::VideoRendererImpl(
message_loop,
video_decoders.Pass(),
media::SetDecryptorReadyCB(),
@@ -136,8 +136,7 @@ void InitPipeline(media::Pipeline* pipeline,
message_loop,
new media::NullAudioSink(message_loop),
audio_decoders.Pass(),
- media::SetDecryptorReadyCB(),
- true));
+ media::SetDecryptorReadyCB()));
collection->SetAudioRenderer(audio_renderer.Pass());
base::WaitableEvent event(true, false);
@@ -246,7 +245,8 @@ int main(int argc, char** argv) {
return 1;
}
- scoped_ptr<media::AudioManager> audio_manager(media::AudioManager::Create());
+ scoped_ptr<media::AudioManager> audio_manager(
+ media::AudioManager::CreateForTesting());
g_audio_manager = audio_manager.get();
logging::LoggingSettings settings;
diff --git a/chromium/media/tools/player_x11/x11_video_renderer.cc b/chromium/media/tools/player_x11/x11_video_renderer.cc
index c96d4663e6f..907e1abb5f6 100644
--- a/chromium/media/tools/player_x11/x11_video_renderer.cc
+++ b/chromium/media/tools/player_x11/x11_video_renderer.cc
@@ -16,7 +16,7 @@
// Creates a 32-bit XImage.
static XImage* CreateImage(Display* display, int width, int height) {
- LOG(INFO) << "Allocating XImage " << width << "x" << height;
+ VLOG(0) << "Allocating XImage " << width << "x" << height;
return XCreateImage(display,
DefaultVisual(display, DefaultScreen(display)),
DefaultDepth(display, DefaultScreen(display)),
@@ -181,7 +181,7 @@ void X11VideoRenderer::Paint(media::VideoFrame* video_frame) {
void X11VideoRenderer::Initialize(gfx::Size coded_size,
gfx::Rect visible_rect) {
CHECK(!image_);
- LOG(INFO) << "Initializing X11 Renderer...";
+ VLOG(0) << "Initializing X11 Renderer...";
// Resize the window to fit that of the video.
XResizeWindow(display_, window_, visible_rect.width(), visible_rect.height());
@@ -194,7 +194,7 @@ void X11VideoRenderer::Initialize(gfx::Size coded_size,
use_render_ = XRenderQueryExtension(display_, &dummy, &dummy);
if (use_render_) {
- LOG(INFO) << "Using XRender extension.";
+ VLOG(0) << "Using XRender extension.";
// If we are using XRender, we'll create a picture representing the
// window.