Index: src/wp-includes/class-wp-embed.php
===================================================================
--- src/wp-includes/class-wp-embed.php	(revision 33869)
+++ src/wp-includes/class-wp-embed.php	(working copy)
@@ -322,6 +322,9 @@
 		// Replace line breaks from all HTML elements with placeholders.
 		$content = wp_replace_in_html_tags( $content, array( "\n" => '<!-- wp-line-break -->' ) );
 
+		// Find URLs within paragraph tags.
+		$content = preg_replace_callback( '|(?:<p>)(?<!")(https?:\/\/[^\s"\[<]+)(?:<\/p>)|im', array( $this, 'para_autoembed_callback' ), $content );
+
 		// Find URLs that are on their own line.
 		$content = preg_replace_callback( '|^(\s*)(https?://[^\s"]+)(\s*)$|im', array( $this, 'autoembed_callback' ), $content );
 
@@ -345,6 +348,21 @@
 	}
 
 	/**
+	 * Callback function for {@link WP_Embed::autoembed()} specifically for paragraph based media url checks.
+	 *
+	 * @param array $match A regex match array.
+	 * @return string The embed HTML on success, otherwise the original URL.
+	 */
+	public function para_autoembed_callback( $match ) {
+		$oldval = $this->linkifunknown;
+		$this->linkifunknown = false;
+		$return = $this->shortcode( array(), $match[1] );
+		$this->linkifunknown = $oldval;
+
+		return $return;
+	}
+
+	/**
 	 * Conditionally makes a hyperlink based on an internal class variable.
 	 *
 	 * @param string $url URL to potentially be linked.
Index: tests/phpunit/tests/media.php
===================================================================
--- tests/phpunit/tests/media.php	(revision 33869)
+++ tests/phpunit/tests/media.php	(working copy)
@@ -718,4 +718,123 @@
 
 		remove_filter( 'embed_maybe_make_link', array( $this, 'filter_wp_embed_shortcode_custom' ), 10 );
 	}
+
+
+	/**
+	 * @ticket 25387
+	 * Testing variants of Autoembeds within paragraphs and surrounded by other text/markup
+	 */
+	function test_autoembed_inline_paragraph() {
+
+		$embed = new WP_Embed();
+		$url1 = '<p>
+ http://www.youtube.com/watch?v=ZJrP9irrLZk
+ </p>';
+		$embed_oembed1 = <<<VIDEOWITHPTAG
+<p>http://www.youtube.com/watch?v=ZJrP9irrLZk</p>
+VIDEOWITHPTAG;
+
+		$url2 = '<p>test
+
+http://www.youtube.com/watch?v=ZJrP9irrLZk
+
+test</p>';
+		$embed_oembed2 = <<<VIDEOWITHPTAGANDTEXT
+<p>test
+http://www.youtube.com/watch?v=ZJrP9irrLZk
+test</p>
+VIDEOWITHPTAGANDTEXT;
+
+		$url3 = 'http://www.youtube.com/watch?v=ZJrP9irrLZk';
+		$embed_oembed3 = <<<VIDEONOEMBED
+http://www.youtube.com/watch?v=ZJrP9irrLZk
+VIDEONOEMBED;
+
+		$embed_oembed4 = <<<VIDEOEMBEDWITHSPACE
+[embed] http://vimeo.com/85107599[/embed]
+VIDEOEMBEDWITHSPACE;
+		$url4 = 'http://vimeo.com/85107599';
+
+		$embed_oembed5 = <<<LINKWITHSPACE
+<a href=" http://www.youtube.com/watch?v=ZJrP9irrLZk">Video link not embedded because of space within href attribute</a>
+LINKWITHSPACE;
+		$url5 = '<a href=" http://www.youtube.com/watch?v=ZJrP9irrLZk">Video link not embedded because of space within href attribute</a>';
+
+		$embed_oembed6 = <<<URLSWHITESPACE
+So, YouTube video firsthttp://www.youtube.com/watch?v=ZJrP9irrLZk Now, after YouTube comes Vimeo video secondhttp://vimeo.com/85107599 and after Vimeo
+URLSWHITESPACE;
+		$url6 = 'So, YouTube video first
+http://www.youtube.com/watch?v=ZJrP9irrLZk
+ Now, after YouTube comes Vimeo video second
+http://vimeo.com/85107599
+ and after Vimeo';
+
+		$embed_oembed7 = <<<STANDARDANCHORLINK
+<a href="http://www.youtube.com/watch?v=ZJrP9irrLZk">Sample this should be a link</a>
+STANDARDANCHORLINK;
+		$url7 = '<a href="http://www.youtube.com/watch?v=ZJrP9irrLZk">Sample this should be a link</a>';
+
+		$embed_oembed8 = <<<URLWITHMARKUP
+Video url surrounded by span styled with border and background
+<span style="border: 5px solid gray; background: #0000cc;">http://www.youtube.com/watch?v=ZJrP9irrLZk</span>
+URLWITHMARKUP;
+		$url8 = 'Video url surrounded by span styled with border and background
+<span style="border: 5px solid gray; background: #0000cc;">
+http://www.youtube.com/watch?v=ZJrP9irrLZk
+</span>';
+
+		$embed_oembed9 = <<<EMBEDVIDEOPRESS
+VideoPress wrapped in [ e m b e d ] tags
+[embed]http://videos.videopress.com/EsBeI509/video-4f0ea27927_dvd.mp4[/embed]
+EMBEDVIDEOPRESS;
+		$url9 = 'VideoPress wrapped in [ e m b e d ] tags
+[embed]
+http://videos.videopress.com/EsBeI509/video-4f0ea27927_dvd.mp4
+[/embed]';
+
+		$embed_oembed10 = <<<FLICKRFULLURL
+<p>http://www.flickr.com/photos/seanhayes/270924038/</p>
+FLICKRFULLURL;
+		$url10 = '<p>
+http://www.flickr.com/photos/seanhayes/270924038/
+</p>';
+
+		$embed_oembed11 = <<<DAILYMOTIONFULLURL
+<p>http://www.dailymotion.com/video/x1gl4rz_the-rolling-stones-rock-shanghai_news</p>
+DAILYMOTIONFULLURL;
+		$url11 = '<p>http://www.dailymotion.com/video/x1gl4rz_the-rolling-stones-rock-shanghai_news</p>';
+
+//		$content1 = $embed->autoembed( $embed_oembed1 );
+//		$this->assertContains( $url1, $content1 );
+//
+//		$content2 = $embed->autoembed( $embed_oembed2 );
+//		$this->assertContains( $url2, $content2 );
+//
+//		$content3 = $embed->autoembed( $embed_oembed3 );
+//		$this->assertContains( $url3, $content3 );
+//
+//		$content4 = $embed->autoembed( $embed_oembed4 );
+//		$this->assertContains( $url4, $content4 );
+//
+//		$content5 = $embed->autoembed( $embed_oembed5 );
+//		$this->assertEquals( $url5, $content5 );
+//
+//		$content6 = $embed->autoembed( $embed_oembed6 );
+//		$this->assertContains( $url6, $content6 );
+//
+//		$content7 = $embed->autoembed( $embed_oembed7 );
+//		$this->assertEquals( $url7, $content7 );
+//
+//		$content8 = $embed->autoembed( $embed_oembed8 );
+//		$this->assertEquals( $url8, $content8 );
+//
+//		$content9 = $embed->autoembed( $embed_oembed9 );
+//		$this->assertContains( $url9, $content9 );
+//
+//		$content10 = $embed->autoembed( $embed_oembed10 );
+//		$this->assertEquals( $url10, $content10 );
+
+		$content11 = $embed->autoembed( $embed_oembed11 );
+		$this->assertEquals( $url11, $content11 );
+	}
 }
