Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: webkit/media/webmediaplayer_impl.cc

Issue 13419002: Media Source dispatches inband text tracks (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webkit/media/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/webmediaplayer_impl.h" 5 #include "webkit/media/webmediaplayer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 26 matching lines...) Expand all
37 #include "media/filters/vpx_video_decoder.h" 37 #include "media/filters/vpx_video_decoder.h"
38 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" 38 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h"
39 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" 39 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
40 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" 40 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h"
41 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" 41 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h"
42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaSource.h" 42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaSource.h"
43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h"
44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
45 #include "v8/include/v8.h" 45 #include "v8/include/v8.h"
46 #include "webkit/media/buffered_data_source.h" 46 #include "webkit/media/buffered_data_source.h"
47 #include "webkit/media/texttrack_impl.h"
47 #include "webkit/media/webaudiosourceprovider_impl.h" 48 #include "webkit/media/webaudiosourceprovider_impl.h"
49 #include "webkit/media/webinbandtexttrack_impl.h"
48 #include "webkit/media/webmediaplayer_delegate.h" 50 #include "webkit/media/webmediaplayer_delegate.h"
49 #include "webkit/media/webmediaplayer_params.h" 51 #include "webkit/media/webmediaplayer_params.h"
50 #include "webkit/media/webmediaplayer_util.h" 52 #include "webkit/media/webmediaplayer_util.h"
51 #include "webkit/media/webmediasourceclient_impl.h" 53 #include "webkit/media/webmediasourceclient_impl.h"
52 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" 54 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h"
53 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" 55 #include "webkit/renderer/compositor_bindings/web_layer_impl.h"
54 56
55 using WebKit::WebCanvas; 57 using WebKit::WebCanvas;
56 using WebKit::WebMediaPlayer; 58 using WebKit::WebMediaPlayer;
57 using WebKit::WebRect; 59 using WebKit::WebRect;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 media_log_(params.media_log()), 141 media_log_(params.media_log()),
140 accelerated_compositing_reported_(false), 142 accelerated_compositing_reported_(false),
141 incremented_externally_allocated_memory_(false), 143 incremented_externally_allocated_memory_(false),
142 gpu_factories_(params.gpu_factories()), 144 gpu_factories_(params.gpu_factories()),
143 is_local_source_(false), 145 is_local_source_(false),
144 supports_save_(true), 146 supports_save_(true),
145 starting_(false), 147 starting_(false),
146 chunk_demuxer_(NULL), 148 chunk_demuxer_(NULL),
147 pending_repaint_(false), 149 pending_repaint_(false),
148 pending_size_change_(false), 150 pending_size_change_(false),
149 video_frame_provider_client_(NULL) { 151 video_frame_provider_client_(NULL),
152 text_track_index_(0) {
150 media_log_->AddEvent( 153 media_log_->AddEvent(
151 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED)); 154 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED));
152 155
153 CHECK(media_thread_.Start()); 156 CHECK(media_thread_.Start());
154 pipeline_.reset(new media::Pipeline( 157 pipeline_.reset(new media::Pipeline(
155 media_thread_.message_loop_proxy(), media_log_)); 158 media_thread_.message_loop_proxy(), media_log_));
156 159
157 // Let V8 know we started new thread if we did not do it yet. 160 // Let V8 know we started new thread if we did not do it yet.
158 // Made separate task to avoid deletion of player currently being created. 161 // Made separate task to avoid deletion of player currently being created.
159 // Also, delaying GC until after player starts gets rid of starting lag -- 162 // Also, delaying GC until after player starts gets rid of starting lag --
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 DCHECK(init_data_type_.empty() || type.empty() || type == init_data_type_); 985 DCHECK(init_data_type_.empty() || type.empty() || type == init_data_type_);
983 if (init_data_type_.empty()) 986 if (init_data_type_.empty())
984 init_data_type_ = type; 987 init_data_type_ = type;
985 988
986 GetClient()->keyNeeded(WebString::fromUTF8(key_system), 989 GetClient()->keyNeeded(WebString::fromUTF8(key_system),
987 WebString::fromUTF8(session_id), 990 WebString::fromUTF8(session_id),
988 init_data.get(), 991 init_data.get(),
989 init_data_size); 992 init_data_size);
990 } 993 }
991 994
995 scoped_ptr<media::TextTrack>
996 WebMediaPlayerImpl::OnTextTrack(media::TextKind kind,
997 const std::string& label,
998 const std::string& language) {
999 typedef WebInbandTextTrackImpl::Kind webkind_t;
1000 const webkind_t webkind = static_cast<webkind_t>(kind);
1001 const WebKit::WebString weblabel = WebKit::WebString::fromUTF8(label);
1002 const WebKit::WebString weblanguage = WebKit::WebString::fromUTF8(language);
1003
1004 WebInbandTextTrackImpl* const text_track =
1005 new WebInbandTextTrackImpl(webkind, weblabel, weblanguage,
1006 text_track_index_++);
1007 GetClient()->addTextTrack(text_track);
1008
1009 return scoped_ptr<media::TextTrack>(new TextTrackImpl(text_track));
1010 }
1011
992 #define COMPILE_ASSERT_MATCHING_ENUM(name) \ 1012 #define COMPILE_ASSERT_MATCHING_ENUM(name) \
993 COMPILE_ASSERT(static_cast<int>(WebKit::WebMediaPlayerClient::name) == \ 1013 COMPILE_ASSERT(static_cast<int>(WebKit::WebMediaPlayerClient::name) == \
994 static_cast<int>(media::Decryptor::k ## name), \ 1014 static_cast<int>(media::Decryptor::k ## name), \
995 mismatching_enums) 1015 mismatching_enums)
996 COMPILE_ASSERT_MATCHING_ENUM(UnknownError); 1016 COMPILE_ASSERT_MATCHING_ENUM(UnknownError);
997 COMPILE_ASSERT_MATCHING_ENUM(ClientError); 1017 COMPILE_ASSERT_MATCHING_ENUM(ClientError);
998 COMPILE_ASSERT_MATCHING_ENUM(ServiceError); 1018 COMPILE_ASSERT_MATCHING_ENUM(ServiceError);
999 COMPILE_ASSERT_MATCHING_ENUM(OutputError); 1019 COMPILE_ASSERT_MATCHING_ENUM(OutputError);
1000 COMPILE_ASSERT_MATCHING_ENUM(HardwareChangeError); 1020 COMPILE_ASSERT_MATCHING_ENUM(HardwareChangeError);
1001 COMPILE_ASSERT_MATCHING_ENUM(DomainError); 1021 COMPILE_ASSERT_MATCHING_ENUM(DomainError);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 BIND_TO_RENDER_LOOP_2(&WebMediaPlayerImpl::OnNeedKey, "", ""))); 1097 BIND_TO_RENDER_LOOP_2(&WebMediaPlayerImpl::OnNeedKey, "", "")));
1078 } else { 1098 } else {
1079 DCHECK(!chunk_demuxer_); 1099 DCHECK(!chunk_demuxer_);
1080 DCHECK(!data_source_); 1100 DCHECK(!data_source_);
1081 1101
1082 scoped_ptr<WebKit::WebMediaSource> ms(media_source); 1102 scoped_ptr<WebKit::WebMediaSource> ms(media_source);
1083 chunk_demuxer_ = new media::ChunkDemuxer( 1103 chunk_demuxer_ = new media::ChunkDemuxer(
1084 BIND_TO_RENDER_LOOP_1(&WebMediaPlayerImpl::OnDemuxerOpened, 1104 BIND_TO_RENDER_LOOP_1(&WebMediaPlayerImpl::OnDemuxerOpened,
1085 base::Passed(&ms)), 1105 base::Passed(&ms)),
1086 BIND_TO_RENDER_LOOP_2(&WebMediaPlayerImpl::OnNeedKey, "", ""), 1106 BIND_TO_RENDER_LOOP_2(&WebMediaPlayerImpl::OnNeedKey, "", ""),
1107 base::Bind(&WebMediaPlayerImpl::OnTextTrack, base::Unretained(this)),
1087 base::Bind(&LogMediaSourceError, media_log_)); 1108 base::Bind(&LogMediaSourceError, media_log_));
1088 demuxer_.reset(chunk_demuxer_); 1109 demuxer_.reset(chunk_demuxer_);
1089 1110
1090 // Disable GpuVideoDecoder creation until it supports codec config changes. 1111 // Disable GpuVideoDecoder creation until it supports codec config changes.
1091 // TODO(acolwell): Remove this once http://crbug.com/151045 is fixed. 1112 // TODO(acolwell): Remove this once http://crbug.com/151045 is fixed.
1092 gpu_factories_ = NULL; 1113 gpu_factories_ = NULL;
1093 } 1114 }
1094 1115
1095 scoped_ptr<media::FilterCollection> filter_collection( 1116 scoped_ptr<media::FilterCollection> filter_collection(
1096 new media::FilterCollection()); 1117 new media::FilterCollection());
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 1289
1269 if (pending_repaint_) 1290 if (pending_repaint_)
1270 return; 1291 return;
1271 1292
1272 pending_repaint_ = true; 1293 pending_repaint_ = true;
1273 main_loop_->PostTask(FROM_HERE, base::Bind( 1294 main_loop_->PostTask(FROM_HERE, base::Bind(
1274 &WebMediaPlayerImpl::Repaint, AsWeakPtr())); 1295 &WebMediaPlayerImpl::Repaint, AsWeakPtr()));
1275 } 1296 }
1276 1297
1277 } // namespace webkit_media 1298 } // namespace webkit_media
OLDNEW
« no previous file with comments | « webkit/media/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698