Changeset 228316 in webkit
- Timestamp:
- Feb 9, 2018 4:11:10 AM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r228315 r228316 1 2018-02-09 Yacine Bandou <yacine.bandou_ext@softathome.com> 2 3 [EME][GStreamer] Add support for encrypted caps in GStreamerUtilities 4 https://bugs.webkit.org/show_bug.cgi?id=181990 5 6 Reviewed by Xabier Rodriguez-Calvar. 7 8 Add the support of encrypted caps in GStreamerUtilities. 9 Refactor the manner that the caps are handled, such as how to extract the resolution 10 from the video caps or how to check if the caps are encrypted. 11 12 The attachTrack function in PlaybackPipeline doesn't need the "structure" parameter, 13 it is already included in the "caps" parameter. 14 15 Replace the "mediaType" parameter by the "caps" parameter in reattachTrack function, 16 it allows to use the new functions that handle the caps in GStreamerUtilities. 17 18 Tests: 19 media/encrypted-media/clearKey/clearKey-cenc-audio-playback-mse.html 20 media/encrypted-media/clearKey/clearKey-cenc-video-playback-mse.html 21 22 * platform/graphics/gstreamer/GStreamerUtilities.cpp: 23 (WebCore::getVideoSizeAndFormatFromCaps): Add the support of video encrypted caps. 24 (WebCore::getVideoResolutionFromCaps): 25 (WebCore::capsMediaType): 26 (WebCore::doCapsHaveType): 27 (WebCore::areEncryptedCaps): Add a new functions in order to handle the caps properly. 28 * platform/graphics/gstreamer/GStreamerUtilities.h: 29 * platform/graphics/gstreamer/mse/AppendPipeline.cpp: 30 (WebCore::AppendPipeline::parseDemuxerSrcPadCaps): 31 * platform/graphics/gstreamer/mse/GStreamerMediaDescription.cpp: 32 (WebCore::GStreamerMediaDescription::codec const): 33 (WebCore::GStreamerMediaDescription::isVideo const): 34 (WebCore::GStreamerMediaDescription::isAudio const): 35 * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: 36 (WebCore::MediaPlayerPrivateGStreamerMSE::trackDetected): 37 * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp: 38 (WebCore::PlaybackPipeline::attachTrack): 39 (WebCore::PlaybackPipeline::reattachTrack): 40 * platform/graphics/gstreamer/mse/PlaybackPipeline.h: 41 * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp: 42 (webKitMediaSrcUpdatePresentationSize): Refactor some parts by using the new added functions. 43 1 44 2018-02-09 Philippe Normand <pnormand@igalia.com> 2 45 -
trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp
r226504 r228316 60 60 bool getVideoSizeAndFormatFromCaps(GstCaps* caps, WebCore::IntSize& size, GstVideoFormat& format, int& pixelAspectRatioNumerator, int& pixelAspectRatioDenominator, int& stride) 61 61 { 62 GstVideoInfo info; 63 64 gst_video_info_init(&info); 65 if (!gst_video_info_from_caps(&info, caps)) 66 return false; 67 68 format = GST_VIDEO_INFO_FORMAT(&info); 69 size.setWidth(GST_VIDEO_INFO_WIDTH(&info)); 70 size.setHeight(GST_VIDEO_INFO_HEIGHT(&info)); 71 pixelAspectRatioNumerator = GST_VIDEO_INFO_PAR_N(&info); 72 pixelAspectRatioDenominator = GST_VIDEO_INFO_PAR_D(&info); 73 stride = GST_VIDEO_INFO_PLANE_STRIDE(&info, 0); 62 if (!doCapsHaveType(caps, GST_VIDEO_CAPS_TYPE_PREFIX)) { 63 GST_WARNING("Failed to get the video size and format, these are not a video caps"); 64 return false; 65 } 66 67 if (areEncryptedCaps(caps)) { 68 GstStructure* structure = gst_caps_get_structure(caps, 0); 69 format = GST_VIDEO_FORMAT_ENCODED; 70 stride = 0; 71 int width = 0, height = 0; 72 gst_structure_get_int(structure, "width", &width); 73 gst_structure_get_int(structure, "height", &height); 74 if (!gst_structure_get_fraction(structure, "pixel-aspect-ratio", &pixelAspectRatioNumerator, &pixelAspectRatioDenominator)) { 75 pixelAspectRatioNumerator = 1; 76 pixelAspectRatioDenominator = 1; 77 } 78 79 size.setWidth(width); 80 size.setHeight(height); 81 } else { 82 GstVideoInfo info; 83 gst_video_info_init(&info); 84 if (!gst_video_info_from_caps(&info, caps)) 85 return false; 86 87 format = GST_VIDEO_INFO_FORMAT(&info); 88 size.setWidth(GST_VIDEO_INFO_WIDTH(&info)); 89 size.setHeight(GST_VIDEO_INFO_HEIGHT(&info)); 90 pixelAspectRatioNumerator = GST_VIDEO_INFO_PAR_N(&info); 91 pixelAspectRatioDenominator = GST_VIDEO_INFO_PAR_D(&info); 92 stride = GST_VIDEO_INFO_PLANE_STRIDE(&info, 0); 93 } 74 94 75 95 return true; 96 } 97 98 std::optional<FloatSize> getVideoResolutionFromCaps(const GstCaps* caps) 99 { 100 if (!doCapsHaveType(caps, GST_VIDEO_CAPS_TYPE_PREFIX)) { 101 GST_WARNING("Failed to get the video resolution, these are not a video caps"); 102 return std::nullopt; 103 } 104 105 int width = 0, height = 0; 106 int pixelAspectRatioNumerator = 1, pixelAspectRatioDenominator = 1; 107 108 if (areEncryptedCaps(caps)) { 109 GstStructure* structure = gst_caps_get_structure(caps, 0); 110 gst_structure_get_int(structure, "width", &width); 111 gst_structure_get_int(structure, "height", &height); 112 gst_structure_get_fraction(structure, "pixel-aspect-ratio", &pixelAspectRatioNumerator, &pixelAspectRatioDenominator); 113 } else { 114 GstVideoInfo info; 115 gst_video_info_init(&info); 116 if (!gst_video_info_from_caps(&info, caps)) 117 return std::nullopt; 118 119 width = GST_VIDEO_INFO_WIDTH(&info); 120 height = GST_VIDEO_INFO_HEIGHT(&info); 121 pixelAspectRatioNumerator = GST_VIDEO_INFO_PAR_N(&info); 122 pixelAspectRatioDenominator = GST_VIDEO_INFO_PAR_D(&info); 123 } 124 125 return std::make_optional(FloatSize(width, height * (static_cast<float>(pixelAspectRatioNumerator) / static_cast<float>(pixelAspectRatioDenominator)))); 76 126 } 77 127 … … 112 162 113 163 return buffer; 164 } 165 166 const char* capsMediaType(const GstCaps* caps) 167 { 168 ASSERT(caps); 169 GstStructure* structure = gst_caps_get_structure(caps, 0); 170 if (!structure) { 171 GST_WARNING("caps are empty"); 172 return nullptr; 173 } 174 #if ENABLE(ENCRYPTED_MEDIA) 175 if (gst_structure_has_name(structure, "application/x-cenc")) 176 return gst_structure_get_string(structure, "original-media-type"); 177 #endif 178 return gst_structure_get_name(structure); 179 } 180 181 bool doCapsHaveType(const GstCaps* caps, const char* type) 182 { 183 const char* mediaType = capsMediaType(caps); 184 if (!mediaType) { 185 GST_WARNING("Failed to get MediaType"); 186 return false; 187 } 188 return g_str_has_prefix(mediaType, type); 189 } 190 191 bool areEncryptedCaps(const GstCaps* caps) 192 { 193 ASSERT(caps); 194 #if ENABLE(ENCRYPTED_MEDIA) 195 GstStructure* structure = gst_caps_get_structure(caps, 0); 196 if (!structure) { 197 GST_WARNING("caps are empty"); 198 return false; 199 } 200 return gst_structure_has_name(structure, "application/x-cenc"); 201 #else 202 UNUSED_PARAM(caps); 203 return false; 204 #endif 114 205 } 115 206 -
trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h
r226402 r228316 21 21 22 22 23 #include "FloatSize.h" 23 24 #include <gst/gst.h> 24 25 #include <gst/video/video-format.h> … … 51 52 } 52 53 54 #define GST_VIDEO_CAPS_TYPE_PREFIX "video/" 55 #define GST_AUDIO_CAPS_TYPE_PREFIX "audio/" 56 #define GST_TEXT_CAPS_TYPE_PREFIX "text/" 57 53 58 GstPad* webkitGstGhostPadFromStaticTemplate(GstStaticPadTemplate*, const gchar* name, GstPad* target); 54 59 #if ENABLE(VIDEO) 55 60 bool getVideoSizeAndFormatFromCaps(GstCaps*, WebCore::IntSize&, GstVideoFormat&, int& pixelAspectRatioNumerator, int& pixelAspectRatioDenominator, int& stride); 61 std::optional<FloatSize> getVideoResolutionFromCaps(const GstCaps*); 56 62 bool getSampleVideoInfo(GstSample*, GstVideoInfo&); 57 63 #endif … … 59 65 GstBuffer* createGstBufferForData(const char* data, int length); 60 66 char* getGstBufferDataPointer(GstBuffer*); 67 const char* capsMediaType(const GstCaps*); 68 bool doCapsHaveType(const GstCaps*, const char*); 69 bool areEncryptedCaps(const GstCaps*); 61 70 void mapGstBuffer(GstBuffer*, uint32_t); 62 71 void unmapGstBuffer(GstBuffer*); -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp
r226357 r228316 28 28 #include "GStreamerEMEUtilities.h" 29 29 #include "GStreamerMediaDescription.h" 30 #include "GStreamerUtilities.h" 30 31 #include "MediaSampleGStreamer.h" 31 32 #include "InbandTextTrackPrivateGStreamer.h" … … 583 584 m_demuxerSrcPadCaps = adoptGRef(demuxerSrcPadCaps); 584 585 m_streamType = WebCore::MediaSourceStreamTypeGStreamer::Unknown; 585 586 GstStructure* structure = gst_caps_get_structure(m_demuxerSrcPadCaps.get(), 0); 587 bool sizeConfigured = false; 588 589 #if GST_CHECK_VERSION(1, 5, 3) && ENABLE(ENCRYPTED_MEDIA) 590 if (gst_structure_has_name(structure, "application/x-cenc")) { 586 #if ENABLE(ENCRYPTED_MEDIA) 587 if (areEncryptedCaps(m_demuxerSrcPadCaps.get())) { 591 588 // Any previous decryptor should have been removed from the pipeline by disconnectFromAppSinkFromStreamingThread() 592 589 ASSERT(!m_decryptor); 593 590 GstStructure* structure = gst_caps_get_structure(m_demuxerSrcPadCaps.get(), 0); 594 591 m_decryptor = GStreamerEMEUtilities::createDecryptor(gst_structure_get_string(structure, "protection-system")); 595 592 if (!m_decryptor) { … … 597 594 return; 598 595 } 599 600 const gchar* originalMediaType = gst_structure_get_string(structure, "original-media-type"); 601 602 596 } 597 #endif 598 const char* originalMediaType = capsMediaType(m_demuxerSrcPadCaps.get()); 599 if (!MediaPlayerPrivateGStreamerMSE::supportsCodec(originalMediaType)) { 603 600 m_presentationSize = WebCore::FloatSize(); 604 601 m_streamType = WebCore::MediaSourceStreamTypeGStreamer::Invalid; 605 } else if (g_str_has_prefix(originalMediaType, "video/")) { 606 int width = 0; 607 int height = 0; 608 float finalHeight = 0; 609 610 if (gst_structure_get_int(structure, "width", &width) && gst_structure_get_int(structure, "height", &height)) { 611 int ratioNumerator = 1; 612 int ratioDenominator = 1; 613 614 gst_structure_get_fraction(structure, "pixel-aspect-ratio", &ratioNumerator, &ratioDenominator); 615 finalHeight = height * ((float) ratioDenominator / (float) ratioNumerator); 616 } 617 618 m_presentationSize = WebCore::FloatSize(width, finalHeight); 619 m_streamType = WebCore::MediaSourceStreamTypeGStreamer::Video; 620 } else { 602 } else if (doCapsHaveType(m_demuxerSrcPadCaps.get(), GST_VIDEO_CAPS_TYPE_PREFIX)) { 603 std::optional<FloatSize> size = getVideoResolutionFromCaps(m_demuxerSrcPadCaps.get()); 604 if (size.has_value()) 605 m_presentationSize = size.value(); 606 else 621 607 m_presentationSize = WebCore::FloatSize(); 622 if (g_str_has_prefix(originalMediaType, "audio/")) 623 m_streamType = WebCore::MediaSourceStreamTypeGStreamer::Audio; 624 else if (g_str_has_prefix(originalMediaType, "text/")) 625 m_streamType = WebCore::MediaSourceStreamTypeGStreamer::Text; 626 } 627 sizeConfigured = true; 628 } 629 #endif 630 631 if (!sizeConfigured) { 632 const char* structureName = gst_structure_get_name(structure); 633 GstVideoInfo info; 634 635 if (!MediaPlayerPrivateGStreamerMSE::supportsCodec(structureName)) { 636 m_presentationSize = WebCore::FloatSize(); 637 m_streamType = WebCore::MediaSourceStreamTypeGStreamer::Invalid; 638 } else if (g_str_has_prefix(structureName, "video/") && gst_video_info_from_caps(&info, demuxerSrcPadCaps)) { 639 float width, height; 640 641 width = info.width; 642 height = info.height * ((float) info.par_d / (float) info.par_n); 643 644 m_presentationSize = WebCore::FloatSize(width, height); 645 m_streamType = WebCore::MediaSourceStreamTypeGStreamer::Video; 646 } else { 647 m_presentationSize = WebCore::FloatSize(); 648 if (g_str_has_prefix(structureName, "audio/")) 649 m_streamType = WebCore::MediaSourceStreamTypeGStreamer::Audio; 650 else if (g_str_has_prefix(structureName, "text/")) 651 m_streamType = WebCore::MediaSourceStreamTypeGStreamer::Text; 652 } 608 609 m_streamType = WebCore::MediaSourceStreamTypeGStreamer::Video; 610 } else { 611 m_presentationSize = WebCore::FloatSize(); 612 if (doCapsHaveType(m_demuxerSrcPadCaps.get(), GST_AUDIO_CAPS_TYPE_PREFIX)) 613 m_streamType = WebCore::MediaSourceStreamTypeGStreamer::Audio; 614 else if (doCapsHaveType(m_demuxerSrcPadCaps.get(), GST_TEXT_CAPS_TYPE_PREFIX)) 615 m_streamType = WebCore::MediaSourceStreamTypeGStreamer::Text; 653 616 } 654 617 } -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaDescription.cpp
r207876 r228316 21 21 #include "config.h" 22 22 #include "GStreamerMediaDescription.h" 23 23 #include "GStreamerUtilities.h" 24 24 #include "GUniquePtrGStreamer.h" 25 25 … … 34 34 AtomicString GStreamerMediaDescription::codec() const 35 35 { 36 GUniquePtr<gchar> description(gst_pb_utils_get_codec_description(m_caps.get())); 36 return m_codecName; 37 } 38 39 bool GStreamerMediaDescription::isVideo() const 40 { 41 return doCapsHaveType(m_caps.get(), GST_VIDEO_CAPS_TYPE_PREFIX); 42 } 43 44 bool GStreamerMediaDescription::isAudio() const 45 { 46 return doCapsHaveType(m_caps.get(), GST_AUDIO_CAPS_TYPE_PREFIX); 47 } 48 49 bool GStreamerMediaDescription::isText() const 50 { 51 // FIXME: Implement proper text track support. 52 return false; 53 } 54 55 AtomicString GStreamerMediaDescription::extractCodecName() 56 { 57 GRefPtr<GstCaps> originalCaps = m_caps; 58 59 if (areEncryptedCaps(originalCaps.get())) { 60 originalCaps = adoptGRef(gst_caps_copy(originalCaps.get())); 61 GstStructure* structure = gst_caps_get_structure(originalCaps.get(), 0); 62 63 if (!gst_structure_has_field(structure, "original-media-type")) 64 return AtomicString(); 65 66 gst_structure_set_name(structure, gst_structure_get_string(structure, "original-media-type")); 67 // Remove the DRM related fields from the caps. 68 for (int j = 0; j < gst_structure_n_fields(structure); ++j) { 69 const char* fieldName = gst_structure_nth_field_name(structure, j); 70 71 if (g_str_has_prefix(fieldName, "protection-system") 72 || g_str_has_prefix(fieldName, "original-media-type")) 73 gst_structure_remove_field(structure, fieldName); 74 } 75 } 76 77 GUniquePtr<gchar> description(gst_pb_utils_get_codec_description(originalCaps.get())); 37 78 String codecName(description.get()); 38 79 … … 43 84 size_t braceEnd = codecName.find(")"); 44 85 if (braceStart != notFound && braceEnd != notFound) 45 codecName.remove(braceStart, braceEnd -braceStart);86 codecName.remove(braceStart, braceEnd - braceStart); 46 87 } 47 88 … … 49 90 } 50 91 51 bool GStreamerMediaDescription::isVideo() const52 {53 GstStructure* structure = gst_caps_get_structure(m_caps.get(), 0);54 const gchar* name = gst_structure_get_name(structure);55 56 return g_str_has_prefix(name, "video/");57 }58 59 bool GStreamerMediaDescription::isAudio() const60 {61 GstStructure* structure = gst_caps_get_structure(m_caps.get(), 0);62 const gchar* name = gst_structure_get_name(structure);63 64 return g_str_has_prefix(name, "audio/");65 }66 67 bool GStreamerMediaDescription::isText() const68 {69 // FIXME: Implement proper text track support.70 return false;71 }72 73 92 } // namespace WebCore. 74 93 -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaDescription.h
r207876 r228316 27 27 28 28 #include <gst/gst.h> 29 #include <wtf/text/AtomicString.h> 29 30 30 31 namespace WebCore { … … 49 50 , m_caps(caps) 50 51 { 52 m_codecName = extractCodecName(); 51 53 } 52 54 55 AtomicString extractCodecName(); 53 56 GRefPtr<GstCaps> m_caps; 57 AtomicString m_codecName; 54 58 }; 55 59 -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp
r225594 r228316 740 740 GST_DEBUG("track ID: %s, caps: %" GST_PTR_FORMAT, newTrack->id().string().latin1().data(), caps); 741 741 742 GstStructure* structure = gst_caps_get_structure(caps, 0); 743 const gchar* mediaType = gst_structure_get_name(structure); 744 GstVideoInfo info; 745 746 if (g_str_has_prefix(mediaType, "video/") && gst_video_info_from_caps(&info, caps)) { 747 float width, height; 748 749 width = info.width; 750 height = info.height * ((float) info.par_d / (float) info.par_n); 751 m_videoSize.setWidth(width); 752 m_videoSize.setHeight(height); 742 if (doCapsHaveType(caps, GST_VIDEO_CAPS_TYPE_PREFIX)) { 743 std::optional<FloatSize> size = getVideoResolutionFromCaps(caps); 744 if (size.has_value()) 745 m_videoSize = size.value(); 753 746 } 754 747 755 748 if (firstTrackDetected) 756 m_playbackPipeline->attachTrack(appendPipeline->sourceBufferPrivate(), newTrack, structure,caps);749 m_playbackPipeline->attachTrack(appendPipeline->sourceBufferPrivate(), newTrack, caps); 757 750 else 758 m_playbackPipeline->reattachTrack(appendPipeline->sourceBufferPrivate(), newTrack, mediaType);751 m_playbackPipeline->reattachTrack(appendPipeline->sourceBufferPrivate(), newTrack, caps); 759 752 } 760 753 -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/PlaybackPipeline.cpp
r226357 r228316 163 163 } 164 164 165 void PlaybackPipeline::attachTrack(RefPtr<SourceBufferPrivateGStreamer> sourceBufferPrivate, RefPtr<TrackPrivateBase> trackPrivate, Gst Structure* structure, GstCaps* caps)165 void PlaybackPipeline::attachTrack(RefPtr<SourceBufferPrivateGStreamer> sourceBufferPrivate, RefPtr<TrackPrivateBase> trackPrivate, GstCaps* caps) 166 166 { 167 167 WebKitMediaSrc* webKitMediaSrc = m_webKitMediaSrc.get(); … … 178 178 GST_OBJECT_UNLOCK(webKitMediaSrc); 179 179 180 const gchar* mediaType = gst_structure_get_name(structure); 181 180 const char* mediaType = capsMediaType(caps); 182 181 GST_DEBUG_OBJECT(webKitMediaSrc, "Configured track %s: appsrc=%s, padId=%u, mediaType=%s", trackPrivate->id().string().utf8().data(), GST_ELEMENT_NAME(stream->appsrc), padId, mediaType); 183 182 … … 218 217 } else if (!g_strcmp0(mediaType, "audio/mpeg")) { 219 218 gint mpegversion = -1; 219 GstStructure* structure = gst_caps_get_structure(caps, 0); 220 220 gst_structure_get_int(structure, "mpegversion", &mpegversion); 221 221 … … 273 273 274 274 GST_OBJECT_LOCK(webKitMediaSrc); 275 if ( g_str_has_prefix(mediaType, "audio")) {275 if (doCapsHaveType(caps, GST_AUDIO_CAPS_TYPE_PREFIX)) { 276 276 stream->type = Audio; 277 277 stream->parent->priv->numberOfAudioStreams++; 278 278 signal = SIGNAL_AUDIO_CHANGED; 279 279 stream->audioTrack = RefPtr<WebCore::AudioTrackPrivateGStreamer>(static_cast<WebCore::AudioTrackPrivateGStreamer*>(trackPrivate.get())); 280 } else if ( g_str_has_prefix(mediaType, "video")) {280 } else if (doCapsHaveType(caps, GST_VIDEO_CAPS_TYPE_PREFIX)) { 281 281 stream->type = Video; 282 282 stream->parent->priv->numberOfVideoStreams++; 283 283 signal = SIGNAL_VIDEO_CHANGED; 284 284 stream->videoTrack = RefPtr<WebCore::VideoTrackPrivateGStreamer>(static_cast<WebCore::VideoTrackPrivateGStreamer*>(trackPrivate.get())); 285 } else if ( g_str_has_prefix(mediaType, "text")) {285 } else if (doCapsHaveType(caps, GST_TEXT_CAPS_TYPE_PREFIX)) { 286 286 stream->type = Text; 287 287 stream->parent->priv->numberOfTextStreams++; … … 296 296 } 297 297 298 void PlaybackPipeline::reattachTrack(RefPtr<SourceBufferPrivateGStreamer> sourceBufferPrivate, RefPtr<TrackPrivateBase> trackPrivate, const char* mediaType)298 void PlaybackPipeline::reattachTrack(RefPtr<SourceBufferPrivateGStreamer> sourceBufferPrivate, RefPtr<TrackPrivateBase> trackPrivate, GstCaps* caps) 299 299 { 300 300 GST_DEBUG("Re-attaching track"); … … 314 314 315 315 GST_OBJECT_LOCK(webKitMediaSrc); 316 if ( g_str_has_prefix(mediaType, "audio")) {316 if (doCapsHaveType(caps, GST_AUDIO_CAPS_TYPE_PREFIX)) { 317 317 ASSERT(stream->type == Audio); 318 318 signal = SIGNAL_AUDIO_CHANGED; 319 319 stream->audioTrack = RefPtr<WebCore::AudioTrackPrivateGStreamer>(static_cast<WebCore::AudioTrackPrivateGStreamer*>(trackPrivate.get())); 320 } else if ( g_str_has_prefix(mediaType, "video")) {320 } else if (doCapsHaveType(caps, GST_VIDEO_CAPS_TYPE_PREFIX)) { 321 321 ASSERT(stream->type == Video); 322 322 signal = SIGNAL_VIDEO_CHANGED; 323 323 stream->videoTrack = RefPtr<WebCore::VideoTrackPrivateGStreamer>(static_cast<WebCore::VideoTrackPrivateGStreamer*>(trackPrivate.get())); 324 } else if ( g_str_has_prefix(mediaType, "text")) {324 } else if (doCapsHaveType(caps, GST_TEXT_CAPS_TYPE_PREFIX)) { 325 325 ASSERT(stream->type == Text); 326 326 signal = SIGNAL_TEXT_CHANGED; -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/PlaybackPipeline.h
r222388 r228316 58 58 MediaSourcePrivate::AddStatus addSourceBuffer(RefPtr<SourceBufferPrivateGStreamer>); 59 59 void removeSourceBuffer(RefPtr<SourceBufferPrivateGStreamer>); 60 void attachTrack(RefPtr<SourceBufferPrivateGStreamer>, RefPtr<TrackPrivateBase>, Gst Structure*, GstCaps*);61 void reattachTrack(RefPtr<SourceBufferPrivateGStreamer>, RefPtr<TrackPrivateBase>, const char*);60 void attachTrack(RefPtr<SourceBufferPrivateGStreamer>, RefPtr<TrackPrivateBase>, GstCaps*); 61 void reattachTrack(RefPtr<SourceBufferPrivateGStreamer>, RefPtr<TrackPrivateBase>, GstCaps*); 62 62 void notifyDurationChanged(); 63 63 -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp
r222972 r228316 453 453 void webKitMediaSrcUpdatePresentationSize(GstCaps* caps, Stream* stream) 454 454 { 455 GstStructure* structure = gst_caps_get_structure(caps, 0);456 const gchar* structureName = gst_structure_get_name(structure);457 GstVideoInfo info;458 459 455 GST_OBJECT_LOCK(stream->parent); 460 if (g_str_has_prefix(structureName, "video/") && gst_video_info_from_caps(&info, caps)) { 461 float width, height; 462 463 // FIXME: Correct?. 464 width = info.width; 465 height = info.height * ((float) info.par_d / (float) info.par_n); 466 stream->presentationSize = WebCore::FloatSize(width, height); 456 if (WebCore::doCapsHaveType(caps, GST_VIDEO_CAPS_TYPE_PREFIX)) { 457 std::optional<WebCore::FloatSize> size = WebCore::getVideoResolutionFromCaps(caps); 458 if (size.has_value()) 459 stream->presentationSize = size.value(); 460 else 461 stream->presentationSize = WebCore::FloatSize(); 467 462 } else 468 463 stream->presentationSize = WebCore::FloatSize();
Note: See TracChangeset
for help on using the changeset viewer.