OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "webkit/media/android/webmediaplayer_android.h" | 5 #include "webkit/media/android/webmediaplayer_android.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 if (manager_) | 85 if (manager_) |
86 player_id_ = manager_->RegisterMediaPlayer(this); | 86 player_id_ = manager_->RegisterMediaPlayer(this); |
87 if (stream_texture_factory_.get()) | 87 if (stream_texture_factory_.get()) |
88 stream_texture_proxy_.reset(stream_texture_factory_->CreateProxy()); | 88 stream_texture_proxy_.reset(stream_texture_factory_->CreateProxy()); |
89 } | 89 } |
90 | 90 |
91 WebMediaPlayerAndroid::~WebMediaPlayerAndroid() { | 91 WebMediaPlayerAndroid::~WebMediaPlayerAndroid() { |
92 if (manager_) | 92 if (manager_) |
93 manager_->UnregisterMediaPlayer(player_id_); | 93 manager_->UnregisterMediaPlayer(player_id_); |
94 | 94 |
95 if (stream_id_) | |
Ami GONE FROM CHROMIUM
2012/07/30 23:09:36
Huh; I didn't realize there's only one VideoFrame
qinmin
2012/07/31 22:07:52
We had some concerns previously on memory usage of
| |
96 DestroyStreamTexture(); | |
97 | |
95 if (main_loop_) | 98 if (main_loop_) |
96 main_loop_->RemoveDestructionObserver(this); | 99 main_loop_->RemoveDestructionObserver(this); |
97 } | 100 } |
98 | 101 |
99 void WebMediaPlayerAndroid::InitIncognito(bool incognito_mode) { | 102 void WebMediaPlayerAndroid::InitIncognito(bool incognito_mode) { |
100 incognito_mode_ = incognito_mode; | 103 incognito_mode_ = incognito_mode; |
101 } | 104 } |
102 | 105 |
103 void WebMediaPlayerAndroid::load(const WebURL& url, CORSMode cors_mode) { | 106 void WebMediaPlayerAndroid::load(const WebURL& url, CORSMode cors_mode) { |
104 if (cors_mode != CORSModeUnspecified) | 107 if (cors_mode != CORSModeUnspecified) |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
536 DCHECK(!texture_id_); | 539 DCHECK(!texture_id_); |
537 stream_id_ = stream_texture_factory_->CreateStreamTexture(&texture_id_); | 540 stream_id_ = stream_texture_factory_->CreateStreamTexture(&texture_id_); |
538 if (texture_id_) | 541 if (texture_id_) |
539 video_frame_.reset(new WebVideoFrameImpl(VideoFrame::WrapNativeTexture( | 542 video_frame_.reset(new WebVideoFrameImpl(VideoFrame::WrapNativeTexture( |
540 texture_id_, | 543 texture_id_, |
541 kGLTextureExternalOES, | 544 kGLTextureExternalOES, |
542 texture_size_.width, | 545 texture_size_.width, |
543 texture_size_.height, | 546 texture_size_.height, |
544 base::TimeDelta(), | 547 base::TimeDelta(), |
545 base::TimeDelta(), | 548 base::TimeDelta(), |
546 base::Bind(&WebMediaPlayerAndroid::DestroyStreamTexture, | 549 base::Closure()))); |
547 base::Unretained(this))))); | |
548 } | 550 } |
549 | 551 |
550 void WebMediaPlayerAndroid::DestroyStreamTexture() { | 552 void WebMediaPlayerAndroid::DestroyStreamTexture() { |
551 DCHECK(stream_id_); | 553 DCHECK(stream_id_); |
552 DCHECK(texture_id_); | 554 DCHECK(texture_id_); |
553 stream_texture_factory_->DestroyStreamTexture(texture_id_); | 555 stream_texture_factory_->DestroyStreamTexture(texture_id_); |
554 texture_id_ = 0; | 556 texture_id_ = 0; |
555 stream_id_ = 0; | 557 stream_id_ = 0; |
556 } | 558 } |
557 | 559 |
(...skipping 16 matching lines...) Expand all Loading... | |
574 } | 576 } |
575 | 577 |
576 // This gets called both on compositor and main thread. | 578 // This gets called both on compositor and main thread. |
577 void WebMediaPlayerAndroid::setStreamTextureClient( | 579 void WebMediaPlayerAndroid::setStreamTextureClient( |
578 WebKit::WebStreamTextureClient* client) { | 580 WebKit::WebStreamTextureClient* client) { |
579 if (stream_texture_proxy_.get()) | 581 if (stream_texture_proxy_.get()) |
580 stream_texture_proxy_->SetClient(client); | 582 stream_texture_proxy_->SetClient(client); |
581 } | 583 } |
582 | 584 |
583 } // namespace webkit_media | 585 } // namespace webkit_media |
OLD | NEW |