Index: src/wp-includes/class-wp-embed.php
===================================================================
--- src/wp-includes/class-wp-embed.php	(revision 33407)
+++ src/wp-includes/class-wp-embed.php	(working copy)
@@ -318,11 +318,33 @@
 	 * @return string Potentially modified $content.
 	 */
 	public function autoembed( $content ) {
-		// Strip newlines from all elements.
-		$content = wp_replace_in_html_tags( $content, array( "\n" => " " ) );
+		$r = '';
+		$contentarr = preg_split( '/(<[^>]+>)/', $content, -1, PREG_SPLIT_DELIM_CAPTURE );
+		$in_link = false;
 
-		// Find URLs that are on their own line.
-		return preg_replace_callback( '|^(\s*)(https?://[^\s"]+)(\s*)$|im', array( $this, 'autoembed_callback' ), $content );
+		foreach ( $contentarr as $piece ) {
+			$last_piece = $piece;
+
+			if ( empty( $piece ) || $piece[0] === '<' ) {
+				$in_link = ( 0 === stripos( $piece, '<a' ) );
+				$r .= $piece;
+				continue;
+			}
+
+			if ( false !== stripos( $piece, 'http' ) ) {
+				// If an URL is wrapped in a link, skip it
+				if ( $in_link && false !== stripos( $last_piece, trim( $piece ) ) ) {
+					$r .= $piece;
+					continue;	
+				}
+
+				$r .= preg_replace_callback( '|^(\s*)(https?://[^\s"]+)(\s*)$|im', array( $this, 'autoembed_callback' ), $piece );
+			} else {
+				$r .= $piece;
+			}
+		}
+
+		return $r;
 	}
 
 	/**
