Skip to content

Commit ddb89cb

Browse files
committed
Modify examples
1 parent 2fc9bc9 commit ddb89cb

File tree

2 files changed

+7
-18
lines changed

2 files changed

+7
-18
lines changed

example/complete_example.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,13 @@ int main(int argc, char *argv[])
9898
* refered in SDP, only receive packets of the first
9999
* 'video' session, the same as 'audio'.*/
100100
int packet_num = 0;
101-
uint8_t buf[8192];
101+
uint8_t buf[65534];
102102
size_t size = 0;
103103

104104
/* Write h264 video data to file "test_packet_recv.h264"
105105
* Then it could be played by ffplay */
106-
int fd = open("test_packet_recv.h264", O_CREAT | O_RDWR, 0);
106+
// int fd = open("test_packet_recv.h264", O_CREAT | O_RDWR, 0);
107+
int fd = open("test_packet_recv.h264", O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR | S_IXUSR);
107108
if(Client.GetSPSNalu(buf, &size)) {
108109
if(write(fd, buf, size) < 0) {
109110
perror("write");

example/simple_example.cpp

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,6 @@
1313
// limitations under the License.
1414
//
1515

16-
// Copyright 2015 Ansersion
17-
//
18-
// Licensed under the Apache License, Version 2.0 (the "License");
19-
// you may not use this file except in compliance with the License.
20-
// You may obtain a copy of the License at
21-
//
22-
// http://www.apache.org/licenses/LICENSE-2.0
23-
//
24-
// Unless required by applicable law or agreed to in writing, software
25-
// distributed under the License is distributed on an "AS IS" BASIS,
26-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27-
// See the License for the specific language governing permissions and
28-
// limitations under the License.
2916
#include <iostream>
3017
#include "rtspClient.h"
3118
#include <stdio.h>
@@ -39,7 +26,8 @@ using std::endl;
3926

4027
int main(int argc, char *argv[])
4128
{
42-
string RtspUri("rtsp://127.0.0.1/ansersion");
29+
// string RtspUri("rtsp://127.0.0.1/ansersion");
30+
string RtspUri("rtsp://192.168.81.145/ansersion");
4331
RtspClient Client;
4432

4533
/* Set up rtsp server resource URI */
@@ -68,12 +56,12 @@ int main(int argc, char *argv[])
6856
* refered in SDP, only receive packets of the first
6957
* 'video' session, the same as 'audio'.*/
7058
int packet_num = 0;
71-
uint8_t buf[8192];
59+
uint8_t buf[65534];
7260
size_t size = 0;
7361

7462
/* Write h264 video data to file "test_packet_recv.h264"
7563
* Then it could be played by ffplay */
76-
int fd = open("test_packet_recv.h264", O_CREAT | O_RDWR, 0);
64+
int fd = open("test_packet_recv.h264", O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR | S_IXUSR);
7765
if(Client.GetSPSNalu(buf, &size)) {
7866
if(write(fd, buf, size) < 0) {
7967
perror("write");

0 commit comments

Comments
 (0)