summaryrefslogtreecommitdiff
path: root/chromium/content/renderer/pepper
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-12 14:27:29 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-13 09:35:20 +0000
commitc30a6232df03e1efbd9f3b226777b07e087a1122 (patch)
treee992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/content/renderer/pepper
parent7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff)
downloadqtwebengine-chromium-85-based.tar.gz
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/content/renderer/pepper')
-rw-r--r--chromium/content/renderer/pepper/event_conversion_unittest.cc17
-rw-r--r--chromium/content/renderer/pepper/pepper_platform_audio_output_dev.cc8
-rw-r--r--chromium/content/renderer/pepper/pepper_plugin_instance_impl.cc34
-rw-r--r--chromium/content/renderer/pepper/pepper_plugin_instance_impl.h5
-rw-r--r--chromium/content/renderer/pepper/pepper_video_capture_host.cc10
-rw-r--r--chromium/content/renderer/pepper/pepper_webplugin_impl.cc1
-rw-r--r--chromium/content/renderer/pepper/plugin_power_saver_helper.cc5
-rw-r--r--chromium/content/renderer/pepper/plugin_power_saver_helper.h3
-rw-r--r--chromium/content/renderer/pepper/video_decoder_shim.cc589
-rw-r--r--chromium/content/renderer/pepper/video_decoder_shim.h9
10 files changed, 60 insertions, 621 deletions
diff --git a/chromium/content/renderer/pepper/event_conversion_unittest.cc b/chromium/content/renderer/pepper/event_conversion_unittest.cc
index f1cb3204a76..ec2a622a6c6 100644
--- a/chromium/content/renderer/pepper/event_conversion_unittest.cc
+++ b/chromium/content/renderer/pepper/event_conversion_unittest.cc
@@ -8,9 +8,9 @@
#include <memory>
-#include "content/common/input/synthetic_web_input_event_builders.h"
#include "ppapi/shared_impl/ppb_input_event_shared.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
namespace content {
@@ -43,7 +43,7 @@ class EventConversionTest : public ::testing::Test {
};
TEST_F(EventConversionTest, TouchStart) {
- SyntheticWebTouchEvent touch;
+ blink::SyntheticWebTouchEvent touch;
touch.PressPoint(1.f, 2.f);
std::vector<ppapi::InputEventData> pp_events;
@@ -67,7 +67,7 @@ TEST_F(EventConversionTest, TouchStart) {
}
TEST_F(EventConversionTest, TouchMove) {
- SyntheticWebTouchEvent touch;
+ blink::SyntheticWebTouchEvent touch;
touch.PressPoint(1.f, 2.f);
touch.ResetPoints();
touch.PressPoint(3.f, 4.f);
@@ -95,7 +95,7 @@ TEST_F(EventConversionTest, TouchMove) {
}
TEST_F(EventConversionTest, TouchEnd) {
- SyntheticWebTouchEvent touch;
+ blink::SyntheticWebTouchEvent touch;
touch.PressPoint(1.f, 2.f);
touch.ResetPoints();
touch.PressPoint(3.f, 4.f);
@@ -123,7 +123,7 @@ TEST_F(EventConversionTest, TouchEnd) {
}
TEST_F(EventConversionTest, TouchCancel) {
- SyntheticWebTouchEvent touch;
+ blink::SyntheticWebTouchEvent touch;
touch.PressPoint(1.f, 2.f);
touch.ResetPoints();
touch.PressPoint(3.f, 4.f);
@@ -153,8 +153,9 @@ TEST_F(EventConversionTest, TouchCancel) {
TEST_F(EventConversionTest, MouseMove) {
std::unique_ptr<gfx::PointF> last_mouse_position;
- blink::WebMouseEvent mouse_event = SyntheticWebMouseEventBuilder::Build(
- blink::WebInputEvent::Type::kMouseMove, 100, 200, 0);
+ blink::WebMouseEvent mouse_event =
+ blink::SyntheticWebMouseEventBuilder::Build(
+ blink::WebInputEvent::Type::kMouseMove, 100, 200, 0);
std::vector<ppapi::InputEventData> pp_events;
CreateInputEventData(mouse_event, &last_mouse_position, &pp_events);
@@ -170,7 +171,7 @@ TEST_F(EventConversionTest, MouseMove) {
gfx::PointF(mouse_event.PositionInScreen()));
}
- mouse_event = SyntheticWebMouseEventBuilder::Build(
+ mouse_event = blink::SyntheticWebMouseEventBuilder::Build(
blink::WebInputEvent::Type::kMouseMove, 123, 188, 0);
CreateInputEventData(mouse_event, &last_mouse_position, &pp_events);
ASSERT_EQ(PP_INPUTEVENT_TYPE_MOUSEMOVE, pp_event.event_type);
diff --git a/chromium/content/renderer/pepper/pepper_platform_audio_output_dev.cc b/chromium/content/renderer/pepper/pepper_platform_audio_output_dev.cc
index baa8f2c7e0a..4ec293cbfab 100644
--- a/chromium/content/renderer/pepper/pepper_platform_audio_output_dev.cc
+++ b/chromium/content/renderer/pepper/pepper_platform_audio_output_dev.cc
@@ -24,9 +24,10 @@
namespace {
#if defined(OS_WIN) || defined(OS_MACOSX)
-const int64_t kMaxAuthorizationTimeoutMs = 4000;
+constexpr base::TimeDelta kMaxAuthorizationTimeout =
+ base::TimeDelta::FromSeconds(4);
#else
-const int64_t kMaxAuthorizationTimeoutMs = 0; // No timeout.
+constexpr base::TimeDelta kMaxAuthorizationTimeout; // No timeout.
#endif
}
@@ -44,8 +45,7 @@ PepperPlatformAudioOutputDev* PepperPlatformAudioOutputDev::Create(
render_frame_id, device_id,
// Set authorization request timeout at 80% of renderer hung timeout,
// but no more than kMaxAuthorizationTimeout.
- base::TimeDelta::FromMilliseconds(std::min(
- kHungRendererDelayMs * 8 / 10, kMaxAuthorizationTimeoutMs))));
+ std::min(kHungRendererDelay * 8 / 10, kMaxAuthorizationTimeout)));
if (audio_output->Initialize(sample_rate, frames_per_buffer, client)) {
// Balanced by Release invoked in
diff --git a/chromium/content/renderer/pepper/pepper_plugin_instance_impl.cc b/chromium/content/renderer/pepper/pepper_plugin_instance_impl.cc
index e0a663c1e38..18b21cb9dda 100644
--- a/chromium/content/renderer/pepper/pepper_plugin_instance_impl.cc
+++ b/chromium/content/renderer/pepper/pepper_plugin_instance_impl.cc
@@ -110,17 +110,14 @@
#include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/web_document_loader.h"
#include "third_party/blink/public/web/web_frame_widget.h"
-#include "third_party/blink/public/web/web_ime_text_span.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_plugin_container.h"
#include "third_party/blink/public/web/web_plugin_script_forbidden_scope.h"
#include "third_party/blink/public/web/web_print_params.h"
#include "third_party/blink/public/web/web_print_preset_options.h"
-#include "third_party/blink/public/web/web_print_scaling_option.h"
#include "third_party/blink/public/web/web_script_source.h"
#include "third_party/blink/public/web/web_view.h"
#include "third_party/khronos/GLES2/gl2.h"
-#include "ui/base/cursor/cursor_lookup.h"
#include "ui/events/blink/blink_event_util.h"
#include "ui/events/blink/web_input_event.h"
#include "ui/events/keycodes/dom/dom_code.h"
@@ -175,7 +172,6 @@ using blink::WebLocalFrame;
using blink::WebPlugin;
using blink::WebPluginContainer;
using blink::WebPrintParams;
-using blink::WebPrintScalingOption;
using blink::WebString;
using blink::WebURLError;
using blink::WebAssociatedURLLoaderClient;
@@ -286,13 +282,13 @@ STATIC_ASSERT_MATCHING_ENUM(kMiddlePanningHorizontal,
#undef STATIC_ASSERT_MATCHING_ENUM
-STATIC_ASSERT_ENUM(blink::kWebPrintScalingOptionNone,
+STATIC_ASSERT_ENUM(printing::mojom::PrintScalingOption::kNone,
PP_PRINTSCALINGOPTION_NONE);
-STATIC_ASSERT_ENUM(blink::kWebPrintScalingOptionFitToPrintableArea,
+STATIC_ASSERT_ENUM(printing::mojom::PrintScalingOption::kFitToPrintableArea,
PP_PRINTSCALINGOPTION_FIT_TO_PRINTABLE_AREA);
-STATIC_ASSERT_ENUM(blink::kWebPrintScalingOptionSourceSize,
+STATIC_ASSERT_ENUM(printing::mojom::PrintScalingOption::kSourceSize,
PP_PRINTSCALINGOPTION_SOURCE_SIZE);
-STATIC_ASSERT_ENUM(blink::kWebPrintScalingOptionFitToPaper,
+STATIC_ASSERT_ENUM(printing::mojom::PrintScalingOption::kFitToPaper,
PP_PRINTSCALINGOPTION_FIT_TO_PAPER);
#undef STATIC_ASSERT_ENUM
@@ -561,7 +557,8 @@ PepperPluginInstanceImpl::PepperPluginInstanceImpl(
!render_frame_->GetLocalRootRenderWidget()->is_hidden();
// Set the initial focus.
- SetContentAreaFocus(render_frame_->GetLocalRootRenderWidget()->has_focus());
+ SetContentAreaFocus(
+ render_frame_->GetLocalRootRenderWidget()->GetWebWidget()->HasFocus());
if (!module_->IsProxied()) {
created_in_process_instance_ = true;
@@ -935,7 +932,7 @@ bool PepperPluginInstanceImpl::HandleDocumentLoad(
bool PepperPluginInstanceImpl::SendCompositionEventToPlugin(
PP_InputEvent_Type type,
const base::string16& text) {
- std::vector<blink::WebImeTextSpan> empty;
+ std::vector<ui::ImeTextSpan> empty;
return SendCompositionEventWithImeTextSpanInformationToPlugin(
type, text, empty, static_cast<int>(text.size()),
static_cast<int>(text.size()));
@@ -945,7 +942,7 @@ bool PepperPluginInstanceImpl::
SendCompositionEventWithImeTextSpanInformationToPlugin(
PP_InputEvent_Type type,
const base::string16& text,
- const std::vector<blink::WebImeTextSpan>& ime_text_spans,
+ const std::vector<ui::ImeTextSpan>& ime_text_spans,
int selection_start,
int selection_end) {
// Keep a reference on the stack. See NOTE above.
@@ -994,8 +991,7 @@ bool PepperPluginInstanceImpl::
// Set the composition target.
for (size_t i = 0; i < ime_text_spans.size(); ++i) {
- if (ime_text_spans[i].thickness ==
- ui::mojom::ImeTextSpanThickness::kThick) {
+ if (ime_text_spans[i].thickness == ui::ImeTextSpan::Thickness::kThick) {
auto it = std::find(event.composition_segment_offsets.begin(),
event.composition_segment_offsets.end(),
utf8_offsets[2 * i + 2]);
@@ -1036,7 +1032,7 @@ bool PepperPluginInstanceImpl::HandleCompositionStart(
bool PepperPluginInstanceImpl::HandleCompositionUpdate(
const base::string16& text,
- const std::vector<blink::WebImeTextSpan>& ime_text_spans,
+ const std::vector<ui::ImeTextSpan>& ime_text_spans,
int selection_start,
int selection_end) {
return SendCompositionEventWithImeTextSpanInformationToPlugin(
@@ -2321,7 +2317,7 @@ bool PepperPluginInstanceImpl::SimulateIMEEvent(
return false;
render_frame_->SimulateImeCommitText(
base::UTF8ToUTF16(input_event.character_text),
- std::vector<blink::WebImeTextSpan>(), gfx::Range());
+ std::vector<ui::ImeTextSpan>(), gfx::Range());
break;
default:
return false;
@@ -2344,13 +2340,13 @@ void PepperPluginInstanceImpl::SimulateImeSetCompositionEvent(
base::string16 utf16_text =
base::UTF8ToUTF16AndAdjustOffsets(input_event.character_text, &offsets);
- std::vector<blink::WebImeTextSpan> ime_text_spans;
+ std::vector<ui::ImeTextSpan> ime_text_spans;
for (size_t i = 2; i + 1 < offsets.size(); ++i) {
- blink::WebImeTextSpan ime_text_span;
+ ui::ImeTextSpan ime_text_span;
ime_text_span.start_offset = offsets[i];
ime_text_span.end_offset = offsets[i + 1];
if (input_event.composition_target_segment == static_cast<int32_t>(i - 2))
- ime_text_span.thickness = ui::mojom::ImeTextSpanThickness::kThick;
+ ime_text_span.thickness = ui::ImeTextSpan::Thickness::kThick;
ime_text_spans.push_back(ime_text_span);
}
@@ -2723,7 +2719,7 @@ PP_Bool PepperPluginInstanceImpl::SetCursor(PP_Instance instance,
SkBitmap bitmap(image_data->GetMappedBitmap());
// Make a deep copy, so that the cursor remains valid even after the original
// image data gets freed.
- SkBitmap dst = GetCursorBitmap(*custom_cursor);
+ SkBitmap dst = custom_cursor->custom_bitmap();
if (!dst.tryAllocPixels(bitmap.info()) ||
!bitmap.readPixels(dst.info(), dst.getPixels(), dst.rowBytes(), 0, 0)) {
return PP_FALSE;
diff --git a/chromium/content/renderer/pepper/pepper_plugin_instance_impl.h b/chromium/content/renderer/pepper/pepper_plugin_instance_impl.h
index 4409f64a62d..89e2352432e 100644
--- a/chromium/content/renderer/pepper/pepper_plugin_instance_impl.h
+++ b/chromium/content/renderer/pepper/pepper_plugin_instance_impl.h
@@ -77,7 +77,6 @@ class WebInputEvent;
class WebMouseEvent;
class WebPluginContainer;
class WebURLResponse;
-struct WebImeTextSpan;
struct WebURLError;
struct WebPrintParams;
} // namespace blink
@@ -234,7 +233,7 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
bool HandleCompositionStart(const base::string16& text);
bool HandleCompositionUpdate(
const base::string16& text,
- const std::vector<blink::WebImeTextSpan>& ime_text_spans,
+ const std::vector<ui::ImeTextSpan>& ime_text_spans,
int selection_start,
int selection_end);
bool HandleCompositionEnd(const base::string16& text);
@@ -630,7 +629,7 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
bool SendCompositionEventWithImeTextSpanInformationToPlugin(
PP_InputEvent_Type type,
const base::string16& text,
- const std::vector<blink::WebImeTextSpan>& ime_text_spans,
+ const std::vector<ui::ImeTextSpan>& ime_text_spans,
int selection_start,
int selection_end);
diff --git a/chromium/content/renderer/pepper/pepper_video_capture_host.cc b/chromium/content/renderer/pepper/pepper_video_capture_host.cc
index 6794414d61c..c1f73fee6dd 100644
--- a/chromium/content/renderer/pepper/pepper_video_capture_host.cc
+++ b/chromium/content/renderer/pepper/pepper_video_capture_host.cc
@@ -125,13 +125,13 @@ void PepperVideoCaptureHost::PostErrorReply() {
void PepperVideoCaptureHost::OnFrameReady(const media::VideoFrame& frame) {
if (alloc_size_ != frame.visible_rect().size() || buffers_.empty()) {
alloc_size_ = frame.visible_rect().size();
- double frame_rate;
int rounded_frame_rate;
- if (frame.metadata()->GetDouble(media::VideoFrameMetadata::FRAME_RATE,
- &frame_rate))
- rounded_frame_rate = static_cast<int>(frame_rate + 0.5 /* round */);
- else
+ if (frame.metadata()->frame_rate.has_value()) {
+ rounded_frame_rate =
+ static_cast<int>(*frame.metadata()->frame_rate + 0.5 /* round */);
+ } else {
rounded_frame_rate = blink::MediaStreamVideoSource::kUnknownFrameRate;
+ }
AllocBuffers(alloc_size_, rounded_frame_rate);
}
diff --git a/chromium/content/renderer/pepper/pepper_webplugin_impl.cc b/chromium/content/renderer/pepper/pepper_webplugin_impl.cc
index 57d85b9f56a..330693503c9 100644
--- a/chromium/content/renderer/pepper/pepper_webplugin_impl.cc
+++ b/chromium/content/renderer/pepper/pepper_webplugin_impl.cc
@@ -40,7 +40,6 @@
#include "third_party/blink/public/web/web_plugin_params.h"
#include "third_party/blink/public/web/web_print_params.h"
#include "third_party/blink/public/web/web_print_preset_options.h"
-#include "third_party/blink/public/web/web_print_scaling_option.h"
#include "ui/base/cursor/cursor.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "url/gurl.h"
diff --git a/chromium/content/renderer/pepper/plugin_power_saver_helper.cc b/chromium/content/renderer/pepper/plugin_power_saver_helper.cc
index 4b088e4634f..9d8ffef0769 100644
--- a/chromium/content/renderer/pepper/plugin_power_saver_helper.cc
+++ b/chromium/content/renderer/pepper/plugin_power_saver_helper.cc
@@ -42,11 +42,10 @@ PluginPowerSaverHelper::~PluginPowerSaverHelper() {
}
void PluginPowerSaverHelper::DidCommitProvisionalLoad(
- bool is_same_document_navigation,
ui::PageTransition transition) {
blink::WebFrame* frame = render_frame()->GetWebFrame();
- // Only apply to top-level and new page navigation.
- if (frame->Parent() || is_same_document_navigation)
+ // Only apply to top-level navigation.
+ if (frame->Parent())
return; // Not a top-level navigation.
origin_allowlist_.clear();
diff --git a/chromium/content/renderer/pepper/plugin_power_saver_helper.h b/chromium/content/renderer/pepper/plugin_power_saver_helper.h
index ff8497e7c15..f3c3b49bb9c 100644
--- a/chromium/content/renderer/pepper/plugin_power_saver_helper.h
+++ b/chromium/content/renderer/pepper/plugin_power_saver_helper.h
@@ -52,8 +52,7 @@ class CONTENT_EXPORT PluginPowerSaverHelper : public RenderFrameObserver {
void AllowlistContentOrigin(const url::Origin& content_origin);
// RenderFrameObserver implementation.
- void DidCommitProvisionalLoad(bool is_same_document_navigation,
- ui::PageTransition transition) override;
+ void DidCommitProvisionalLoad(ui::PageTransition transition) override;
bool OnMessageReceived(const IPC::Message& message) override;
void OnDestruct() override;
diff --git a/chromium/content/renderer/pepper/video_decoder_shim.cc b/chromium/content/renderer/pepper/video_decoder_shim.cc
index e0add969e80..16c37ec791f 100644
--- a/chromium/content/renderer/pepper/video_decoder_shim.cc
+++ b/chromium/content/renderer/pepper/video_decoder_shim.cc
@@ -24,7 +24,7 @@
#include "content/public/renderer/render_thread.h"
#include "content/renderer/pepper/pepper_video_decoder_host.h"
#include "content/renderer/render_thread_impl.h"
-#include "gpu/command_buffer/client/gles2_interface.h"
+#include "gpu/command_buffer/client/raster_interface.h"
#include "media/base/cdm_context.h"
#include "media/base/decoder_buffer.h"
#include "media/base/limits.h"
@@ -34,6 +34,7 @@
#include "media/filters/ffmpeg_video_decoder.h"
#include "media/filters/vpx_video_decoder.h"
#include "media/media_buildflags.h"
+#include "media/renderers/yuv_util.h"
#include "media/video/picture.h"
#include "media/video/video_decode_accelerator.h"
#include "ppapi/c/pp_errors.h"
@@ -59,542 +60,6 @@ bool IsCodecSupported(media::VideoCodec codec) {
} // namespace
-// YUV->RGB converter class using a shader and FBO.
-class VideoDecoderShim::YUVConverter {
- public:
- YUVConverter(scoped_refptr<viz::ContextProviderCommandBuffer>);
- ~YUVConverter();
- bool Initialize();
- void Convert(const media::VideoFrame* frame, GLuint tex_out);
-
- private:
- GLuint CreateShader();
- GLuint CompileShader(const char* name, GLuint type, const char* code);
- GLuint CreateProgram(const char* name, GLuint vshader, GLuint fshader);
- GLuint CreateTexture();
-
- scoped_refptr<viz::ContextProviderCommandBuffer> context_provider_;
- gpu::gles2::GLES2Interface* gl_;
- GLuint frame_buffer_;
- GLuint vertex_buffer_;
- GLuint program_;
-
- GLuint y_texture_;
- GLuint u_texture_;
- GLuint v_texture_;
- GLuint a_texture_;
-
- GLuint internal_format_;
- GLuint format_;
- media::VideoPixelFormat video_format_;
-
- GLuint y_width_;
- GLuint y_height_;
-
- GLuint uv_width_;
- GLuint uv_height_;
- uint32_t uv_height_divisor_;
- uint32_t uv_width_divisor_;
-
- GLint yuv_matrix_loc_;
- GLint yuv_adjust_loc_;
-
- DISALLOW_COPY_AND_ASSIGN(YUVConverter);
-};
-
-VideoDecoderShim::YUVConverter::YUVConverter(
- scoped_refptr<viz::ContextProviderCommandBuffer> context_provider)
- : context_provider_(std::move(context_provider)),
- gl_(context_provider_->ContextGL()),
- frame_buffer_(0),
- vertex_buffer_(0),
- program_(0),
- y_texture_(0),
- u_texture_(0),
- v_texture_(0),
- a_texture_(0),
- internal_format_(0),
- format_(0),
- video_format_(media::PIXEL_FORMAT_UNKNOWN),
- y_width_(2),
- y_height_(2),
- uv_width_(2),
- uv_height_(2),
- uv_height_divisor_(1),
- uv_width_divisor_(1),
- yuv_matrix_loc_(0),
- yuv_adjust_loc_(0) {
- DCHECK(gl_);
-}
-
-VideoDecoderShim::YUVConverter::~YUVConverter() {
- if (y_texture_)
- gl_->DeleteTextures(1, &y_texture_);
-
- if (u_texture_)
- gl_->DeleteTextures(1, &u_texture_);
-
- if (v_texture_)
- gl_->DeleteTextures(1, &v_texture_);
-
- if (a_texture_)
- gl_->DeleteTextures(1, &a_texture_);
-
- if (frame_buffer_)
- gl_->DeleteFramebuffers(1, &frame_buffer_);
-
- if (vertex_buffer_)
- gl_->DeleteBuffers(1, &vertex_buffer_);
-
- if (program_)
- gl_->DeleteProgram(program_);
-}
-
-GLuint VideoDecoderShim::YUVConverter::CreateTexture() {
- GLuint tex = 0;
-
- gl_->GenTextures(1, &tex);
- gl_->BindTexture(GL_TEXTURE_2D, tex);
-
- // Create texture with default size - will be resized upon first frame.
- gl_->TexImage2D(GL_TEXTURE_2D, 0, internal_format_, 2, 2, 0, format_,
- GL_UNSIGNED_BYTE, nullptr);
-
- gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- gl_->BindTexture(GL_TEXTURE_2D, 0);
-
- return tex;
-}
-
-GLuint VideoDecoderShim::YUVConverter::CompileShader(const char* name,
- GLuint type,
- const char* code) {
- GLuint shader = gl_->CreateShader(type);
-
- gl_->ShaderSource(shader, 1, (const GLchar**)&code, nullptr);
- gl_->CompileShader(shader);
-
-#ifndef NDEBUG
- GLint status = 0;
-
- gl_->GetShaderiv(shader, GL_COMPILE_STATUS, &status);
- if (status != GL_TRUE) {
- GLint max_length = 0;
- GLint actual_length = 0;
- gl_->GetShaderiv(shader, GL_INFO_LOG_LENGTH, &max_length);
-
- // The max_length includes the NULL character.
- std::string error_log(max_length, 0);
- gl_->GetShaderInfoLog(shader, max_length, &actual_length, &error_log[0]);
-
- LOG(ERROR) << name << " shader compilation failed: " << error_log.c_str();
- gl_->DeleteShader(shader);
- return 0;
- }
-#endif
-
- return shader;
-}
-
-GLuint VideoDecoderShim::YUVConverter::CreateProgram(const char* name,
- GLuint vshader,
- GLuint fshader) {
- GLuint program = gl_->CreateProgram();
- gl_->AttachShader(program, vshader);
- gl_->AttachShader(program, fshader);
-
- gl_->BindAttribLocation(program, 0, "position");
-
- gl_->LinkProgram(program);
-
-#ifndef NDEBUG
- GLint status = 0;
-
- gl_->GetProgramiv(program, GL_LINK_STATUS, &status);
- if (status != GL_TRUE) {
- GLint max_length = 0;
- GLint actual_length = 0;
- gl_->GetProgramiv(program, GL_INFO_LOG_LENGTH, &max_length);
-
- // The max_length includes the NULL character.
- std::string error_log(max_length, 0);
- gl_->GetProgramInfoLog(program, max_length, &actual_length, &error_log[0]);
-
- LOG(ERROR) << name << " program linking failed: " << error_log.c_str();
- return 0;
- }
-#endif
-
- return program;
-}
-
-GLuint VideoDecoderShim::YUVConverter::CreateShader() {
- const char* vert_shader =
- "precision mediump float;\n"
- "attribute vec2 position;\n"
- "varying vec2 texcoord;\n"
- "void main()\n"
- "{\n"
- " gl_Position = vec4( position.xy, 0, 1 );\n"
- " texcoord = position*0.5+0.5;\n"
- "}";
-
- const char* frag_shader =
- "precision mediump float;\n"
- "varying vec2 texcoord;\n"
- "uniform sampler2D y_sampler;\n"
- "uniform sampler2D u_sampler;\n"
- "uniform sampler2D v_sampler;\n"
- "uniform sampler2D a_sampler;\n"
- "uniform mat3 yuv_matrix;\n"
- "uniform vec3 yuv_adjust;\n"
- "void main()\n"
- "{\n"
- " vec3 yuv = vec3(texture2D(y_sampler, texcoord).x,\n"
- " texture2D(u_sampler, texcoord).x,\n"
- " texture2D(v_sampler, texcoord).x) +\n"
- " yuv_adjust;\n"
- " gl_FragColor = vec4(yuv_matrix * yuv, texture2D(a_sampler, "
- "texcoord).x);\n"
- "}";
-
- GLuint vertex_shader =
- CompileShader("Vertex Shader", GL_VERTEX_SHADER, vert_shader);
- if (!vertex_shader) {
- return 0;
- }
-
- GLuint fragment_shader =
- CompileShader("Fragment Shader", GL_FRAGMENT_SHADER, frag_shader);
- if (!fragment_shader) {
- gl_->DeleteShader(vertex_shader);
- return 0;
- }
-
- GLuint program =
- CreateProgram("YUVConverter Program", vertex_shader, fragment_shader);
-
- gl_->DeleteShader(vertex_shader);
- gl_->DeleteShader(fragment_shader);
-
- if (!program) {
- return 0;
- }
-
- gl_->UseProgram(program);
-
- GLint uniform_location;
- uniform_location = gl_->GetUniformLocation(program, "y_sampler");
- DCHECK(uniform_location != -1);
- gl_->Uniform1i(uniform_location, 0);
-
- uniform_location = gl_->GetUniformLocation(program, "u_sampler");
- DCHECK(uniform_location != -1);
- gl_->Uniform1i(uniform_location, 1);
-
- uniform_location = gl_->GetUniformLocation(program, "v_sampler");
- DCHECK(uniform_location != -1);
- gl_->Uniform1i(uniform_location, 2);
-
- uniform_location = gl_->GetUniformLocation(program, "a_sampler");
- DCHECK(uniform_location != -1);
- gl_->Uniform1i(uniform_location, 3);
-
- gl_->UseProgram(0);
-
- yuv_matrix_loc_ = gl_->GetUniformLocation(program, "yuv_matrix");
- DCHECK(yuv_matrix_loc_ != -1);
-
- yuv_adjust_loc_ = gl_->GetUniformLocation(program, "yuv_adjust");
- DCHECK(yuv_adjust_loc_ != -1);
-
- return program;
-}
-
-bool VideoDecoderShim::YUVConverter::Initialize() {
- // If texture_rg extension is not available, use slower GL_LUMINANCE.
- if (context_provider_->ContextCapabilities().texture_rg) {
- internal_format_ = GL_RED_EXT;
- format_ = GL_RED_EXT;
- } else {
- internal_format_ = GL_LUMINANCE;
- format_ = GL_LUMINANCE;
- }
-
- if (context_provider_->ContextCapabilities().max_texture_image_units < 4) {
- // We support YUVA textures and require 4 texture units in the fragment
- // stage.
- return false;
- }
-
- gl_->TraceBeginCHROMIUM("YUVConverter", "YUVConverterContext");
- gl_->GenFramebuffers(1, &frame_buffer_);
-
- y_texture_ = CreateTexture();
- u_texture_ = CreateTexture();
- v_texture_ = CreateTexture();
- a_texture_ = CreateTexture();
-
- // Vertex positions. Also converted to texcoords in vertex shader.
- GLfloat vertex_positions[] = {-1.f, -1.f, 1.f, -1.f, -1.f, 1.f, 1.f, 1.f};
-
- gl_->GenBuffers(1, &vertex_buffer_);
- gl_->BindBuffer(GL_ARRAY_BUFFER, vertex_buffer_);
- gl_->BufferData(GL_ARRAY_BUFFER, 2 * sizeof(GLfloat) * 4, vertex_positions,
- GL_STATIC_DRAW);
- gl_->BindBuffer(GL_ARRAY_BUFFER, 0);
-
- program_ = CreateShader();
-
- gl_->TraceEndCHROMIUM();
-
- return (program_ != 0);
-}
-
-void VideoDecoderShim::YUVConverter::Convert(const media::VideoFrame* frame,
- GLuint tex_out) {
- const float* yuv_matrix = nullptr;
- const float* yuv_adjust = nullptr;
-
- if (video_format_ != frame->format()) {
- // The constants below were taken from
- // components/viz/service/display/gl_renderer.cc. These values are magic
- // numbers that are used in the transformation from YUV to RGB color values.
- // They are taken from the following webpage:
- // http://www.fourcc.org/fccyvrgb.php
- static const float yuv_to_rgb_rec601[9] = {
- 1.164f, 1.164f, 1.164f, 0.0f, -.391f, 2.018f, 1.596f, -.813f, 0.0f,
- };
- static const float yuv_to_rgb_jpeg[9] = {
- 1.f, 1.f, 1.f, 0.0f, -.34414f, 1.772f, 1.402f, -.71414f, 0.0f,
- };
- static const float yuv_to_rgb_rec709[9] = {
- 1.164f, 1.164f, 1.164f, 0.0f, -0.213f, 2.112f, 1.793f, -0.533f, 0.0f,
- };
-
- // These values map to 16, 128, and 128 respectively, and are computed
- // as a fraction over 256 (e.g. 16 / 256 = 0.0625).
- // They are used in the YUV to RGBA conversion formula:
- // Y - 16 : Gives 16 values of head and footroom for overshooting
- // U - 128 : Turns unsigned U into signed U [-128,127]
- // V - 128 : Turns unsigned V into signed V [-128,127]
- static const float yuv_adjust_constrained[3] = {
- -0.0625f,
- -0.5f,
- -0.5f,
- };
- // Same as above, but without the head and footroom.
- static const float yuv_adjust_full[3] = {
- 0.0f,
- -0.5f,
- -0.5f,
- };
-
- yuv_adjust = yuv_adjust_constrained;
- // TODO(hubbe): Should default to 709
- yuv_matrix = yuv_to_rgb_rec601;
-
- SkYUVColorSpace sk_yuv_color_space;
- if (frame->ColorSpace().ToSkYUVColorSpace(&sk_yuv_color_space)) {
- switch (sk_yuv_color_space) {
- case kJPEG_SkYUVColorSpace:
- yuv_matrix = yuv_to_rgb_jpeg;
- yuv_adjust = yuv_adjust_full;
- break;
- case kRec709_SkYUVColorSpace:
- yuv_matrix = yuv_to_rgb_rec709;
- break;
- case kRec601_SkYUVColorSpace:
- // Current default.
- break;
- default:
- NOTREACHED();
- }
- }
-
- switch (frame->format()) {
- case media::PIXEL_FORMAT_I420A:
- case media::PIXEL_FORMAT_I420:
- uv_height_divisor_ = 2;
- uv_width_divisor_ = 2;
- break;
- case media::PIXEL_FORMAT_I422:
- uv_width_divisor_ = 2;
- uv_height_divisor_ = 1;
- break;
- case media::PIXEL_FORMAT_I444:
- uv_width_divisor_ = 1;
- uv_height_divisor_ = 1;
- break;
-
- default:
- NOTREACHED();
- }
-
- video_format_ = frame->format();
-
- // Zero these so everything is reset below.
- y_width_ = y_height_ = 0;
- }
-
- gl_->TraceBeginCHROMIUM("YUVConverter", "YUVConverterContext");
-
- uint32_t ywidth = frame->coded_size().width();
- uint32_t yheight = frame->coded_size().height();
-
- DCHECK_EQ(frame->stride(media::VideoFrame::kUPlane),
- frame->stride(media::VideoFrame::kVPlane));
-
- uint32_t ystride = frame->stride(media::VideoFrame::kYPlane);
- uint32_t uvstride = frame->stride(media::VideoFrame::kUPlane);
-
- // The following code assumes that extended GLES 2.0 state like
- // UNPACK_SKIP* (if available) are set to defaults.
- gl_->PixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
- if (ywidth != y_width_ || yheight != y_height_) {
- y_width_ = ywidth;
- y_height_ = yheight;
-
- uv_width_ = y_width_ / uv_width_divisor_;
- uv_height_ = y_height_ / uv_height_divisor_;
-
- // Re-create to resize the textures and upload data.
- gl_->PixelStorei(GL_UNPACK_ROW_LENGTH_EXT, ystride);
- gl_->ActiveTexture(GL_TEXTURE0);
- gl_->BindTexture(GL_TEXTURE_2D, y_texture_);
- gl_->TexImage2D(GL_TEXTURE_2D, 0, internal_format_, y_width_, y_height_, 0,
- format_, GL_UNSIGNED_BYTE,
- frame->data(media::VideoFrame::kYPlane));
-
- if (video_format_ == media::PIXEL_FORMAT_I420A) {
- DCHECK_EQ(frame->stride(media::VideoFrame::kYPlane),
- frame->stride(media::VideoFrame::kAPlane));
- gl_->ActiveTexture(GL_TEXTURE3);
- gl_->BindTexture(GL_TEXTURE_2D, a_texture_);
- gl_->TexImage2D(GL_TEXTURE_2D, 0, internal_format_, y_width_, y_height_,
- 0, format_, GL_UNSIGNED_BYTE,
- frame->data(media::VideoFrame::kAPlane));
- } else {
- // if there is no alpha channel, then create a 2x2 texture with full
- // alpha.
- gl_->PixelStorei(GL_UNPACK_ROW_LENGTH_EXT, 0);
- const uint8_t alpha[4] = {0xff, 0xff, 0xff, 0xff};
- gl_->ActiveTexture(GL_TEXTURE3);
- gl_->BindTexture(GL_TEXTURE_2D, a_texture_);
- gl_->TexImage2D(GL_TEXTURE_2D, 0, internal_format_, 2, 2, 0, format_,
- GL_UNSIGNED_BYTE, alpha);
- }
-
- gl_->PixelStorei(GL_UNPACK_ROW_LENGTH_EXT, uvstride);
- gl_->ActiveTexture(GL_TEXTURE1);
- gl_->BindTexture(GL_TEXTURE_2D, u_texture_);
- gl_->TexImage2D(GL_TEXTURE_2D, 0, internal_format_, uv_width_, uv_height_,
- 0, format_, GL_UNSIGNED_BYTE,
- frame->data(media::VideoFrame::kUPlane));
-
- gl_->ActiveTexture(GL_TEXTURE2);
- gl_->BindTexture(GL_TEXTURE_2D, v_texture_);
- gl_->TexImage2D(GL_TEXTURE_2D, 0, internal_format_, uv_width_, uv_height_,
- 0, format_, GL_UNSIGNED_BYTE,
- frame->data(media::VideoFrame::kVPlane));
- } else {
- // Bind textures and upload texture data
- gl_->PixelStorei(GL_UNPACK_ROW_LENGTH_EXT, ystride);
- gl_->ActiveTexture(GL_TEXTURE0);
- gl_->BindTexture(GL_TEXTURE_2D, y_texture_);
- gl_->TexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, y_width_, y_height_, format_,
- GL_UNSIGNED_BYTE,
- frame->data(media::VideoFrame::kYPlane));
-
- if (video_format_ == media::PIXEL_FORMAT_I420A) {
- DCHECK_EQ(frame->stride(media::VideoFrame::kYPlane),
- frame->stride(media::VideoFrame::kAPlane));
- gl_->ActiveTexture(GL_TEXTURE3);
- gl_->BindTexture(GL_TEXTURE_2D, a_texture_);
- gl_->TexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, y_width_, y_height_, format_,
- GL_UNSIGNED_BYTE,
- frame->data(media::VideoFrame::kAPlane));
- } else {
- gl_->ActiveTexture(GL_TEXTURE3);
- gl_->BindTexture(GL_TEXTURE_2D, a_texture_);
- }
-
- gl_->PixelStorei(GL_UNPACK_ROW_LENGTH_EXT, uvstride);
- gl_->ActiveTexture(GL_TEXTURE1);
- gl_->BindTexture(GL_TEXTURE_2D, u_texture_);
- gl_->TexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, uv_width_, uv_height_, format_,
- GL_UNSIGNED_BYTE,
- frame->data(media::VideoFrame::kUPlane));
-
- gl_->ActiveTexture(GL_TEXTURE2);
- gl_->BindTexture(GL_TEXTURE_2D, v_texture_);
- gl_->TexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, uv_width_, uv_height_, format_,
- GL_UNSIGNED_BYTE,
- frame->data(media::VideoFrame::kVPlane));
- }
-
- gl_->BindFramebuffer(GL_FRAMEBUFFER, frame_buffer_);
- gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
- tex_out, 0);
-
-#ifndef NDEBUG
- // We should probably check for framebuffer complete here, but that
- // will slow this method down so check only in debug mode.
- GLint status = gl_->CheckFramebufferStatus(GL_FRAMEBUFFER);
- if (status != GL_FRAMEBUFFER_COMPLETE) {
- return;
- }
-#endif
-
- gl_->Viewport(0, 0, ywidth, yheight);
-
- gl_->UseProgram(program_);
-
- if (yuv_matrix) {
- gl_->UniformMatrix3fv(yuv_matrix_loc_, 1, 0, yuv_matrix);
- gl_->Uniform3fv(yuv_adjust_loc_, 1, yuv_adjust);
- }
-
- gl_->BindBuffer(GL_ARRAY_BUFFER, vertex_buffer_);
- gl_->EnableVertexAttribArray(0);
- gl_->VertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(GLfloat),
- static_cast<const void*>(nullptr));
-
- gl_->DrawArrays(GL_TRIANGLE_STRIP, 0, 4);
-
- // The YUVConverter shares the context with Skia and possibly other modules
- // that may make OpenGL calls. To be a "good OpenGL citizen" for other
- // (non-Skia) modules that may share this context we restore
- // buffer/texture/state bindings to OpenGL defaults here. If we were only
- // sharing the context with Skia this may not be necessary as we also
- // Invalidate the GrContext below so that Skia is aware that its state
- // caches need to be reset.
-
- gl_->BindBuffer(GL_ARRAY_BUFFER, 0);
- gl_->DisableVertexAttribArray(0);
- gl_->UseProgram(0);
- gl_->BindFramebuffer(GL_FRAMEBUFFER, 0);
-
- gl_->BindTexture(GL_TEXTURE_2D, 0);
-
- gl_->ActiveTexture(GL_TEXTURE2);
- gl_->BindTexture(GL_TEXTURE_2D, 0);
-
- gl_->ActiveTexture(GL_TEXTURE1);
- gl_->BindTexture(GL_TEXTURE_2D, 0);
-
- gl_->ActiveTexture(GL_TEXTURE0);
- gl_->BindTexture(GL_TEXTURE_2D, 0);
- gl_->PixelStorei(GL_UNPACK_ROW_LENGTH_EXT, 0);
-
- gl_->TraceEndCHROMIUM();
-}
-
struct VideoDecoderShim::PendingDecode {
PendingDecode(uint32_t decode_id,
const scoped_refptr<media::DecoderBuffer>& buffer);
@@ -817,7 +282,7 @@ void VideoDecoderShim::DecoderImpl::OnOutputComplete(
DCHECK(awaiting_decoder_);
std::unique_ptr<PendingFrame> pending_frame;
- if (!frame->metadata()->IsTrue(media::VideoFrameMetadata::END_OF_STREAM))
+ if (!frame->metadata()->end_of_stream)
pending_frame.reset(new PendingFrame(decode_id_, std::move(frame)));
else
pending_frame.reset(new PendingFrame(decode_id_));
@@ -841,8 +306,7 @@ VideoDecoderShim::VideoDecoderShim(PepperVideoDecoderHost* host,
context_provider_(
RenderThreadImpl::current()->SharedMainThreadContextProvider()),
texture_pool_size_(texture_pool_size),
- num_pending_decodes_(0),
- yuv_converter_(new YUVConverter(context_provider_)) {
+ num_pending_decodes_(0) {
DCHECK(host_);
DCHECK(media_task_runner_.get());
DCHECK(context_provider_.get());
@@ -851,11 +315,7 @@ VideoDecoderShim::VideoDecoderShim(PepperVideoDecoderHost* host,
VideoDecoderShim::~VideoDecoderShim() {
DCHECK(RenderThreadImpl::current());
- // Delete any remaining textures.
- auto it = texture_id_map_.begin();
- for (; it != texture_id_map_.end(); ++it)
- DeleteTexture(it->second);
- texture_id_map_.clear();
+ texture_mailbox_map_.clear();
FlushCommandBuffer();
@@ -891,9 +351,6 @@ bool VideoDecoderShim::Initialize(const Config& vda_config, Client* client) {
if (!IsCodecSupported(codec))
return false;
- if (!yuv_converter_->Initialize())
- return false;
-
media::VideoDecoderConfig video_decoder_config(
codec, vda_config.profile,
media::VideoDecoderConfig::AlphaMode::kIsOpaque, media::VideoColorSpace(),
@@ -943,15 +400,11 @@ void VideoDecoderShim::AssignPictureBuffers(
std::vector<gpu::Mailbox> mailboxes = host_->TakeMailboxes();
DCHECK_EQ(buffers.size(), mailboxes.size());
GLuint num_textures = base::checked_cast<GLuint>(buffers.size());
- std::vector<uint32_t> local_texture_ids(num_textures);
- gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL();
for (uint32_t i = 0; i < num_textures; i++) {
DCHECK_EQ(1u, buffers[i].client_texture_ids().size());
- local_texture_ids[i] =
- gles2->CreateAndConsumeTextureCHROMIUM(mailboxes[i].name);
- // Map the plugin texture id to the local texture id.
+ // Map the plugin texture id to the mailbox
uint32_t plugin_texture_id = buffers[i].client_texture_ids()[0];
- texture_id_map_[plugin_texture_id] = local_texture_ids[i];
+ texture_mailbox_map_[plugin_texture_id] = mailboxes[i];
available_textures_.insert(plugin_texture_id);
}
SendPictures();
@@ -962,7 +415,8 @@ void VideoDecoderShim::ReusePictureBuffer(int32_t picture_buffer_id) {
uint32_t texture_id = static_cast<uint32_t>(picture_buffer_id);
if (textures_to_dismiss_.find(texture_id) != textures_to_dismiss_.end()) {
DismissTexture(texture_id);
- } else if (texture_id_map_.find(texture_id) != texture_id_map_.end()) {
+ } else if (texture_mailbox_map_.find(texture_id) !=
+ texture_mailbox_map_.end()) {
available_textures_.insert(texture_id);
SendPictures();
} else {
@@ -1024,8 +478,8 @@ void VideoDecoderShim::OnOutputComplete(std::unique_ptr<PendingFrame> frame) {
// If the size has changed, all current textures must be dismissed. Add
// all textures to |textures_to_dismiss_| and dismiss any that aren't in
// use by the plugin. We will dismiss the rest as they are recycled.
- for (TextureIdMap::const_iterator it = texture_id_map_.begin();
- it != texture_id_map_.end(); ++it) {
+ for (IdToMailboxMap::const_iterator it = texture_mailbox_map_.begin();
+ it != texture_mailbox_map_.end(); ++it) {
textures_to_dismiss_.insert(it->first);
}
for (auto it = available_textures_.begin();
@@ -1056,10 +510,11 @@ void VideoDecoderShim::SendPictures() {
uint32_t texture_id = *it;
available_textures_.erase(it);
- uint32_t local_texture_id = texture_id_map_[texture_id];
-
- yuv_converter_->Convert(frame->video_frame.get(), local_texture_id);
-
+ gpu::MailboxHolder destination_holder;
+ destination_holder.mailbox = texture_mailbox_map_[texture_id];
+ destination_holder.texture_target = GL_TEXTURE_2D;
+ ConvertFromVideoFrameYUV(frame->video_frame.get(), context_provider_.get(),
+ destination_holder);
host_->PictureReady(media::Picture(texture_id, frame->decode_id,
frame->video_frame->visible_rect(),
gfx::ColorSpace(), false));
@@ -1106,19 +561,13 @@ void VideoDecoderShim::NotifyCompletedDecodes() {
void VideoDecoderShim::DismissTexture(uint32_t texture_id) {
DCHECK(host_);
textures_to_dismiss_.erase(texture_id);
- DCHECK(texture_id_map_.find(texture_id) != texture_id_map_.end());
- DeleteTexture(texture_id_map_[texture_id]);
- texture_id_map_.erase(texture_id);
+ DCHECK(texture_mailbox_map_.find(texture_id) != texture_mailbox_map_.end());
+ texture_mailbox_map_.erase(texture_id);
host_->DismissPictureBuffer(texture_id);
}
-void VideoDecoderShim::DeleteTexture(uint32_t texture_id) {
- gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL();
- gles2->DeleteTextures(1, &texture_id);
-}
-
void VideoDecoderShim::FlushCommandBuffer() {
- context_provider_->ContextGL()->Flush();
+ context_provider_->RasterInterface()->Flush();
}
} // namespace content
diff --git a/chromium/content/renderer/pepper/video_decoder_shim.h b/chromium/content/renderer/pepper/video_decoder_shim.h
index bca94b97508..1edd1176a33 100644
--- a/chromium/content/renderer/pepper/video_decoder_shim.h
+++ b/chromium/content/renderer/pepper/video_decoder_shim.h
@@ -61,7 +61,6 @@ class VideoDecoderShim : public media::VideoDecodeAccelerator {
struct PendingDecode;
struct PendingFrame;
class DecoderImpl;
- class YUVConverter;
void OnInitializeFailed();
void OnDecodeComplete(int32_t result, uint32_t decode_id);
@@ -84,9 +83,9 @@ class VideoDecoderShim : public media::VideoDecodeAccelerator {
// The current decoded frame size.
gfx::Size texture_size_;
- // Map that takes the plugin's GL texture id to the renderer's GL texture id.
- using TextureIdMap = std::unordered_map<uint32_t, uint32_t>;
- TextureIdMap texture_id_map_;
+ // Map that takes the plugin's GL texture id to the renderer's mailbox.
+ using IdToMailboxMap = std::unordered_map<uint32_t, gpu::Mailbox>;
+ IdToMailboxMap texture_mailbox_map_;
// Available textures (these are plugin ids.)
using TextureIdSet = std::unordered_set<uint32_t>;
TextureIdSet available_textures_;
@@ -106,8 +105,6 @@ class VideoDecoderShim : public media::VideoDecodeAccelerator {
uint32_t num_pending_decodes_;
- std::unique_ptr<YUVConverter> yuv_converter_;
-
base::WeakPtrFactory<VideoDecoderShim> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(VideoDecoderShim);