【问题标题】:RTSP not working when using 3G connection, however it works when using WiFi使用 3G 连接时 RTSP 不工作,但使用 WiFi 时它工作
【发布时间】:2012-05-14 04:56:27
【问题描述】:

我一直在开发播放不同无线电 rtsp 的应用程序,当我在仅使用 wifi(Android 4.3)的平板电脑上试用它时,我实际上可以很好地听到广播电台。但是,当我在手机上测试它(使用 Android 2.3)时,我无法使用它的 3G 连接获得任何结果。但是,当我打开手机的wifi时,它可以工作。

例如,此 rtsp 不适用于两种情况:rtsp://movil.mediastream.com.pe/av_rpp/audio01

我错过了什么?为什么它适用于wifi而不适用于3G?我该怎么做才能让它在带有 3G 的 Android 2.3 中运行?使应用程序正常工作的替代方法是什么?在此先感谢

这是我用来播放rtsp的功能;

public void playUrl( Context context, String myUrl )
{
    if ( myMusicPlayer == null )    { 

        myMusicPlayer = new MediaPlayer(); 
        myMusicPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);

        try {
            myMusicPlayer.setDataSource( myUrl );

        } catch (IllegalArgumentException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            Log.d( TAG, "Argument error: " + e.getMessage() ); 
        } catch (IllegalStateException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            Log.d( TAG, "State error: " + e.getMessage() ); 
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            Log.d( TAG, "IO error: " + e.getMessage() ); 
        } finally {
            Log.d( TAG, "myMusicPlayer with url: " + myUrl + " created from playUrl()" ); 

            try {
                myMusicPlayer.prepare();
            } catch (IllegalStateException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } finally {
                Log.d( TAG, "myMusicPlayer with url: " + myUrl + " prepared from playUrl()" ); 

                isPaused = false;
                isStopped = false;

                myMusicPlayer.setVolume( 0.4f, 0.4f ); 
                myMusicPlayer.start(); 
            }

        }

    }   // end of if statement

}

这是我在使用在 3G 中不起作用的 rtsp 之一时从 Android 鲨鱼那里得到的:

No.     Time        Source                Destination           Protocol Length Info
      1 0.000000    25.27.123.52          68.28.68.132          DNS      84     Standard query A rtsp.vog.sprintpcs.com

Frame 1: 84 bytes on wire (672 bits), 84 bytes captured (672 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 68.28.68.132 (68.28.68.132)
User Datagram Protocol, Src Port: 2015 (2015), Dst Port: domain (53)
Domain Name System (query)

No.     Time        Source                Destination           Protocol Length Info
      2 0.885515    68.28.68.132          25.27.123.52          DNS      130    Standard query response A 68.28.31.20

Frame 2: 130 bytes on wire (1040 bits), 130 bytes captured (1040 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 68.28.68.132 (68.28.68.132), Dst: 25.27.123.52 (25.27.123.52)
User Datagram Protocol, Src Port: domain (53), Dst Port: 2015 (2015)
Domain Name System (response)

No.     Time        Source                Destination           Protocol Length Info
      3 0.889796    25.27.123.52          68.28.31.20           TCP      76     51864 > rtsp [SYN] Seq=0 Win=65535 Len=0 MSS=1432 SACK_PERM=1 TSval=68282 TSecr=0 WS=2

Frame 3: 76 bytes on wire (608 bits), 76 bytes captured (608 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 68.28.31.20 (68.28.31.20)
Transmission Control Protocol, Src Port: 51864 (51864), Dst Port: rtsp (554), Seq: 0, Len: 0

No.     Time        Source                Destination           Protocol Length Info
      4 1.369477    68.28.31.20           25.27.123.52          TCP      80     rtsp > 51864 [SYN, ACK] Seq=0 Ack=1 Win=4296 Len=0 MSS=1460 WS=1 TSval=1377591467 TSecr=68282 SACK_PERM=1

Frame 4: 80 bytes on wire (640 bits), 80 bytes captured (640 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 68.28.31.20 (68.28.31.20), Dst: 25.27.123.52 (25.27.123.52)
Transmission Control Protocol, Src Port: rtsp (554), Dst Port: 51864 (51864), Seq: 0, Ack: 1, Len: 0

No.     Time        Source                Destination           Protocol Length Info
      5 1.370102    25.27.123.52          68.28.31.20           TCP      68     51864 > rtsp [ACK] Seq=1 Ack=1 Win=131070 Len=0 TSval=68379 TSecr=1377591467

Frame 5: 68 bytes on wire (544 bits), 68 bytes captured (544 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 68.28.31.20 (68.28.31.20)
Transmission Control Protocol, Src Port: 51864 (51864), Dst Port: rtsp (554), Seq: 1, Ack: 1, Len: 0

No.     Time        Source                Destination           Protocol Length Info
      6 1.372055    25.27.123.52          68.28.31.20           RTSP     581    OPTIONS rtsp://movil.mediastream.com.pe/av_rpp/audio01 RTSP/1.0

Frame 6: 581 bytes on wire (4648 bits), 581 bytes captured (4648 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 68.28.31.20 (68.28.31.20)
Transmission Control Protocol, Src Port: 51864 (51864), Dst Port: rtsp (554), Seq: 1, Ack: 1, Len: 513
Real Time Streaming Protocol

No.     Time        Source                Destination           Protocol Length Info
      7 2.074345    68.28.31.20           25.27.123.52          TCP      68     rtsp > 51864 [ACK] Seq=1 Ack=514 Win=4809 Len=0 TSval=1377592153 TSecr=68379

Frame 7: 68 bytes on wire (544 bits), 68 bytes captured (544 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 68.28.31.20 (68.28.31.20), Dst: 25.27.123.52 (25.27.123.52)
Transmission Control Protocol, Src Port: rtsp (554), Dst Port: 51864 (51864), Seq: 1, Ack: 514, Len: 0

No.     Time        Source                Destination           Protocol Length Info
      8 2.074776    25.27.123.52          68.28.31.20           RTSP     448    DESCRIBE rtsp://movil.mediastream.com.pe/av_rpp/audio01 RTSP/1.0

Frame 8: 448 bytes on wire (3584 bits), 448 bytes captured (3584 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 68.28.31.20 (68.28.31.20)
Transmission Control Protocol, Src Port: 51864 (51864), Dst Port: rtsp (554), Seq: 514, Ack: 1, Len: 380
Real Time Streaming Protocol

No.     Time        Source                Destination           Protocol Length Info
      9 2.169196    25.27.123.52          50.22.213.141         SSL      69     [Malformed Packet]

Frame 9: 69 bytes on wire (552 bits), 69 bytes captured (552 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 50.22.213.141 (50.22.213.141)
Transmission Control Protocol, Src Port: 39306 (39306), Dst Port: https (443), Seq: 1, Ack: 1, Len: 1
Secure Sockets Layer
[Malformed Packet: SSL]

No.     Time        Source                Destination           Protocol Length Info
     10 2.419297    68.28.31.20           25.27.123.52          RTSP     329    Reply: RTSP/1.0 200 OK

Frame 10: 329 bytes on wire (2632 bits), 329 bytes captured (2632 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 68.28.31.20 (68.28.31.20), Dst: 25.27.123.52 (25.27.123.52)
Transmission Control Protocol, Src Port: rtsp (554), Dst Port: 51864 (51864), Seq: 1, Ack: 894, Len: 261
Real Time Streaming Protocol

No.     Time        Source                Destination           Protocol Length Info
     11 2.419766    25.27.123.52          68.28.31.20           TCP      68     51864 > rtsp [ACK] Seq=894 Ack=262 Win=130812 Len=0 TSval=68589 TSecr=1377592715

Frame 11: 68 bytes on wire (544 bits), 68 bytes captured (544 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 68.28.31.20 (68.28.31.20)
Transmission Control Protocol, Src Port: 51864 (51864), Dst Port: rtsp (554), Seq: 894, Ack: 262, Len: 0

No.     Time        Source                Destination           Protocol Length Info
     12 2.509346    50.22.213.141         25.27.123.52          TCP      68     https > 39306 [ACK] Seq=1 Ack=2 Win=513 Len=0 TSval=3587254903 TSecr=68539

Frame 12: 68 bytes on wire (544 bits), 68 bytes captured (544 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 50.22.213.141 (50.22.213.141), Dst: 25.27.123.52 (25.27.123.52)
Transmission Control Protocol, Src Port: https (443), Dst Port: 39306 (39306), Seq: 1, Ack: 2, Len: 0

No.     Time        Source                Destination           Protocol Length Info
     13 2.510210    25.27.123.52          50.22.213.141         SSL      89     Continuation Data

Frame 13: 89 bytes on wire (712 bits), 89 bytes captured (712 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 50.22.213.141 (50.22.213.141)
Transmission Control Protocol, Src Port: 39306 (39306), Dst Port: https (443), Seq: 2, Ack: 1, Len: 21
Secure Sockets Layer

No.     Time        Source                Destination           Protocol Length Info
     14 2.819330    68.28.31.20           25.27.123.52          RTSP/SDP 740    Reply: RTSP/1.0 200 OK, with session description

Frame 14: 740 bytes on wire (5920 bits), 740 bytes captured (5920 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 68.28.31.20 (68.28.31.20), Dst: 25.27.123.52 (25.27.123.52)
Transmission Control Protocol, Src Port: rtsp (554), Dst Port: 51864 (51864), Seq: 262, Ack: 894, Len: 672
Real Time Streaming Protocol

No.     Time        Source                Destination           Protocol Length Info
     15 2.819649    25.27.123.52          68.28.31.20           TCP      68     51864 > rtsp [ACK] Seq=894 Ack=934 Win=130140 Len=0 TSval=68669 TSecr=1377592998

Frame 15: 68 bytes on wire (544 bits), 68 bytes captured (544 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 68.28.31.20 (68.28.31.20)
Transmission Control Protocol, Src Port: 51864 (51864), Dst Port: rtsp (554), Seq: 894, Ack: 934, Len: 0

No.     Time        Source                Destination           Protocol Length Info
     16 2.914297    50.22.213.141         25.27.123.52          SSL      78     Continuation Data

Frame 16: 78 bytes on wire (624 bits), 78 bytes captured (624 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 50.22.213.141 (50.22.213.141), Dst: 25.27.123.52 (25.27.123.52)
Transmission Control Protocol, Src Port: https (443), Dst Port: 39306 (39306), Seq: 1, Ack: 23, Len: 10
Secure Sockets Layer

No.     Time        Source                Destination           Protocol Length Info
     17 2.928645    25.27.123.52          68.28.31.20           RTSP     502    SETUP rtsp://movil.mediastream.com.pe/av_rpp/audio01/trackID=1 RTSP/1.0

Frame 17: 502 bytes on wire (4016 bits), 502 bytes captured (4016 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 68.28.31.20 (68.28.31.20)
Transmission Control Protocol, Src Port: 51864 (51864), Dst Port: rtsp (554), Seq: 894, Ack: 934, Len: 434
Real Time Streaming Protocol

No.     Time        Source                Destination           Protocol Length Info
     18 2.938016    25.27.123.52          50.22.213.141         TCP      68     39306 > https [FIN, ACK] Seq=23 Ack=11 Win=65348 Len=0 TSval=68692 TSecr=3587255189

Frame 18: 68 bytes on wire (544 bits), 68 bytes captured (544 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 50.22.213.141 (50.22.213.141)
Transmission Control Protocol, Src Port: 39306 (39306), Dst Port: https (443), Seq: 23, Ack: 11, Len: 0

No.     Time        Source                Destination           Protocol Length Info
     19 3.519708    50.22.213.141         25.27.123.52          TCP      68     https > 39306 [ACK] Seq=11 Ack=24 Win=513 Len=0 TSval=3587255676 TSecr=68692

Frame 19: 68 bytes on wire (544 bits), 68 bytes captured (544 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 50.22.213.141 (50.22.213.141), Dst: 25.27.123.52 (25.27.123.52)
Transmission Control Protocol, Src Port: https (443), Dst Port: 39306 (39306), Seq: 11, Ack: 24, Len: 0

No.     Time        Source                Destination           Protocol Length Info
     20 3.519727    50.22.213.141         25.27.123.52          TCP      68     https > 39306 [FIN, ACK] Seq=11 Ack=24 Win=513 Len=0 TSval=3587255676 TSecr=68692

Frame 20: 68 bytes on wire (544 bits), 68 bytes captured (544 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 50.22.213.141 (50.22.213.141), Dst: 25.27.123.52 (25.27.123.52)
Transmission Control Protocol, Src Port: https (443), Dst Port: 39306 (39306), Seq: 11, Ack: 24, Len: 0

No.     Time        Source                Destination           Protocol Length Info
     21 3.520178    25.27.123.52          50.22.213.141         TCP      68     39306 > https [ACK] Seq=24 Ack=12 Win=65348 Len=0 TSval=68809 TSecr=3587255676

Frame 21: 68 bytes on wire (544 bits), 68 bytes captured (544 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 50.22.213.141 (50.22.213.141)
Transmission Control Protocol, Src Port: 39306 (39306), Dst Port: https (443), Seq: 24, Ack: 12, Len: 0

No.     Time        Source                Destination           Protocol Length Info
     22 3.539004    68.28.31.20           25.27.123.52          TCP      68     rtsp > 51864 [ACK] Seq=934 Ack=1328 Win=5623 Len=0 TSval=1377593667 TSecr=68690

Frame 22: 68 bytes on wire (544 bits), 68 bytes captured (544 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 68.28.31.20 (68.28.31.20), Dst: 25.27.123.52 (25.27.123.52)
Transmission Control Protocol, Src Port: rtsp (554), Dst Port: 51864 (51864), Seq: 934, Ack: 1328, Len: 0

No.     Time        Source                Destination           Protocol Length Info
     23 3.539010    68.28.31.20           25.27.123.52          RTSP     192    Reply: RTSP/1.0 500 Internal Server Error

Frame 23: 192 bytes on wire (1536 bits), 192 bytes captured (1536 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 68.28.31.20 (68.28.31.20), Dst: 25.27.123.52 (25.27.123.52)
Transmission Control Protocol, Src Port: rtsp (554), Dst Port: 51864 (51864), Seq: 934, Ack: 1328, Len: 124
Real Time Streaming Protocol

No.     Time        Source                Destination           Protocol Length Info
     24 3.539159    25.27.123.52          68.28.31.20           TCP      68     51864 > rtsp [ACK] Seq=1328 Ack=1058 Win=130016 Len=0 TSval=68813 TSecr=1377593689

Frame 24: 68 bytes on wire (544 bits), 68 bytes captured (544 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 68.28.31.20 (68.28.31.20)
Transmission Control Protocol, Src Port: 51864 (51864), Dst Port: rtsp (554), Seq: 1328, Ack: 1058, Len: 0

No.     Time        Source                Destination           Protocol Length Info
     25 3.543981    68.28.31.20           25.27.123.52          TCP      68     rtsp > 51864 [FIN, ACK] Seq=1058 Ack=1328 Win=5623 Len=0 TSval=1377593731 TSecr=68690

Frame 25: 68 bytes on wire (544 bits), 68 bytes captured (544 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 68.28.31.20 (68.28.31.20), Dst: 25.27.123.52 (25.27.123.52)
Transmission Control Protocol, Src Port: rtsp (554), Dst Port: 51864 (51864), Seq: 1058, Ack: 1328, Len: 0

No.     Time        Source                Destination           Protocol Length Info
     26 3.584053    25.27.123.52          68.28.31.20           TCP      68     51864 > rtsp [ACK] Seq=1328 Ack=1059 Win=130016 Len=0 TSval=68822 TSecr=1377593731

Frame 26: 68 bytes on wire (544 bits), 68 bytes captured (544 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 68.28.31.20 (68.28.31.20)
Transmission Control Protocol, Src Port: 51864 (51864), Dst Port: rtsp (554), Seq: 1328, Ack: 1059, Len: 0

No.     Time        Source                Destination           Protocol Length Info
     27 3.590624    25.27.123.52          68.28.31.20           TCP      68     51864 > rtsp [FIN, ACK] Seq=1328 Ack=1059 Win=130016 Len=0 TSval=68823 TSecr=1377593731

Frame 27: 68 bytes on wire (544 bits), 68 bytes captured (544 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 68.28.31.20 (68.28.31.20)
Transmission Control Protocol, Src Port: 51864 (51864), Dst Port: rtsp (554), Seq: 1328, Ack: 1059, Len: 0

No.     Time        Source                Destination           Protocol Length Info
     28 3.874756    68.28.31.20           25.27.123.52          TCP      68     rtsp > 51864 [ACK] Seq=1059 Ack=1329 Win=5623 Len=0 TSval=1377594162 TSecr=68823

Frame 28: 68 bytes on wire (544 bits), 68 bytes captured (544 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 68.28.31.20 (68.28.31.20), Dst: 25.27.123.52 (25.27.123.52)
Transmission Control Protocol, Src Port: rtsp (554), Dst Port: 51864 (51864), Seq: 1059, Ack: 1329, Len: 0

No.     Time        Source                Destination           Protocol Length Info
     29 17.501055   25.27.123.52          68.28.68.132          DNS      86     

这是我为一个适用于 wifi 和 3G 的 rtsp 获得的 pcap 文件:

No.     Time        Source                Destination           Protocol Length Info
      1 0.000000    107.20.164.42         25.27.123.52          TCP      56     http > 53888 [ACK] Seq=1 Ack=1 Win=4824 Len=0

Frame 1: 56 bytes on wire (448 bits), 56 bytes captured (448 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 107.20.164.42 (107.20.164.42), Dst: 25.27.123.52 (25.27.123.52)
Transmission Control Protocol, Src Port: http (80), Dst Port: 53888 (53888), Seq: 1, Ack: 1, Len: 0

No.     Time        Source                Destination           Protocol Length Info
      2 10.627568   25.27.123.52          68.28.68.132          DNS      84     Standard query A rtsp.vog.sprintpcs.com

Frame 2: 84 bytes on wire (672 bits), 84 bytes captured (672 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 68.28.68.132 (68.28.68.132)
User Datagram Protocol, Src Port: 61420 (61420), Dst Port: domain (53)
Domain Name System (query)

No.     Time        Source                Destination           Protocol Length Info
      3 11.085971   68.28.68.132          25.27.123.52          DNS      130    Standard query response A 68.28.31.20

Frame 3: 130 bytes on wire (1040 bits), 130 bytes captured (1040 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 68.28.68.132 (68.28.68.132), Dst: 25.27.123.52 (25.27.123.52)
User Datagram Protocol, Src Port: domain (53), Dst Port: 61420 (61420)
Domain Name System (response)

No.     Time        Source                Destination           Protocol Length Info
      4 11.088280   25.27.123.52          68.28.31.20           TCP      76     51402 > rtsp [SYN] Seq=0 Win=65535 Len=0 MSS=1432 SACK_PERM=1 TSval=280424 TSecr=0 WS=2

Frame 4: 76 bytes on wire (608 bits), 76 bytes captured (608 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 68.28.31.20 (68.28.31.20)
Transmission Control Protocol, Src Port: 51402 (51402), Dst Port: rtsp (554), Seq: 0, Len: 0

No.     Time        Source                Destination           Protocol Length Info
      5 11.184782   68.28.31.20           25.27.123.52          TCP      80     rtsp > 51402 [SYN, ACK] Seq=0 Ack=1 Win=4296 Len=0 MSS=1460 WS=1 TSval=1378652387 TSecr=280424 SACK_PERM=1

Frame 5: 80 bytes on wire (640 bits), 80 bytes captured (640 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 68.28.31.20 (68.28.31.20), Dst: 25.27.123.52 (25.27.123.52)
Transmission Control Protocol, Src Port: rtsp (554), Dst Port: 51402 (51402), Seq: 0, Ack: 1, Len: 0

No.     Time        Source                Destination           Protocol Length Info
      6 11.185299   25.27.123.52          68.28.31.20           TCP      68     51402 > rtsp [ACK] Seq=1 Ack=1 Win=131070 Len=0 TSval=280444 TSecr=1378652387

Frame 6: 68 bytes on wire (544 bits), 68 bytes captured (544 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 68.28.31.20 (68.28.31.20)
Transmission Control Protocol, Src Port: 51402 (51402), Dst Port: rtsp (554), Seq: 1, Ack: 1, Len: 0

No.     Time        Source                Destination           Protocol Length Info
      7 11.186806   25.27.123.52          68.28.31.20           RTSP     576    OPTIONS rtsp://67.212.178.250/live/lakalle.stream RTSP/1.0

Frame 7: 576 bytes on wire (4608 bits), 576 bytes captured (4608 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 68.28.31.20 (68.28.31.20)
Transmission Control Protocol, Src Port: 51402 (51402), Dst Port: rtsp (554), Seq: 1, Ack: 1, Len: 508
Real Time Streaming Protocol

No.     Time        Source                Destination           Protocol Length Info
      8 11.405223   68.28.31.20           25.27.123.52          RTSP     353    Reply: RTSP/1.0 200 OK

Frame 8: 353 bytes on wire (2824 bits), 353 bytes captured (2824 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 68.28.31.20 (68.28.31.20), Dst: 25.27.123.52 (25.27.123.52)
Transmission Control Protocol, Src Port: rtsp (554), Dst Port: 51402 (51402), Seq: 1, Ack: 509, Len: 285
Real Time Streaming Protocol

No.     Time        Source                Destination           Protocol Length Info
      9 11.405676   25.27.123.52          68.28.31.20           RTSP     443    DESCRIBE rtsp://67.212.178.250/live/lakalle.stream RTSP/1.0

Frame 9: 443 bytes on wire (3544 bits), 443 bytes captured (3544 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 68.28.31.20 (68.28.31.20)
Transmission Control Protocol, Src Port: 51402 (51402), Dst Port: rtsp (554), Seq: 509, Ack: 286, Len: 375
Real Time Streaming Protocol

No.     Time        Source                Destination           Protocol Length Info
     10 11.734520   68.28.31.20           25.27.123.52          RTSP/SDP 757    Reply: RTSP/1.0 200 OK, with session description

Frame 10: 757 bytes on wire (6056 bits), 757 bytes captured (6056 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 68.28.31.20 (68.28.31.20), Dst: 25.27.123.52 (25.27.123.52)
Transmission Control Protocol, Src Port: rtsp (554), Dst Port: 51402 (51402), Seq: 286, Ack: 884, Len: 689
Real Time Streaming Protocol

No.     Time        Source                Destination           Protocol Length Info
     11 11.774576   25.27.123.52          68.28.31.20           TCP      68     51402 > rtsp [ACK] Seq=884 Ack=975 Win=130100 Len=0 TSval=280562 TSecr=1378652931

Frame 11: 68 bytes on wire (544 bits), 68 bytes captured (544 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 68.28.31.20 (68.28.31.20)
Transmission Control Protocol, Src Port: 51402 (51402), Dst Port: rtsp (554), Seq: 884, Ack: 975, Len: 0

No.     Time        Source                Destination           Protocol Length Info
     12 11.775863   25.27.123.52          68.28.31.20           RTSP     499    SETUP rtsp://67.212.178.250/live/lakalle.stream/trackID=1 RTSP/1.0

Frame 12: 499 bytes on wire (3992 bits), 499 bytes captured (3992 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 68.28.31.20 (68.28.31.20)
Transmission Control Protocol, Src Port: 51402 (51402), Dst Port: rtsp (554), Seq: 884, Ack: 975, Len: 431
Real Time Streaming Protocol

No.     Time        Source                Destination           Protocol Length Info
     13 11.919571   68.28.31.20           25.27.123.52          RTSP     424    Reply: RTSP/1.0 200 OK

Frame 13: 424 bytes on wire (3392 bits), 424 bytes captured (3392 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 68.28.31.20 (68.28.31.20), Dst: 25.27.123.52 (25.27.123.52)
Transmission Control Protocol, Src Port: rtsp (554), Dst Port: 51402 (51402), Seq: 975, Ack: 1315, Len: 356
Real Time Streaming Protocol

No.     Time        Source                Destination           Protocol Length Info
     14 11.919788   25.27.123.52          68.28.31.20           TCP      68     51402 > rtsp [ACK] Seq=1315 Ack=1331 Win=129744 Len=0 TSval=280591 TSecr=1378653113

Frame 14: 68 bytes on wire (544 bits), 68 bytes captured (544 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 68.28.31.20 (68.28.31.20)
Transmission Control Protocol, Src Port: 51402 (51402), Dst Port: rtsp (554), Seq: 1315, Ack: 1331, Len: 0

No.     Time        Source                Destination           Protocol Length Info
     15 12.242948   25.27.123.52          68.28.31.20           RTP      56     Unknown RTP version 0

Frame 15: 56 bytes on wire (448 bits), 56 bytes captured (448 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 68.28.31.20 (68.28.31.20)
User Datagram Protocol, Src Port: 11960 (11960), Dst Port: afs3-kaserver (7004)
Real-Time Transport Protocol

No.     Time        Source                Destination           Protocol Length Info
     16 12.246630   25.27.123.52          68.28.31.20           RTSP     432    PLAY rtsp://67.212.178.250/live/lakalle.stream RTSP/1.0

Frame 16: 432 bytes on wire (3456 bits), 432 bytes captured (3456 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 68.28.31.20 (68.28.31.20)
Transmission Control Protocol, Src Port: 51402 (51402), Dst Port: rtsp (554), Seq: 1315, Ack: 1331, Len: 364
Real Time Streaming Protocol

No.     Time        Source                Destination           Protocol Length Info
     17 12.255425   25.27.123.52          68.28.31.20           RTP      56     Unknown RTP version 0

Frame 17: 56 bytes on wire (448 bits), 56 bytes captured (448 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 68.28.31.20 (68.28.31.20)
User Datagram Protocol, Src Port: 11960 (11960), Dst Port: afs3-kaserver (7004)
Real-Time Transport Protocol

No.     Time        Source                Destination           Protocol Length Info
     18 12.256874   25.27.123.52          68.28.31.20           RTP      56     Unknown RTP version 0

Frame 18: 56 bytes on wire (448 bits), 56 bytes captured (448 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 68.28.31.20 (68.28.31.20)
User Datagram Protocol, Src Port: 11960 (11960), Dst Port: afs3-kaserver (7004)
Real-Time Transport Protocol

No.     Time        Source                Destination           Protocol Length Info
     19 12.425122   68.28.31.20           25.27.123.52          RTSP     364    Reply: RTSP/1.0 200 OK

Frame 19: 364 bytes on wire (2912 bits), 364 bytes captured (2912 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 68.28.31.20 (68.28.31.20), Dst: 25.27.123.52 (25.27.123.52)
Transmission Control Protocol, Src Port: rtsp (554), Dst Port: 51402 (51402), Seq: 1331, Ack: 1679, Len: 296
Real Time Streaming Protocol

No.     Time        Source                Destination           Protocol Length Info
     20 12.425476   25.27.123.52          68.28.31.20           TCP      68     51402 > rtsp [ACK] Seq=1679 Ack=1627 Win=129448 Len=0 TSval=280692 TSecr=1378653592

Frame 20: 68 bytes on wire (544 bits), 68 bytes captured (544 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 25.27.123.52 (25.27.123.52), Dst: 68.28.31.20 (68.28.31.20)
Transmission Control Protocol, Src Port: 51402 (51402), Dst Port: rtsp (554), Seq: 1679, Ack: 1627, Len: 0

No.     Time        Source                Destination           Protocol Length Info
     21 12.494663   68.28.31.20           25.27.123.52          RTCP     72     Sender Report   

【问题讨论】:

  • 你能分享 .pcap 文件吗?对于 Android,您可以使用“shark”工具捕获数据包。捕获 RTSP 数据包,保存文件并使用 wireshark/ethereal 在桌面上打开它。请发布完整的 RTSP 请求和响应。
  • 我曾尝试使用“shark”应用程序,但它给了我一个错误提示:“无法执行 Root 启动序列。你有 root”。是否需要安装其他应用程序才能使用鲨鱼?
  • 我能够root我的设备并让鲨鱼嗅探我编辑我的问题并添加pcap文件的数据包,谢谢
  • 您明显收到“RTSP/1.0 500 内部服务器错误”以响应 SETUP。这可能是由于您的 SETUP 请求中的标头字段错误,或者服务器没有足够的信息/能力来发送对 SETUP 请求的回复,因此仅发出“500 Internal Server Error”
  • 有什么我可以做的吗,这意味着我是否可以在我的 MediaPlayer 代码中更改或添加一些内容以使其正常工作。另外,为什么我在 3G 上而不是在 WiFi 上出现此错误,知道这是我可以在这里应用的解决方法

标签: android streaming rtsp android-wifi rtsp-client


【解决方案1】:

它是否适用于第三方应用程序?您的移动提供商可能正在过滤您的连接,因此 RTP 数据包无法通过。如果是这样的话,你真的无能为力。

【讨论】:

  • 好吧,我认为这与运营商无关,我试过这个 rtsp:“rtsp://67.212.178.250/live/lakalle.stream”,它在 wifi 和3G,但是这个:“rtsp://movil.mediastream.com.pe/av_rpp/audio01”仅适用于 wifi 而不是 3G
  • 这些是我可以通过 WiFi 使用 MediaPlayer 播放的其他网址,但不能使用 3G:76.10.222.35:9200/;stream.nsvmediastream.pe/crp/spot/cuNa.mp3
  • 当我使用 WiFi 连接时,所有 rtsp 和 mp3 链接都可以正常工作,但不能使用 3G。我没有在其他应用程序中尝试过它们,因为这是我正在开发的唯一使用这些链接的应用程序
  • 还有其他应用程序,如 tunein 播放相同的收音机,我猜他们能够使用他们的 rtsp 链接,但不确定如何使其适用于 3G 连接
  • 考虑切换协议,因为 3G 上的 RTSP 可能被证明是一个长期复杂的头痛问题。我只看到你的音频,但也许你看看 dash-js ....www-itec.uni-klu.ac.at/dash/?page_id=746 在你打开 chrome 中的视频标志后尝试 chrome 中的示例
【解决方案2】:

在您的第一个 pcap 文件(转储中缺少任何 RTP 数据包的文件)中,客户端和服务器可能不同意 RTSP 协议中的 TRANSPORT。如果您查看 DESCRIBE 和 SETUP 之间的典型 rtsp 对话,应该就传输协议达成一致,该协议将涵盖未通过 3G pcap 的二进制数据连接(音频流)的 IP 地址/端口。

请参阅此 RTSP 会话中的 #149、#156 dump

也许您需要弄清楚如何让您的 pcap 查看器从您正在转储的 RTSP 数据包中的适当位移中提取和/或格式化实际的 RTPS 消息。这样,您可以比较正常 RTSP 会话的情况,如提供的链接中的会话。

【讨论】:

  • 这些 pcap 文件比我在我的问题上发布的要大得多,有没有办法发布完整的 pcap 文件以更好地向您展示发生了什么?谢谢
  • 你可以用 pastebin 来做大事.. 给它一个月的有效期
  • 好的,知道了,这里是 2 个 pcap 文件的链接:pastebin.com/9UWaQS8spastebin.com/iD41V6Pp
猜你喜欢
  • 2012-01-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-05-01
  • 1970-01-01
  • 2011-12-22
  • 2012-06-09
相关资源
最近更新 更多