summaryrefslogtreecommitdiffstats
path: root/webkit/glue/media
diff options
context:
space:
mode:
authorIain Merrick <husky@google.com>2010-10-19 14:37:37 +0100
committerIain Merrick <husky@google.com>2010-10-19 14:37:37 +0100
commit3345a6884c488ff3a535c2c9acdd33d74b37e311 (patch)
tree7784b988ef1698cb6967ea1bdf07616237716c6c /webkit/glue/media
parentefc8475837ec58186051f23bb03542620424f6ce (diff)
downloadexternal_chromium-3345a6884c488ff3a535c2c9acdd33d74b37e311.zip
external_chromium-3345a6884c488ff3a535c2c9acdd33d74b37e311.tar.gz
external_chromium-3345a6884c488ff3a535c2c9acdd33d74b37e311.tar.bz2
Merge Chromium at 7.0.540.0 : Initial merge by git
Not including third_party/icu as it contains huge data files that break Gerrit, and aren't actually used. Change-Id: I428a386e70f3b58cacd28677b8cfda282e891e15
Diffstat (limited to 'webkit/glue/media')
-rw-r--r--webkit/glue/media/buffered_data_source.cc4
-rw-r--r--webkit/glue/media/buffered_data_source.h9
-rw-r--r--webkit/glue/media/buffered_data_source_unittest.cc34
-rw-r--r--webkit/glue/media/media_resource_loader_bridge_factory.cc12
-rw-r--r--webkit/glue/media/media_resource_loader_bridge_factory.h5
-rw-r--r--webkit/glue/media/mock_media_resource_loader_bridge_factory.h8
-rw-r--r--webkit/glue/media/simple_data_source.cc7
-rw-r--r--webkit/glue/media/simple_data_source.h7
-rw-r--r--webkit/glue/media/simple_data_source_unittest.cc4
-rw-r--r--webkit/glue/media/video_renderer_impl.cc10
-rw-r--r--webkit/glue/media/video_renderer_impl.h2
-rw-r--r--webkit/glue/media/web_video_renderer.h16
12 files changed, 73 insertions, 45 deletions
diff --git a/webkit/glue/media/buffered_data_source.cc b/webkit/glue/media/buffered_data_source.cc
index dfac588..f4aad57 100644
--- a/webkit/glue/media/buffered_data_source.cc
+++ b/webkit/glue/media/buffered_data_source.cc
@@ -350,7 +350,9 @@ void BufferedResourceLoader::OnReceivedData(const char* data, int len) {
}
void BufferedResourceLoader::OnCompletedRequest(
- const URLRequestStatus& status, const std::string& security_info) {
+ const URLRequestStatus& status,
+ const std::string& security_info,
+ const base::Time& completion_time) {
DCHECK(bridge_.get());
// Saves the information that the request has completed.
diff --git a/webkit/glue/media/buffered_data_source.h b/webkit/glue/media/buffered_data_source.h
index 0dc2115..b520418 100644
--- a/webkit/glue/media/buffered_data_source.h
+++ b/webkit/glue/media/buffered_data_source.h
@@ -5,9 +5,7 @@
#ifndef WEBKIT_GLUE_MEDIA_BUFFERED_DATA_SOURCE_H_
#define WEBKIT_GLUE_MEDIA_BUFFERED_DATA_SOURCE_H_
-#include <algorithm>
#include <string>
-#include <vector>
#include "base/callback.h"
#include "base/lock.h"
@@ -118,9 +116,12 @@ class BufferedResourceLoader :
virtual void OnReceivedResponse(
const webkit_glue::ResourceLoaderBridge::ResponseInfo& info,
bool content_filtered);
+ virtual void OnDownloadedData(int len) {}
virtual void OnReceivedData(const char* data, int len);
- virtual void OnCompletedRequest(const URLRequestStatus& status,
- const std::string& security_info);
+ virtual void OnCompletedRequest(
+ const URLRequestStatus& status,
+ const std::string& security_info,
+ const base::Time& completion_time);
GURL GetURLForDebugging() const { return url_; }
protected:
diff --git a/webkit/glue/media/buffered_data_source_unittest.cc b/webkit/glue/media/buffered_data_source_unittest.cc
index ce42437..7254c92 100644
--- a/webkit/glue/media/buffered_data_source_unittest.cc
+++ b/webkit/glue/media/buffered_data_source_unittest.cc
@@ -6,7 +6,9 @@
#include "base/callback.h"
#include "base/format_macros.h"
+#include "base/message_loop.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "media/base/filters.h"
#include "media/base/mock_filter_host.h"
#include "media/base/mock_filters.h"
@@ -51,7 +53,7 @@ ACTION_P(RequestCanceled, loader) {
URLRequestStatus status;
status.set_status(URLRequestStatus::CANCELED);
status.set_os_error(net::ERR_ABORTED);
- loader->OnCompletedRequest(status, "");
+ loader->OnCompletedRequest(status, "", base::Time());
}
class BufferedResourceLoaderTest : public testing::Test {
@@ -98,9 +100,9 @@ class BufferedResourceLoaderTest : public testing::Test {
void FullResponse(int64 instance_size) {
EXPECT_CALL(*this, StartCallback(net::OK));
ResourceLoaderBridge::ResponseInfo info;
- std::string header = StringPrintf("HTTP/1.1 200 OK\n"
- "Content-Length: %" PRId64,
- instance_size);
+ std::string header = base::StringPrintf("HTTP/1.1 200 OK\n"
+ "Content-Length: %" PRId64,
+ instance_size);
replace(header.begin(), header.end(), '\n', '\0');
info.headers = new net::HttpResponseHeaders(header);
info.content_length = instance_size;
@@ -115,12 +117,12 @@ class BufferedResourceLoaderTest : public testing::Test {
EXPECT_CALL(*this, StartCallback(net::OK));
int64 content_length = last_position - first_position + 1;
ResourceLoaderBridge::ResponseInfo info;
- std::string header = StringPrintf("HTTP/1.1 206 Partial Content\n"
- "Content-Range: bytes "
- "%" PRId64 "-%" PRId64 "/%" PRId64,
- first_position,
- last_position,
- instance_size);
+ std::string header = base::StringPrintf("HTTP/1.1 206 Partial Content\n"
+ "Content-Range: bytes "
+ "%" PRId64 "-%" PRId64 "/%" PRId64,
+ first_position,
+ last_position,
+ instance_size);
replace(header.begin(), header.end(), '\n', '\0');
info.headers = new net::HttpResponseHeaders(header);
info.content_length = content_length;
@@ -267,9 +269,9 @@ TEST_F(BufferedResourceLoaderTest, InvalidPartialResponse) {
.WillOnce(Invoke(this, &BufferedResourceLoaderTest::ReleaseBridge));
ResourceLoaderBridge::ResponseInfo info;
- std::string header = StringPrintf("HTTP/1.1 206 Partial Content\n"
- "Content-Range: bytes %d-%d/%d",
- 1, 10, 1024);
+ std::string header = base::StringPrintf("HTTP/1.1 206 Partial Content\n"
+ "Content-Range: bytes %d-%d/%d",
+ 1, 10, 1024);
replace(header.begin(), header.end(), '\n', '\0');
info.headers = new net::HttpResponseHeaders(header);
info.content_length = 10;
@@ -315,7 +317,7 @@ TEST_F(BufferedResourceLoaderTest, BufferAndRead) {
.WillOnce(Invoke(this, &BufferedResourceLoaderTest::ReleaseBridge));
URLRequestStatus status;
status.set_status(URLRequestStatus::SUCCESS);
- loader_->OnCompletedRequest(status, "");
+ loader_->OnCompletedRequest(status, "", base::Time());
// Try to read 10 from position 25 will just return with 5 bytes.
EXPECT_CALL(*this, ReadCallback(5));
@@ -361,7 +363,7 @@ TEST_F(BufferedResourceLoaderTest, ReadOutsideBuffer) {
.WillOnce(Invoke(this, &BufferedResourceLoaderTest::ReleaseBridge));
URLRequestStatus status;
status.set_status(URLRequestStatus::SUCCESS);
- loader_->OnCompletedRequest(status, "");
+ loader_->OnCompletedRequest(status, "", base::Time());
}
TEST_F(BufferedResourceLoaderTest, RequestFailedWhenRead) {
@@ -379,7 +381,7 @@ TEST_F(BufferedResourceLoaderTest, RequestFailedWhenRead) {
.WillOnce(Invoke(this, &BufferedResourceLoaderTest::ReleaseBridge));
URLRequestStatus status;
status.set_status(URLRequestStatus::FAILED);
- loader_->OnCompletedRequest(status, "");
+ loader_->OnCompletedRequest(status, "", base::Time());
}
// Tests the logic of caching data to disk when media is paused.
diff --git a/webkit/glue/media/media_resource_loader_bridge_factory.cc b/webkit/glue/media/media_resource_loader_bridge_factory.cc
index 1961bcc..9d8d547 100644
--- a/webkit/glue/media/media_resource_loader_bridge_factory.cc
+++ b/webkit/glue/media/media_resource_loader_bridge_factory.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
@@ -6,6 +6,7 @@
#include "base/format_macros.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
namespace {
@@ -61,12 +62,13 @@ const std::string MediaResourceLoaderBridgeFactory::GenerateHeaders (
if (first_byte_position > kPositionNotSpecified &&
last_byte_position > kPositionNotSpecified) {
if (first_byte_position <= last_byte_position) {
- header = StringPrintf("Range: bytes=%" PRId64 "-%" PRId64,
- first_byte_position,
- last_byte_position);
+ header = base::StringPrintf("Range: bytes=%" PRId64 "-%" PRId64,
+ first_byte_position,
+ last_byte_position);
}
} else if (first_byte_position > kPositionNotSpecified) {
- header = StringPrintf("Range: bytes=%" PRId64 "-", first_byte_position);
+ header = base::StringPrintf("Range: bytes=%" PRId64 "-",
+ first_byte_position);
} else if (last_byte_position > kPositionNotSpecified) {
NOTIMPLEMENTED() << "Suffix range not implemented";
}
diff --git a/webkit/glue/media/media_resource_loader_bridge_factory.h b/webkit/glue/media/media_resource_loader_bridge_factory.h
index 6408949..5f09235 100644
--- a/webkit/glue/media/media_resource_loader_bridge_factory.h
+++ b/webkit/glue/media/media_resource_loader_bridge_factory.h
@@ -5,7 +5,7 @@
#ifndef WEBKIT_GLUE_MEDIA_MEDIA_RESOURCE_LOADER_BRIDGE_FACTORY_H_
#define WEBKIT_GLUE_MEDIA_MEDIA_RESOURCE_LOADER_BRIDGE_FACTORY_H_
-#include "testing/gtest/include/gtest/gtest_prod.h"
+#include "base/gtest_prod_util.h"
#include "webkit/glue/resource_loader_bridge.h"
namespace webkit_glue {
@@ -44,7 +44,8 @@ class MediaResourceLoaderBridgeFactory {
}
private:
- FRIEND_TEST(MediaResourceLoaderBridgeFactoryTest, GenerateHeaders);
+ FRIEND_TEST_ALL_PREFIXES(MediaResourceLoaderBridgeFactoryTest,
+ GenerateHeaders);
// Returns a range request header using parameters |first_byte_position| and
// |last_byte_position|.
diff --git a/webkit/glue/media/mock_media_resource_loader_bridge_factory.h b/webkit/glue/media/mock_media_resource_loader_bridge_factory.h
index 7bb27fe..3c0a3ae 100644
--- a/webkit/glue/media/mock_media_resource_loader_bridge_factory.h
+++ b/webkit/glue/media/mock_media_resource_loader_bridge_factory.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
-#ifndef WEBKIT_GLUE_MOCK_RESOURCE_LOADER_BRIDGE_H_
-#define WEBKIT_GLUE_MOCK_RESOURCE_LOADER_BRIDGE_H_
+#ifndef WEBKIT_GLUE_MEDIA_MOCK_MEDIA_RESOURCE_LOADER_BRIDGE_FACTORY_H_
+#define WEBKIT_GLUE_MEDIA_MOCK_MEDIA_RESOURCE_LOADER_BRIDGE_FACTORY_H_
#include "testing/gmock/include/gmock/gmock.h"
#include "webkit/glue/media/media_resource_loader_bridge_factory.h"
@@ -33,4 +33,4 @@ class MockMediaResourceLoaderBridgeFactory
} // namespace webkit_glue
-#endif // WEBKIT_GLUE_MEDIA_MOCK_RESOURCE_LOADER_BRIDGE_H_
+#endif // WEBKIT_GLUE_MEDIA_MOCK_MEDIA_RESOURCE_LOADER_BRIDGE_FACTORY_H_
diff --git a/webkit/glue/media/simple_data_source.cc b/webkit/glue/media/simple_data_source.cc
index 20bf0af..56deaeb 100644
--- a/webkit/glue/media/simple_data_source.cc
+++ b/webkit/glue/media/simple_data_source.cc
@@ -120,10 +120,6 @@ bool SimpleDataSource::IsStreaming() {
return false;
}
-void SimpleDataSource::OnDownloadProgress(uint64 position, uint64 size) {}
-
-void SimpleDataSource::OnUploadProgress(uint64 position, uint64 size) {}
-
bool SimpleDataSource::OnReceivedRedirect(
const GURL& new_url,
const webkit_glue::ResourceLoaderBridge::ResponseInfo& info,
@@ -146,7 +142,8 @@ void SimpleDataSource::OnReceivedData(const char* data, int len) {
}
void SimpleDataSource::OnCompletedRequest(const URLRequestStatus& status,
- const std::string& security_info) {
+ const std::string& security_info,
+ const base::Time& completion_time) {
AutoLock auto_lock(lock_);
// It's possible this gets called after Stop(), in which case |host_| is no
// longer valid.
diff --git a/webkit/glue/media/simple_data_source.h b/webkit/glue/media/simple_data_source.h
index 577d973..d238f61 100644
--- a/webkit/glue/media/simple_data_source.h
+++ b/webkit/glue/media/simple_data_source.h
@@ -51,8 +51,7 @@ class SimpleDataSource : public media::DataSource,
virtual bool IsStreaming();
// webkit_glue::ResourceLoaderBridge::Peer implementation.
- virtual void OnDownloadProgress(uint64 position, uint64 size);
- virtual void OnUploadProgress(uint64 position, uint64 size);
+ virtual void OnUploadProgress(uint64 position, uint64 size) {}
virtual bool OnReceivedRedirect(
const GURL& new_url,
const webkit_glue::ResourceLoaderBridge::ResponseInfo& info,
@@ -61,9 +60,11 @@ class SimpleDataSource : public media::DataSource,
virtual void OnReceivedResponse(
const webkit_glue::ResourceLoaderBridge::ResponseInfo& info,
bool content_filtered);
+ virtual void OnDownloadedData(int len) {}
virtual void OnReceivedData(const char* data, int len);
virtual void OnCompletedRequest(const URLRequestStatus& status,
- const std::string& security_info);
+ const std::string& security_info,
+ const base::Time& completion_time);
virtual GURL GetURLForDebugging() const;
private:
diff --git a/webkit/glue/media/simple_data_source_unittest.cc b/webkit/glue/media/simple_data_source_unittest.cc
index e6acba9..d05bb72 100644
--- a/webkit/glue/media/simple_data_source_unittest.cc
+++ b/webkit/glue/media/simple_data_source_unittest.cc
@@ -105,7 +105,7 @@ class SimpleDataSourceTest : public testing::Test {
URLRequestStatus status;
status.set_status(URLRequestStatus::SUCCESS);
status.set_os_error(0);
- data_source_->OnCompletedRequest(status, "");
+ data_source_->OnCompletedRequest(status, "", base::Time());
// Let the tasks to be executed.
MessageLoop::current()->RunAllPending();
@@ -122,7 +122,7 @@ class SimpleDataSourceTest : public testing::Test {
URLRequestStatus status;
status.set_status(URLRequestStatus::FAILED);
status.set_os_error(100);
- data_source_->OnCompletedRequest(status, "");
+ data_source_->OnCompletedRequest(status, "", base::Time());
// Let the tasks to be executed.
MessageLoop::current()->RunAllPending();
diff --git a/webkit/glue/media/video_renderer_impl.cc b/webkit/glue/media/video_renderer_impl.cc
index 796d07f..6d7323d 100644
--- a/webkit/glue/media/video_renderer_impl.cc
+++ b/webkit/glue/media/video_renderer_impl.cc
@@ -95,6 +95,16 @@ void VideoRendererImpl::Paint(skia::PlatformCanvas* canvas,
PutCurrentFrame(video_frame);
}
+void VideoRendererImpl::GetCurrentFrame(
+ scoped_refptr<media::VideoFrame>* frame_out) {
+ VideoRendererBase::GetCurrentFrame(frame_out);
+}
+
+void VideoRendererImpl::PutCurrentFrame(
+ scoped_refptr<media::VideoFrame> frame) {
+ VideoRendererBase::PutCurrentFrame(frame);
+}
+
// CanFastPaint is a helper method to determine the conditions for fast
// painting. The conditions are:
// 1. No skew in canvas matrix.
diff --git a/webkit/glue/media/video_renderer_impl.h b/webkit/glue/media/video_renderer_impl.h
index 30f2e38..39ce1b2 100644
--- a/webkit/glue/media/video_renderer_impl.h
+++ b/webkit/glue/media/video_renderer_impl.h
@@ -27,6 +27,8 @@ class VideoRendererImpl : public WebVideoRenderer {
// WebVideoRenderer implementation.
virtual void SetRect(const gfx::Rect& rect);
virtual void Paint(skia::PlatformCanvas* canvas, const gfx::Rect& dest_rect);
+ virtual void GetCurrentFrame(scoped_refptr<media::VideoFrame>* frame_out);
+ virtual void PutCurrentFrame(scoped_refptr<media::VideoFrame> frame);
// Static method for creating factory for this object.
static media::FilterFactory* CreateFactory(WebMediaPlayerImpl::Proxy* proxy,
diff --git a/webkit/glue/media/web_video_renderer.h b/webkit/glue/media/web_video_renderer.h
index 8bafb1a..d8b47ad 100644
--- a/webkit/glue/media/web_video_renderer.h
+++ b/webkit/glue/media/web_video_renderer.h
@@ -1,10 +1,11 @@
-// Copyright (c) 2010 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.
+// Copyright (c) 2010 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.
#ifndef WEBKIT_GLUE_MEDIA_WEB_VIDEO_RENDERER_H_
#define WEBKIT_GLUE_MEDIA_WEB_VIDEO_RENDERER_H_
+#include "media/base/video_frame.h"
#include "media/filters/video_renderer_base.h"
namespace webkit_glue {
@@ -30,6 +31,15 @@ class WebVideoRenderer : public media::VideoRendererBase {
virtual void Paint(skia::PlatformCanvas* canvas,
const gfx::Rect& dest_rect) = 0;
+ // Clients of this class (painter/compositor) should use GetCurrentFrame()
+ // obtain ownership of VideoFrame, it should always relinquish the ownership
+ // by use PutCurrentFrame(). Current frame is not guaranteed to be non-NULL.
+ // It expects clients to use color-fill the background if current frame
+ // is NULL. This could happen when before pipeline is pre-rolled or during
+ // pause/flush/seek.
+ virtual void GetCurrentFrame(scoped_refptr<media::VideoFrame>* frame_out) {}
+ virtual void PutCurrentFrame(scoped_refptr<media::VideoFrame> frame) {}
+
private:
DISALLOW_COPY_AND_ASSIGN(WebVideoRenderer);
};